Skip to content

Commit

Permalink
ipv6: Update Neighbor Cache when IPv6 RA is received on a router
Browse files Browse the repository at this point in the history
When processing a received IPv6 Router Advertisement, the kernel
creates or updates an IPv6 Neighbor Cache entry for the sender --
but presently this does not occur if IPv6 forwarding is enabled
(net.ipv6.conf.*.forwarding = 1), or if IPv6 Router Advertisements
are not accepted (net.ipv6.conf.*.accept_ra = 0), because in these
cases processing of the Router Advertisement has already halted.

This patch allows the Neighbor Cache to be updated in these cases,
while still avoiding any modification to routes or link parameters.

This continues to satisfy RFC 4861, since any entry created in the
Neighbor Cache as the result of a received Router Advertisement is
still placed in the STALE state.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Ward authored and David S. Miller committed Aug 29, 2009
1 parent 078b073 commit 31ce8c7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions net/ipv6/ndisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,10 +1151,6 @@ static void ndisc_router_discovery(struct sk_buff *skb)
skb->dev->name);
return;
}
if (in6_dev->cnf.forwarding || !in6_dev->cnf.accept_ra) {
in6_dev_put(in6_dev);
return;
}

if (!ndisc_parse_options(opt, optlen, &ndopts)) {
in6_dev_put(in6_dev);
Expand All @@ -1163,6 +1159,10 @@ static void ndisc_router_discovery(struct sk_buff *skb)
return;
}

/* skip route and link configuration on routers */
if (in6_dev->cnf.forwarding || !in6_dev->cnf.accept_ra)
goto skip_linkparms;

#ifdef CONFIG_IPV6_NDISC_NODETYPE
/* skip link-specific parameters from interior routers */
if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT)
Expand Down Expand Up @@ -1283,9 +1283,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
}
}

#ifdef CONFIG_IPV6_NDISC_NODETYPE
skip_linkparms:
#endif

/*
* Process options.
Expand All @@ -1312,6 +1310,10 @@ static void ndisc_router_discovery(struct sk_buff *skb)
NEIGH_UPDATE_F_ISROUTER);
}

/* skip route and link configuration on routers */
if (in6_dev->cnf.forwarding || !in6_dev->cnf.accept_ra)
goto out;

#ifdef CONFIG_IPV6_ROUTE_INFO
if (in6_dev->cnf.accept_ra_rtr_pref && ndopts.nd_opts_ri) {
struct nd_opt_hdr *p;
Expand Down

0 comments on commit 31ce8c7

Please sign in to comment.