Skip to content

Commit

Permalink
ipv6: fix the check when handle RA
Browse files Browse the repository at this point in the history
d933319(ipv6:  Allow accepting RA from local IP addresses.) made the wrong
check, whether or not to accept RA with source-addr found on local machine, when
accept_ra_from_local is 0.

Fixes: d933319(ipv6:  Allow accepting RA from local IP addresses.)
Cc: Ben Greear <[email protected]>
Cc: Hannes Frederic Sowa <[email protected]>
Signed-off-by: Li RongQing <[email protected]>
Acked-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Li RongQing authored and davem330 committed Jul 10, 2014
1 parent ff32045 commit b642881
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions net/ipv6/ndisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,9 +1151,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
/* Do not accept RA with source-addr found on local machine unless
* accept_ra_from_local is set to true.
*/
if (!(in6_dev->cnf.accept_ra_from_local ||
ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
NULL, 0))) {
if (!in6_dev->cnf.accept_ra_from_local &&
ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
NULL, 0)) {
ND_PRINTK(2, info,
"RA from local address detected on dev: %s: default router ignored\n",
skb->dev->name);
Expand Down Expand Up @@ -1294,9 +1294,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
}

#ifdef CONFIG_IPV6_ROUTE_INFO
if (!(in6_dev->cnf.accept_ra_from_local ||
ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
NULL, 0))) {
if (!in6_dev->cnf.accept_ra_from_local &&
ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
NULL, 0)) {
ND_PRINTK(2, info,
"RA from local address detected on dev: %s: router info ignored.\n",
skb->dev->name);
Expand Down

0 comments on commit b642881

Please sign in to comment.