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
nexedi
linux
Commits
de0b4832
Commit
de0b4832
authored
Oct 27, 2004
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV6] NDISC: update neighbor cache entry by RS.
Signed-off-by:
Hideaki YOSHIFUJI
<
yoshfuji@linux-ipv6.org
>
parent
8101cd57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
include/net/ndisc.h
include/net/ndisc.h
+5
-0
net/ipv6/ndisc.c
net/ipv6/ndisc.c
+62
-0
No files found.
include/net/ndisc.h
View file @
de0b4832
...
...
@@ -45,6 +45,11 @@ struct nd_msg {
__u8
opt
[
0
];
};
struct
rs_msg
{
struct
icmp6hdr
icmph
;
__u8
opt
[
0
];
};
struct
ra_msg
{
struct
icmp6hdr
icmph
;
__u32
reachable_time
;
...
...
net/ipv6/ndisc.c
View file @
de0b4832
...
...
@@ -921,6 +921,64 @@ static void ndisc_recv_na(struct sk_buff *skb)
}
}
static
void
ndisc_recv_rs
(
struct
sk_buff
*
skb
)
{
struct
rs_msg
*
rs_msg
=
(
struct
rs_msg
*
)
skb
->
h
.
raw
;
unsigned
long
ndoptlen
=
skb
->
len
-
sizeof
(
*
rs_msg
);
struct
neighbour
*
neigh
;
struct
inet6_dev
*
idev
;
struct
in6_addr
*
saddr
=
&
skb
->
nh
.
ipv6h
->
saddr
;
struct
ndisc_options
ndopts
;
u8
*
lladdr
=
NULL
;
int
lladdrlen
=
0
;
if
(
skb
->
len
<
sizeof
(
*
rs_msg
))
return
;
idev
=
in6_dev_get
(
skb
->
dev
);
if
(
!
idev
)
{
if
(
net_ratelimit
())
ND_PRINTK1
(
"ICMP6 RS: can't find in6 device
\n
"
);
return
;
}
/* Don't accept RS if we're not in router mode */
if
(
!
idev
->
cnf
.
forwarding
||
idev
->
cnf
.
accept_ra
)
goto
out
;
/*
* Don't update NCE if src = ::;
* this implies that the source node has no ip address assigned yet.
*/
if
(
ipv6_addr_any
(
saddr
))
goto
out
;
/* Parse ND options */
if
(
!
ndisc_parse_options
(
rs_msg
->
opt
,
ndoptlen
,
&
ndopts
))
{
if
(
net_ratelimit
())
ND_PRINTK2
(
"ICMP6 NS: invalid ND option, ignored
\n
"
);
goto
out
;
}
if
(
ndopts
.
nd_opts_src_lladdr
)
{
lladdr
=
(
u8
*
)(
ndopts
.
nd_opts_src_lladdr
+
1
);
lladdrlen
=
ndopts
.
nd_opts_src_lladdr
->
nd_opt_len
<<
3
;
if
(
lladdrlen
!=
NDISC_OPT_SPACE
(
skb
->
dev
->
addr_len
))
goto
out
;
}
neigh
=
__neigh_lookup
(
&
nd_tbl
,
saddr
,
skb
->
dev
,
1
);
if
(
neigh
)
{
neigh_update
(
neigh
,
lladdr
,
NUD_STALE
,
NEIGH_UPDATE_F_WEAK_OVERRIDE
|
NEIGH_UPDATE_F_OVERRIDE
|
NEIGH_UPDATE_F_OVERRIDE_ISROUTER
);
neigh_release
(
neigh
);
}
out:
in6_dev_put
(
idev
);
}
static
void
ndisc_router_discovery
(
struct
sk_buff
*
skb
)
{
struct
ra_msg
*
ra_msg
=
(
struct
ra_msg
*
)
skb
->
h
.
raw
;
...
...
@@ -1395,6 +1453,10 @@ int ndisc_rcv(struct sk_buff *skb)
ndisc_recv_na
(
skb
);
break
;
case
NDISC_ROUTER_SOLICITATION
:
ndisc_recv_rs
(
skb
);
break
;
case
NDISC_ROUTER_ADVERTISEMENT
:
ndisc_router_discovery
(
skb
);
break
;
...
...
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