]> git.pld-linux.org Git - packages/SysVinit.git/blob - sysvinit-ipv6.patch
- does not require logrotate; rel 19
[packages/SysVinit.git] / sysvinit-ipv6.patch
1 diff -Naur sysvinit-2.86/src/last.c sysvinit-2.86-ipv6/src/last.c
2 --- sysvinit-2.86/src/last.c    2004-07-30 14:16:26.000000000 +0200
3 +++ sysvinit-2.86-ipv6/src/last.c       2006-07-19 16:14:24.000000000 +0200
4 @@ -307,14 +307,15 @@
5         struct sockaddr         *sa;
6         int                     salen, flags;
7         unsigned int            topnibble;
8 +       unsigned int            azero = 0, sitelocal = 0;
9         int                     mapped = 0;
10  
11         flags = useip ? NI_NUMERICHOST : 0;
12  
13         /*
14          *      IPv4 or IPv6 ? We use 2 heuristics:
15 -        *      1. Current IPv6 range uses 2000-3fff. Outside of
16 -        *         that is illegal and must be IPv4.
17 +        *      1. Current IPv6 range uses 2000-3fff or fec0-feff.
18 +        *         Outside of that is illegal and must be IPv4.
19          *      2. If last 3 bytes are 0, must be IPv4
20          *      3. If IPv6 in IPv4, handle as IPv4
21          *
22 @@ -323,7 +324,11 @@
23         if (a[0] == 0 && a[1] == 0 && a[2] == htonl (0xffff))
24                 mapped = 1;
25         topnibble = ntohl((unsigned int)a[0]) >> 28;
26 -       if (topnibble < 2 || topnibble > 3 || mapped ||
27 +
28 +       azero = ntohl((unsigned int)a[0]) >> 16;
29 +       sitelocal = (azero >= 0xfec0 && azero <= 0xfeff) ? 1 : 0;
30 +       
31 +       if (((topnibble < 2 || topnibble > 3) && (!sitelocal)) || mapped ||
32             (a[1] == 0 && a[2] == 0 && a[3] == 0)) {
33                 /* IPv4 */
34                 sin.sin_family = AF_INET;
This page took 0.05748 seconds and 3 git commands to generate.