[PATCH for 2.2.4-test1] IPv6 cannot bind|connect to link local address without scope_id

From: Fumitoshi UKAI (ukai@debian.or.jp)
Date: Fri May 26 2000 - 07:13:47 EST


Hi,

2.2.4-test1 will fail to bind or connect to IPv6 link local address
if sin6_scope_id is not supplied. For example, ping6 to IPv6 link local
address will fail because of "connect: Invalid argument."

This patch fixes this problem.
Or should we initialize sk->bound_dev_if when socket is created?

diff -u x/linux/net/ipv6/af_inet6.c linux-2.4.0-test1/net/ipv6/af_inet6.c
--- x/linux/net/ipv6/af_inet6.c Thu Apr 27 04:13:17 2000
+++ linux-2.4.0-test1/net/ipv6/af_inet6.c Fri May 26 19:49:49 2000
@@ -267,12 +267,12 @@
                          * is supplied by user.
                          */
                         sk->bound_dev_if = addr->sin6_scope_id;
- }
 
- /* Binding to link-local address requires an interface */
- if (sk->bound_dev_if == 0) {
- release_sock(sk);
- return -EINVAL;
+ /* Binding to link-local address requires an interface */
+ if (sk->bound_dev_if == 0) {
+ release_sock(sk);
+ return -EINVAL;
+ }
                 }
         }
 
Common subdirectories: x/linux/net/ipv6/netfilter and linux-2.4.0-test1/net/ipv6/netfilter
diff -u x/linux/net/ipv6/raw.c linux-2.4.0-test1/net/ipv6/raw.c
--- x/linux/net/ipv6/raw.c Wed May 3 17:48:04 2000
+++ linux-2.4.0-test1/net/ipv6/raw.c Fri May 26 19:45:19 2000
@@ -207,11 +207,11 @@
                          * is supplied by user.
                          */
                         sk->bound_dev_if = addr->sin6_scope_id;
- }
 
- /* Binding to link-local address requires an interface */
- if (sk->bound_dev_if == 0)
- goto out;
+ /* Binding to link-local address requires an interface */
+ if (sk->bound_dev_if == 0)
+ goto out;
+ }
         }
 
         /* Check if the address belongs to the host. */
diff -u x/linux/net/ipv6/tcp_ipv6.c linux-2.4.0-test1/net/ipv6/tcp_ipv6.c
--- x/linux/net/ipv6/tcp_ipv6.c Wed May 3 17:48:04 2000
+++ linux-2.4.0-test1/net/ipv6/tcp_ipv6.c Fri May 26 19:47:06 2000
@@ -559,11 +559,11 @@
                                 return -EINVAL;
 
                         sk->bound_dev_if = usin->sin6_scope_id;
- }
 
- /* Connect to link-local address requires an interface */
- if (sk->bound_dev_if == 0)
- return -EINVAL;
+ /* Connect to link-local address requires an interface */
+ if (sk->bound_dev_if == 0)
+ return -EINVAL;
+ }
         }
 
         if (tp->ts_recent_stamp && ipv6_addr_cmp(&np->daddr, &usin->sin6_addr)) {
diff -u x/linux/net/ipv6/udp.c linux-2.4.0-test1/net/ipv6/udp.c
--- x/linux/net/ipv6/udp.c Wed May 3 17:48:04 2000
+++ linux-2.4.0-test1/net/ipv6/udp.c Fri May 26 19:46:25 2000
@@ -289,11 +289,11 @@
                                 return -EINVAL;
                         }
                         sk->bound_dev_if = usin->sin6_scope_id;
- }
 
- /* Connect to link-local address requires an interface */
- if (sk->bound_dev_if == 0)
- return -EINVAL;
+ /* Connect to link-local address requires an interface */
+ if (sk->bound_dev_if == 0)
+ return -EINVAL;
+ }
         }
 
         ipv6_addr_copy(&np->daddr, daddr);

Thanks,
Fumitoshi UKAI

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:15 EST