[INFO]: Kernel 2.2.x, glibce 2.2, getnameinfo()
Arkadiusz Miskiewicz
misiek w pld.org.pl
Pią, 17 Lis 2000, 17:57:25 CET
On/Dnia Fri, Nov 17, 2000 at 06:46:52PM +0100, Jan Rekorajski wrote/napisał(a)
> > Zapatchowane jajko + glibce 2.1.x == nie działa.
^^^^^^^^^^ tu oczywiście o v6 chodziło
> To dlaczego glibc 2.1.x działa na kernelu 2.4?
w jaju 2.2 jest tak:
if (addr_len < sizeof(struct sockaddr_in6))
return -EINVAL;
w jaju 2.4 jest tak:
if (addr_len < SIN6_LEN_RFC2133)
return -EINVAL;
przy czym: SIN6_LEN_RFC2133==24, a to jest wielkość sockaddr_in6 bez pola
sin6_scope_id czyli przepuści zarówno stare jak i nowe sockaddr_in6.
Tak więc nowy patch, który spowoduje, że ipv6 && jajo 2.2.x będzie działało
prawidło zarówno z glibcami 2.1 jak i 2.2.
diff -urN linux-2.2.x.org/include/linux/in6.h linux-2.2.x/include/linux/in6.h
--- linux-2.2.x.org/include/linux/in6.h Fri Nov 17 18:21:58 2000
+++ linux-2.2.x/include/linux/in6.h Fri Nov 17 18:22:26 2000
@@ -56,6 +56,7 @@
__u16 sin6_port; /* Transport layer port # */
__u32 sin6_flowinfo; /* IPv6 flow information */
struct in6_addr sin6_addr; /* IPv6 address */
+ __u32 sin6_scope_id; /* scope id (new in RFC2553) */
};
diff -urN linux-2.2.x.org/include/net/ipv6.h linux-2.2.x/include/net/ipv6.h
--- linux-2.2.x.org/include/net/ipv6.h Tue May 11 19:36:50 1999
+++ linux-2.2.x/include/net/ipv6.h Fri Nov 17 18:55:27 2000
@@ -20,6 +20,8 @@
#include <net/ndisc.h>
#include <net/flow.h>
+#define SIN6_LEN_RFC2133 24
+
/*
* NextHeader field of IPv6 header
*/
diff -urN linux-2.2.x.org/net/ipv6/af_inet6.c linux-2.2.x/net/ipv6/af_inet6.c
--- linux-2.2.x.org/net/ipv6/af_inet6.c Thu May 4 02:16:53 2000
+++ linux-2.2.x/net/ipv6/af_inet6.c Fri Nov 17 18:56:34 2000
@@ -199,7 +199,7 @@
/* Check these errors (active socket, bad address length, double bind). */
if ((sk->state != TCP_CLOSE) ||
- (addr_len < sizeof(struct sockaddr_in6)) ||
+ (addr_len < SIN6_LEN_RFC2133) ||
(sk->num != 0))
return -EINVAL;
diff -urN linux-2.2.x.org/net/ipv6/raw.c linux-2.2.x/net/ipv6/raw.c
--- linux-2.2.x.org/net/ipv6/raw.c Mon Aug 9 21:04:41 1999
+++ linux-2.2.x/net/ipv6/raw.c Fri Nov 17 18:57:01 2000
@@ -117,7 +117,7 @@
int addr_type;
/* Check these errors. */
- if (sk->state != TCP_CLOSE || (addr_len < sizeof(struct sockaddr_in6)))
+ if (sk->state != TCP_CLOSE || (addr_len < SIN6_LEN_RFC2133))
return -EINVAL;
addr_type = ipv6_addr_type(&addr->sin6_addr);
@@ -360,7 +360,7 @@
fl.fl6_flowlabel = 0;
if (sin6) {
- if (addr_len < sizeof(struct sockaddr_in6))
+ if (addr_len < SIN6_LEN_RFC2133)
return(-EINVAL);
if (sin6->sin6_family && sin6->sin6_family != AF_INET6)
diff -urN linux-2.2.x.org/net/ipv6/tcp_ipv6.c linux-2.2.x/net/ipv6/tcp_ipv6.c
--- linux-2.2.x.org/net/ipv6/tcp_ipv6.c Thu May 4 02:16:53 2000
+++ linux-2.2.x/net/ipv6/tcp_ipv6.c Fri Nov 17 18:57:12 2000
@@ -387,7 +387,7 @@
if(!ipv6_addr_any(&np->daddr))
return -EINVAL;
- if (addr_len < sizeof(struct sockaddr_in6))
+ if (addr_len < SIN6_LEN_RFC2133)
return(-EINVAL);
if (usin->sin6_family && usin->sin6_family != AF_INET6)
diff -urN linux-2.2.x.org/net/ipv6/udp.c linux-2.2.x/net/ipv6/udp.c
--- linux-2.2.x.org/net/ipv6/udp.c Mon Aug 9 21:04:41 1999
+++ linux-2.2.x/net/ipv6/udp.c Fri Nov 17 18:58:13 2000
@@ -210,7 +210,7 @@
goto ipv4_connected;
}
- if (addr_len < sizeof(*usin))
+ if (addr_len < SIN6_LEN_RFC2133)
return(-EINVAL);
if (usin->sin6_family && usin->sin6_family != AF_INET6)
@@ -777,7 +777,7 @@
if (sin6->sin6_family == AF_INET)
return udp_sendmsg(sk, msg, ulen);
- if (addr_len < sizeof(*sin6))
+ if (addr_len < SIN6_LEN_RFC2133)
return(-EINVAL);
if (sin6->sin6_family && sin6->sin6_family != AF_INET6)
> Janek
--
Arkadiusz Miśkiewicz, AM2-6BONE [ PLD GNU/Linux IPv6 ]
http://www.t17.ds.pwr.wroc.pl/~misiek/ipv6/ [ enabled ]
Więcej informacji o liście dyskusyjnej pld-devel-pl