]> git.pld-linux.org Git - packages/kernel.git/blob - linux-ipv6-glibc2.2.patch
set sin6_scope_id to zero -- avoid displaing garbage by getnameinfo()
[packages/kernel.git] / linux-ipv6-glibc2.2.patch
1 ;
2 ; This is simple hack to get 2.2.x kernel working with
3 ; glibc 2.1.x AND glibc 2.2 library (changes in struct sockaddr_in6).
4 ;               Arkadiusz Miskiewicz <misiek@pld.org.pl>, PLD GNU/Linux
5 ;
6 ; Note: I'm not kernel hacker ! You have been warned.
7 diff -urN linux-2.2.x.org/include/linux/in6.h linux-2.2.x/include/linux/in6.h
8 --- linux-2.2.x.org/include/linux/in6.h Tue Nov 21 16:02:16 2000
9 +++ linux-2.2.x/include/linux/in6.h     Tue Nov 21 16:02:35 2000
10 @@ -56,6 +56,7 @@
11         __u16                   sin6_port;      /* Transport layer port # */
12         __u32                   sin6_flowinfo;  /* IPv6 flow information */
13         struct in6_addr         sin6_addr;      /* IPv6 address */
14 +       __u32                   sin6_scope_id;  /* scope id (new in RFC2553) */
15  };
16  
17  
18 diff -urN linux-2.2.x.org/include/net/ipv6.h linux-2.2.x/include/net/ipv6.h
19 --- linux-2.2.x.org/include/net/ipv6.h  Tue Nov 21 16:02:17 2000
20 +++ linux-2.2.x/include/net/ipv6.h      Tue Nov 21 16:02:35 2000
21 @@ -20,6 +20,8 @@
22  #include <net/ndisc.h>
23  #include <net/flow.h>
24  
25 +#define        SIN6_LEN_RFC2133        24
26 +
27  /*
28   *     NextHeader field of IPv6 header
29   */
30 diff -urN linux-2.2.x.org/net/ipv6/af_inet6.c linux-2.2.x/net/ipv6/af_inet6.c
31 --- linux-2.2.x.org/net/ipv6/af_inet6.c Tue Nov 21 16:02:18 2000
32 +++ linux-2.2.x/net/ipv6/af_inet6.c     Tue Nov 21 16:04:00 2000
33 @@ -199,7 +199,7 @@
34                 
35         /* Check these errors (active socket, bad address length, double bind). */
36         if ((sk->state != TCP_CLOSE)                    ||
37 -           (addr_len < sizeof(struct sockaddr_in6))    ||
38 +           (addr_len < SIN6_LEN_RFC2133)               ||
39             (sk->num != 0))
40                 return -EINVAL;
41                 
42 @@ -313,6 +313,7 @@
43    
44         sin->sin6_family = AF_INET6;
45         sin->sin6_flowinfo = 0;
46 +       sin->sin6_scope_id = 0;
47         sk = sock->sk;
48         if (peer) {
49                 if (!tcp_connected(sk->state))
50 diff -urN linux-2.2.x.org/net/ipv6/datagram.c linux-2.2.x/net/ipv6/datagram.c
51 --- linux-2.2.x.org/net/ipv6/datagram.c Tue Nov 21 16:02:18 2000
52 +++ linux-2.2.x/net/ipv6/datagram.c     Tue Nov 21 16:05:29 2000
53 @@ -133,6 +133,7 @@
54         if (sin) {
55                 sin->sin6_family = AF_INET6;
56                 sin->sin6_flowinfo = 0;
57 +               sin->sin6_scope_id = 0;
58                 sin->sin6_port = serr->port; 
59                 if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) {
60                         memcpy(&sin->sin6_addr, skb->nh.raw + serr->addr_offset, 16);
61 @@ -150,6 +151,7 @@
62         if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) {
63                 sin->sin6_family = AF_INET6;
64                 sin->sin6_flowinfo = 0;
65 +               sin->sin6_scope_id = 0;
66                 if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) {
67                         memcpy(&sin->sin6_addr, &skb->nh.ipv6h->saddr, 16);
68                         if (sk->net_pinfo.af_inet6.rxopt.all)
69 diff -urN linux-2.2.x.org/net/ipv6/raw.c linux-2.2.x/net/ipv6/raw.c
70 --- linux-2.2.x.org/net/ipv6/raw.c      Tue Nov 21 16:02:18 2000
71 +++ linux-2.2.x/net/ipv6/raw.c  Tue Nov 21 16:08:12 2000
72 @@ -117,7 +117,7 @@
73         int addr_type;
74  
75         /* Check these errors. */
76 -       if (sk->state != TCP_CLOSE || (addr_len < sizeof(struct sockaddr_in6)))
77 +       if (sk->state != TCP_CLOSE || (addr_len < SIN6_LEN_RFC2133))
78                 return -EINVAL;
79  
80         addr_type = ipv6_addr_type(&addr->sin6_addr);
81 @@ -252,6 +252,7 @@
82                 memcpy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr, 
83                        sizeof(struct in6_addr));
84                 sin6->sin6_flowinfo = 0;
85 +               sin6->sin6_scope_id = 0;
86         }
87  
88         if (sk->net_pinfo.af_inet6.rxopt.all)
89 @@ -360,7 +361,7 @@
90         fl.fl6_flowlabel = 0;
91  
92         if (sin6) {
93 -               if (addr_len < sizeof(struct sockaddr_in6)) 
94 +               if (addr_len < SIN6_LEN_RFC2133) 
95                         return(-EINVAL);
96  
97                 if (sin6->sin6_family && sin6->sin6_family != AF_INET6) 
98 diff -urN linux-2.2.x.org/net/ipv6/tcp_ipv6.c linux-2.2.x/net/ipv6/tcp_ipv6.c
99 --- linux-2.2.x.org/net/ipv6/tcp_ipv6.c Tue Nov 21 16:02:18 2000
100 +++ linux-2.2.x/net/ipv6/tcp_ipv6.c     Tue Nov 21 16:08:44 2000
101 @@ -387,7 +387,7 @@
102         if(!ipv6_addr_any(&np->daddr))
103                 return -EINVAL;
104         
105 -       if (addr_len < sizeof(struct sockaddr_in6)) 
106 +       if (addr_len < SIN6_LEN_RFC2133) 
107                 return(-EINVAL);
108  
109         if (usin->sin6_family && usin->sin6_family != AF_INET6) 
110 @@ -1583,6 +1583,7 @@
111         sin6->sin6_port = sk->dport;
112         /* We do not store received flowlabel for TCP */
113         sin6->sin6_flowinfo = 0;
114 +       sin6->sin6_scope_id = 0;
115  }
116  
117  static struct tcp_func ipv6_specific = {
118 diff -urN linux-2.2.x.org/net/ipv6/udp.c linux-2.2.x/net/ipv6/udp.c
119 --- linux-2.2.x.org/net/ipv6/udp.c      Tue Nov 21 16:02:18 2000
120 +++ linux-2.2.x/net/ipv6/udp.c  Tue Nov 21 16:08:56 2000
121 @@ -210,7 +210,7 @@
122                 goto ipv4_connected;
123         }
124  
125 -       if (addr_len < sizeof(*usin)) 
126 +       if (addr_len < SIN6_LEN_RFC2133) 
127                 return(-EINVAL);
128  
129         if (usin->sin6_family && usin->sin6_family != AF_INET6) 
130 @@ -414,6 +414,7 @@
131                 sin6->sin6_family = AF_INET6;
132                 sin6->sin6_port = skb->h.uh->source;
133                 sin6->sin6_flowinfo = 0;
134 +               sin6->sin6_scope_id = 0;
135  
136                 if (skb->protocol == __constant_htons(ETH_P_IP)) {
137                         ipv6_addr_set(&sin6->sin6_addr, 0, 0,
138 @@ -777,7 +778,7 @@
139                 if (sin6->sin6_family == AF_INET)
140                         return udp_sendmsg(sk, msg, ulen);
141  
142 -               if (addr_len < sizeof(*sin6))
143 +               if (addr_len < SIN6_LEN_RFC2133)
144                         return(-EINVAL);
145  
146                 if (sin6->sin6_family && sin6->sin6_family != AF_INET6)
This page took 0.113237 seconds and 4 git commands to generate.