diff options
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r-- | net/ipv6/ndisc.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 0e0d6ce69021..ddf038636f01 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -736,8 +736,10 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
736 | struct inet6_ifaddr *ifp; | 736 | struct inet6_ifaddr *ifp; |
737 | struct inet6_dev *idev = NULL; | 737 | struct inet6_dev *idev = NULL; |
738 | struct neighbour *neigh; | 738 | struct neighbour *neigh; |
739 | struct pneigh_entry *pneigh = NULL; | ||
739 | int dad = ipv6_addr_any(saddr); | 740 | int dad = ipv6_addr_any(saddr); |
740 | int inc; | 741 | int inc; |
742 | int is_router; | ||
741 | 743 | ||
742 | if (ipv6_addr_is_multicast(&msg->target)) { | 744 | if (ipv6_addr_is_multicast(&msg->target)) { |
743 | ND_PRINTK2(KERN_WARNING | 745 | ND_PRINTK2(KERN_WARNING |
@@ -822,7 +824,8 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
822 | 824 | ||
823 | if (ipv6_chk_acast_addr(dev, &msg->target) || | 825 | if (ipv6_chk_acast_addr(dev, &msg->target) || |
824 | (idev->cnf.forwarding && | 826 | (idev->cnf.forwarding && |
825 | pneigh_lookup(&nd_tbl, &msg->target, dev, 0))) { | 827 | (pneigh = pneigh_lookup(&nd_tbl, |
828 | &msg->target, dev, 0)) != NULL)) { | ||
826 | if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && | 829 | if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && |
827 | skb->pkt_type != PACKET_HOST && | 830 | skb->pkt_type != PACKET_HOST && |
828 | inc != 0 && | 831 | inc != 0 && |
@@ -843,12 +846,17 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
843 | goto out; | 846 | goto out; |
844 | } | 847 | } |
845 | 848 | ||
849 | if (pneigh) | ||
850 | is_router = pneigh->flags & NTF_ROUTER; | ||
851 | else | ||
852 | is_router = idev->cnf.forwarding; | ||
853 | |||
846 | if (dad) { | 854 | if (dad) { |
847 | struct in6_addr maddr; | 855 | struct in6_addr maddr; |
848 | 856 | ||
849 | ipv6_addr_all_nodes(&maddr); | 857 | ipv6_addr_all_nodes(&maddr); |
850 | ndisc_send_na(dev, NULL, &maddr, &msg->target, | 858 | ndisc_send_na(dev, NULL, &maddr, &msg->target, |
851 | idev->cnf.forwarding, 0, (ifp != NULL), 1); | 859 | is_router, 0, (ifp != NULL), 1); |
852 | goto out; | 860 | goto out; |
853 | } | 861 | } |
854 | 862 | ||
@@ -869,7 +877,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
869 | NEIGH_UPDATE_F_OVERRIDE); | 877 | NEIGH_UPDATE_F_OVERRIDE); |
870 | if (neigh || !dev->hard_header) { | 878 | if (neigh || !dev->hard_header) { |
871 | ndisc_send_na(dev, neigh, saddr, &msg->target, | 879 | ndisc_send_na(dev, neigh, saddr, &msg->target, |
872 | idev->cnf.forwarding, | 880 | is_router, |
873 | 1, (ifp != NULL && inc), inc); | 881 | 1, (ifp != NULL && inc), inc); |
874 | if (neigh) | 882 | if (neigh) |
875 | neigh_release(neigh); | 883 | neigh_release(neigh); |