[IPV6] NDISC: Fix is_router flag setting.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Fri, 22 Sep 2006 21:44:53 +0000 (14:44 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Sep 2006 22:20:27 +0000 (15:20 -0700)
We did not send appropriate IsRouter flag if the forwarding setting is
positive even value.  Let's give 1/0 value to ndisc_send_na().

Also, existing users of ndisc_send_na() give 0/1 to override,
we can omit redundant operation in that function.

Bug hinted by Nicolas Dichtel <nicolas.dichtel@6wind.com>.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ndisc.c

index 76517a5f65767b9925ba23710186bbd3306333ed..0304b5fe8d6aa01d77378d4ff939e8f5f04c1d4f 100644 (file)
@@ -496,7 +496,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
         msg->icmph.icmp6_unused = 0;
         msg->icmph.icmp6_router    = router;
         msg->icmph.icmp6_solicited = solicited;
-        msg->icmph.icmp6_override  = !!override;
+        msg->icmph.icmp6_override  = override;
 
         /* Set the target address. */
        ipv6_addr_copy(&msg->target, solicited_addr);
@@ -847,10 +847,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
                        goto out;
        }
 
-       if (pneigh)
-               is_router = pneigh->flags & NTF_ROUTER;
-       else
-               is_router = idev->cnf.forwarding;
+       is_router = !!(pneigh ? pneigh->flags & NTF_ROUTER : idev->cnf.forwarding);
 
        if (dad) {
                struct in6_addr maddr;