apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49678] getRemoteAddr() returns IPv6 address on RedHat 9 when IPv6 is disabled
Date Mon, 02 Aug 2010 14:55:49 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=49678

--- Comment #5 from Lalit Mishra <lalit.mishra@airtightnetworks.com> 2010-08-02 10:55:45
EDT ---
(In reply to comment #4)

> What do you mean precisely by having "IPv6 disabled"?

It means that "ipv6" modules has not been loaded, though kernel was compiled
with IPv6 support enabled. No IPv6 addresses are assigned on any network
interfaces.

> Are you saying there is a kernel bug here which needs to be worked around?

Different results are obtained on same kernel with different glibc version.
RH9 uses 2.3.2 - gives wrong result
CentOS 5.2 uses 2.5-24 - gives correct result

> Maybe you could give a minimal example of code needed to reproduce this with
> APR, the output of running that code, and the output from running it under
> strace (or similar).

Consider following code :

#include "apr.h"
#include "apr_pools.h"
#include "apr_network_io.h"
#include "apr_strings.h"
#include "apr_mmap.h"
#include "stdio.h"

int main() {
        apr_pool_t *pool = NULL;
        apr_sockaddr_t *sa, *sl;
        apr_int32_t f = 0;

        apr_initialize();
        apr_pool_create(&pool, NULL);

        apr_sockaddr_info_get(&sa, NULL, AF_UNSPEC, 0, f, pool);

        sl = sa;

        while(sl) {
                char addrStr[100];

                memset(addrStr, '\0', 100);

                apr_sockaddr_ip_getbuf(addrStr, 99, sl);
                printf("%s\n", addrStr);

                sl = sl->next;
        }
}

Now let's consider output on two machines

CentOS Machine (with IPv6 disabled)
===================================

ifconfig 
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:192.168.8.215  Bcast:192.168.11.255  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1146747 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28212 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:72940682 (69.5 MiB)  TX bytes:30817941 (29.3 MiB)
          Memory:d0200000-d0220000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4557 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4557 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1540826 (1.4 MiB)  TX bytes:1540826 (1.4 MiB)

./getLocalAddr 
0.0.0.0

RH9 Machine (with IPv6 disabled)
==============================

ifconfig 
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:192.168.8.97  Bcast:192.168.11.255  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:27661 errors:0 dropped:0 overruns:0 frame:0
          TX packets:760 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1848721 (1.7 Mb)  TX bytes:154774 (151.1 Kb)
          Base address:0x2000 Memory:48180000-481a0000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4553 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4553 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1045939 (1021.4 Kb)  TX bytes:1045939 (1021.4 Kb)

./getLocalAddr 
::
0.0.0.0

Note that on RH9 "::" address (sl->family == AF_INET6) was returned. This makes
APR believe that IPv6 is enabled. On CentOS presence of AI_ADDRCONFIG prevents
"::" from appearing here.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message