Skip to content

Commit b642881

Browse files
Li RongQingdavem330
authored andcommitted
ipv6: fix the check when handle RA
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 <greearb@candelatech.com> Cc: Hannes Frederic Sowa <hannes@redhat.com> Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ff32045 commit b642881

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

net/ipv6/ndisc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,9 +1151,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
11511151
/* Do not accept RA with source-addr found on local machine unless
11521152
* accept_ra_from_local is set to true.
11531153
*/
1154-
if (!(in6_dev->cnf.accept_ra_from_local ||
1155-
ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
1156-
NULL, 0))) {
1154+
if (!in6_dev->cnf.accept_ra_from_local &&
1155+
ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
1156+
NULL, 0)) {
11571157
ND_PRINTK(2, info,
11581158
"RA from local address detected on dev: %s: default router ignored\n",
11591159
skb->dev->name);
@@ -1294,9 +1294,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
12941294
}
12951295

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

0 commit comments

Comments
 (0)