Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3b11b57a
Commit
3b11b57a
authored
Jun 30, 2003
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Plain Diff
Merge kernel.bkbits.net:/home/jmorris/net-2.5
into linux-ipv6.org:/home/jmorris/bk/net/work-2.5
parents
67c62753
452b9318
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
50 deletions
+121
-50
include/net/ipv6.h
include/net/ipv6.h
+2
-0
net/ipv6/ip6_flowlabel.c
net/ipv6/ip6_flowlabel.c
+112
-45
net/ipv6/ip6_output.c
net/ipv6/ip6_output.c
+6
-4
net/ipv6/reassembly.c
net/ipv6/reassembly.c
+1
-1
No files found.
include/net/ipv6.h
View file @
3b11b57a
...
...
@@ -101,6 +101,8 @@ struct frag_hdr {
__u32
identification
;
};
#define IP6_MF 0x0001
#ifdef __KERNEL__
#include <net/sock.h>
...
...
net/ipv6/ip6_flowlabel.c
View file @
3b11b57a
...
...
@@ -19,6 +19,7 @@
#include <linux/in6.h>
#include <linux/route.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <net/sock.h>
...
...
@@ -554,66 +555,132 @@ int ipv6_flowlabel_opt(struct sock *sk, char *optval, int optlen)
#ifdef CONFIG_PROC_FS
struct
ip6fl_iter_state
{
int
bucket
;
};
static
int
ip6_fl_read_proc
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
,
int
*
eof
,
void
*
data
)
{
off_t
pos
=
0
;
off_t
begin
=
0
;
int
len
=
0
;
int
i
,
k
;
struct
ip6_flowlabel
*
fl
;
#define ip6fl_seq_private(seq) ((struct ip6fl_iter_state *)&(seq)->private)
len
+=
sprintf
(
buffer
,
"Label S Owner Users Linger Expires "
"Dst Opt
\n
"
);
static
struct
ip6_flowlabel
*
ip6fl_get_first
(
struct
seq_file
*
seq
)
{
struct
ip6_flowlabel
*
fl
=
NULL
;
struct
ip6fl_iter_state
*
state
=
ip6fl_seq_private
(
seq
);
read_lock_bh
(
&
ip6_fl_lock
);
for
(
i
=
0
;
i
<=
FL_HASH_MASK
;
i
++
)
{
for
(
fl
=
fl_ht
[
i
];
fl
;
fl
=
fl
->
next
)
{
len
+=
sprintf
(
buffer
+
len
,
"%05X %-1d %-6d %-6d %-6d %-8ld "
,
(
unsigned
)
ntohl
(
fl
->
label
),
fl
->
share
,
(
unsigned
)
fl
->
owner
,
atomic_read
(
&
fl
->
users
),
fl
->
linger
/
HZ
,
(
long
)(
fl
->
expires
-
jiffies
)
/
HZ
);
for
(
k
=
0
;
k
<
16
;
k
++
)
len
+=
sprintf
(
buffer
+
len
,
"%02x"
,
fl
->
dst
.
s6_addr
[
k
]);
buffer
[
len
++
]
=
' '
;
len
+=
sprintf
(
buffer
+
len
,
"%-4d"
,
fl
->
opt
?
fl
->
opt
->
opt_nflen
:
0
);
buffer
[
len
++
]
=
'\n'
;
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
goto
done
;
for
(
state
->
bucket
=
0
;
state
->
bucket
<=
FL_HASH_MASK
;
++
state
->
bucket
)
{
if
(
fl_ht
[
state
->
bucket
])
{
fl
=
fl_ht
[
state
->
bucket
];
break
;
}
}
*
eof
=
1
;
return
fl
;
}
done:
static
struct
ip6_flowlabel
*
ip6fl_get_next
(
struct
seq_file
*
seq
,
struct
ip6_flowlabel
*
fl
)
{
struct
ip6fl_iter_state
*
state
=
ip6fl_seq_private
(
seq
);
fl
=
fl
->
next
;
while
(
!
fl
)
{
if
(
++
state
->
bucket
<=
FL_HASH_MASK
)
fl
=
fl_ht
[
state
->
bucket
];
}
return
fl
;
}
static
struct
ip6_flowlabel
*
ip6fl_get_idx
(
struct
seq_file
*
seq
,
loff_t
pos
)
{
struct
ip6_flowlabel
*
fl
=
ip6fl_get_first
(
seq
);
if
(
fl
)
while
(
pos
&&
(
fl
=
ip6fl_get_next
(
seq
,
fl
))
!=
NULL
)
--
pos
;
return
pos
?
NULL
:
fl
;
}
static
void
*
ip6fl_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
read_lock_bh
(
&
ip6_fl_lock
);
return
*
pos
?
ip6fl_get_idx
(
seq
,
*
pos
)
:
(
void
*
)
1
;
}
static
void
*
ip6fl_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
{
struct
ip6_flowlabel
*
fl
;
if
(
v
==
(
void
*
)
1
)
fl
=
ip6fl_get_first
(
seq
);
else
fl
=
ip6fl_get_next
(
seq
,
v
);
++*
pos
;
return
fl
;
}
static
void
ip6fl_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
{
read_unlock_bh
(
&
ip6_fl_lock
);
*
start
=
buffer
+
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
if
(
len
>
length
)
len
=
length
;
if
(
len
<
0
)
len
=
0
;
return
len
;
}
static
void
ip6fl_fl_seq_show
(
struct
seq_file
*
seq
,
struct
ip6_flowlabel
*
fl
)
{
while
(
fl
)
{
seq_printf
(
seq
,
"%05X %-1d %-6d %-6d %-6d %-8ld "
"%02x%02x%02x%02x%02x%02x%02x%02x "
"%-4d
\n
"
,
(
unsigned
)
ntohl
(
fl
->
label
),
fl
->
share
,
(
unsigned
)
fl
->
owner
,
atomic_read
(
&
fl
->
users
),
fl
->
linger
/
HZ
,
(
long
)(
fl
->
expires
-
jiffies
)
/
HZ
,
NIP6
(
fl
->
dst
),
fl
->
opt
?
fl
->
opt
->
opt_nflen
:
0
);
fl
=
fl
->
next
;
}
}
static
int
ip6fl_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
if
(
v
==
(
void
*
)
1
)
seq_printf
(
seq
,
"Label S Owner Users Linger Expires "
"Dst Opt
\n
"
);
else
ip6fl_fl_seq_show
(
seq
,
v
);
return
0
;
}
static
struct
seq_operations
ip6fl_seq_ops
=
{
.
start
=
ip6fl_seq_start
,
.
next
=
ip6fl_seq_next
,
.
stop
=
ip6fl_seq_stop
,
.
show
=
ip6fl_seq_show
,
};
static
int
ip6fl_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
ip6fl_seq_ops
);
}
static
struct
file_operations
ip6fl_seq_fops
=
{
.
owner
=
THIS_MODULE
,
.
open
=
ip6fl_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
#endif
void
ip6_flowlabel_init
()
{
#ifdef CONFIG_PROC_FS
struct
proc_dir_entry
*
p
;
#endif
init_timer
(
&
ip6_fl_gc_timer
);
ip6_fl_gc_timer
.
function
=
ip6_fl_gc
;
#ifdef CONFIG_PROC_FS
create_proc_read_entry
(
"net/ip6_flowlabel"
,
0
,
0
,
ip6_fl_read_proc
,
NULL
);
p
=
create_proc_entry
(
"ip6_flowlabel"
,
S_IRUGO
,
proc_net
);
if
(
p
)
p
->
proc_fops
=
&
ip6fl_seq_fops
;
#endif
}
...
...
@@ -621,6 +688,6 @@ void ip6_flowlabel_cleanup()
{
del_timer
(
&
ip6_fl_gc_timer
);
#ifdef CONFIG_PROC_FS
remove_proc_entry
(
"net/ip6_flowlabel"
,
0
);
proc_net_remove
(
"ip6_flowlabel"
);
#endif
}
net/ipv6/ip6_output.c
View file @
3b11b57a
...
...
@@ -984,7 +984,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
ipv6_select_ident
(
skb
,
fh
);
fh
->
nexthdr
=
nexthdr
;
fh
->
reserved
=
0
;
fh
->
frag_off
=
htons
(
0x0001
);
fh
->
frag_off
=
htons
(
IP6_MF
);
frag_id
=
fh
->
identification
;
first_len
=
skb_pagelen
(
skb
);
...
...
@@ -1004,9 +1004,9 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
offset
+=
skb
->
len
-
hlen
-
sizeof
(
struct
frag_hdr
);
fh
->
nexthdr
=
nexthdr
;
fh
->
reserved
=
0
;
if
(
frag
->
next
!=
NULL
)
offset
|=
0x0001
;
fh
->
frag_off
=
htons
(
offset
);
if
(
frag
->
next
!=
NULL
)
fh
->
frag_off
|=
htons
(
IP6_MF
);
fh
->
identification
=
frag_id
;
frag
->
nh
.
ipv6h
->
payload_len
=
htons
(
frag
->
len
-
sizeof
(
struct
ipv6hdr
));
ip6_copy_metadata
(
frag
,
skb
);
...
...
@@ -1113,7 +1113,9 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
BUG
();
left
-=
len
;
fh
->
frag_off
=
htons
(
left
>
0
?
(
offset
|
0x0001
)
:
offset
);
fh
->
frag_off
=
htons
(
offset
);
if
(
left
>
0
)
fh
->
frag_off
|=
htons
(
IP6_MF
);
frag
->
nh
.
ipv6h
->
payload_len
=
htons
(
frag
->
len
-
sizeof
(
struct
ipv6hdr
));
ptr
+=
len
;
...
...
net/ipv6/reassembly.c
View file @
3b11b57a
...
...
@@ -435,7 +435,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
csum_partial
(
skb
->
nh
.
raw
,
(
u8
*
)(
fhdr
+
1
)
-
skb
->
nh
.
raw
,
0
));
/* Is this the final fragment? */
if
(
!
(
fhdr
->
frag_off
&
htons
(
0x0001
)))
{
if
(
!
(
fhdr
->
frag_off
&
htons
(
IP6_MF
)))
{
/* If we already have some bits beyond end
* or have different end, the segment is corrupted.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment