ChangeSet 1.2181.41.4, 2005/03/30 16:35:08-08:00, [EMAIL PROTECTED]

        [IPV6]: Fix address/interface handling according to the scoping 
architecture
        
        I think this has been there for long time (maybe since 2.4...).
        
        With the following patch, I can connect local link-local address.
        - Change incoming interface according to the scoping architecture
        - Choose source address on appropriate interface, according to the
          scoping architecture.
        
        Signed-off-by: Hideaki YOSHIFUJI <[EMAIL PROTECTED]>
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: David S. Miller <[EMAIL PROTECTED]>



 addrconf.c  |    2 +-
 ip6_input.c |   14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)


diff -Nru a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
--- a/net/ipv6/addrconf.c       2005-03-30 20:07:04 -08:00
+++ b/net/ipv6/addrconf.c       2005-03-30 20:07:04 -08:00
@@ -942,7 +942,7 @@
 int ipv6_get_saddr(struct dst_entry *dst,
                   struct in6_addr *daddr, struct in6_addr *saddr)
 {
-       return ipv6_dev_get_saddr(dst ? dst->dev : NULL, daddr, saddr);
+       return ipv6_dev_get_saddr(dst ? ((struct rt6_info 
*)dst)->rt6i_idev->dev : NULL, daddr, saddr);
 }
 
 
diff -Nru a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
--- a/net/ipv6/ip6_input.c      2005-03-30 20:07:04 -08:00
+++ b/net/ipv6/ip6_input.c      2005-03-30 20:07:04 -08:00
@@ -71,10 +71,18 @@
                goto out;
        }
 
-       /* Store incoming device index. When the packet will
-          be queued, we cannot refer to skb->dev anymore.
+       /*
+        * Store incoming device index. When the packet will
+        * be queued, we cannot refer to skb->dev anymore.
+        *
+        * BTW, when we send a packet for our own local address on a
+        * non-loopback interface (e.g. ethX), it is being delivered
+        * via the loopback interface (lo) here; skb->dev = &loopback_dev.
+        * It, however, should be considered as if it is being
+        * arrived via the sending interface (ethX), because of the
+        * nature of scoping architecture. --yoshfuji
         */
-       IP6CB(skb)->iif = dev->ifindex;
+       IP6CB(skb)->iif = skb->dst ? ((struct rt6_info 
*)skb->dst)->rt6i_idev->dev->ifindex : dev->ifindex;
 
        if (skb->len < sizeof(struct ipv6hdr))
                goto err;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to