Bug 697669 - FQDN set to nsslapd-listenhost makes the server start fail if IPv4-mapped-IPv6 address is given
Summary: FQDN set to nsslapd-listenhost makes the server start fail if IPv4-mapped-IPv...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Directory Server
Version: 1.2.8
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks: 690319
TreeView+ depends on / blocked
 
Reported: 2011-04-18 21:23 UTC by Noriko Hosoi
Modified: 2015-12-10 18:43 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-10 18:43:56 UTC
Embargoed:


Attachments (Terms of Use)

Description Noriko Hosoi 2011-04-18 21:23:39 UTC
Description of problem:
Setting FQDN to nsslapd-listenhost, the server fails to start as follows.  It happens on my laptop, but not on my desktop.

    # /usr/lib/dirsrv/slapd-jiji/start-slapd -d 0
    [.] - 389-Directory/1.2.9.a1.git6d094d2 B2011.103.2056 starting up
    [.] - slapd started.  Listening on 2000::1:1234 port 10389 for LDAP requests
    [.] - Listening on 10.14.54.140 port 10389 for LDAP requests
    [.] - Listening on 10.14.54.140 port 10389 for LDAP requests
    [.] slapd_daemon - PR_Listen() on 10.14.54.140 port 10389 failed: Netscape Portable Runtime error -5982 (Local Network address is in use.)
    [.] - slapd shutting down - signaling operation threads
    [.] - slapd shutting down - waiting for 28 threads to terminate
    [.] - slapd shutting down - closing down internal subsystems and plugins
    [.] - Waiting for 4 database threads to stop
    [.] - All database threads now stopped
    [.] - userRoot: Cleaning up entry cache
    [.] - userRoot: Cleaning up dn cache
    [.] - slapd stopped.

The problem of my laptop is IPv4-mapped-IPv6 address is returned and the address is added to the listen host array, which is basically identical to the IPv4 address pf PR_Listen.  To avoid the problem, I think slapd_listenhost2addr should check if the address is an IPv4 mapped IPv6 address or not.  And if it is, it should not add it to the listen host array.

(gdb) p *(*addr)[0]
$15 = {raw = {family = 10,
    data = "\000\000\000\000\000\000 \000\000\000\000\000\000"}, inet = {
    family = 10, port = 0, ip = 0, pad = " \000\000\000\000\000\000"}, ipv6 = {
    family = 10, port = 0, flowinfo = 0, ip = {_S6_un = {
        _S6_u8 = " ", '\000' <repeats 12 times>, "\001\022\064", _S6_u16 = {
          32, 0, 0, 0, 0, 0, 256, 13330}, _S6_u32 = {32, 0, 0, 873595136},
        _S6_u64 = {32, 3752062539064672256}}}, scope_id = 0}, local = {
    family = 10,
    path = "\000\000\000\000\000\000 ", '\000' <repeats 12 times>, "\001\022\064", '\000' <repeats 81 times>}}
(gdb) p addrbuf
$19 = 0xbffff32c "2000::1:1234"

(gdb) p *(*addr)[1]
$17 = {raw = {family = 2,
    data = "\000\000\n\016\066\214\000\000\000\000\000\000\000"}, inet = {
    family = 2, port = 0, ip = 2352352778,
    pad = "\000\000\000\000\000\000\000"}, ipv6 = {family = 2, port = 0,
    flowinfo = 2352352778, ip = {_S6_un = {_S6_u8 = '\000' <repeats 15 times>,
        _S6_u16 = {0, 0, 0, 0, 0, 0, 0, 0}, _S6_u32 = {0, 0, 0, 0}, _S6_u64 = {
          0, 0}}}, scope_id = 0}, local = {family = 2,
    path = "\000\000\n\016\066\214", '\000' <repeats 97 times>}}
p addrbuf
$20 = 0xbffff32c "10.14.54.140"

(gdb) p *(*addr)[2]
$18 = {raw = {family = 10, data = '\000' <repeats 13 times>}, inet = {
    family = 10, port = 0, ip = 0, pad = "\000\000\000\000\000\000\000"},
  ipv6 = {family = 10, port = 0, flowinfo = 0, ip = {_S6_un = {
        _S6_u8 = "\000\000\000\000\000\000\000\000\000\000\377\377\n\016\066\214", _S6_u16 = {0, 0, 0, 0, 0, 65535, 3594, 35894}, _S6_u32 = {0, 0, 4294901760,
          2352352778}, _S6_u64 = {0, 10103278254459650048}}}, scope_id = 0},
  local = {family = 10,
    path = '\000' <repeats 16 times>"\377, \377\n\016\066\214", '\000' <repeats 81 times>}}
(gdb) p addrbuf
$21 = 0xbffff32c "::ffff:10.14.54.140"



2751         PRAddrInfo *infop = PR_GetAddrInfoByName( listenhost,
2752                         PR_AF_UNSPEC, (PR_AI_ADDRCONFIG|PR_AI_NOCANONNAME)      );
2753         if ( NULL != infop ) {
2754             void *iter = NULL;
2755             int addrcnt = 0;
2756             int i = 0;
2757             memset( netaddr, 0, sizeof( PRNetAddr ));
2758             /* need to count the address, first */
2759             while ( (iter = PR_EnumerateAddrInfo( iter, infop, 0, netaddr )     )     
2760                             != NULL ) {
2761                 addrcnt++;
2762             }
2763             if ( 0 == addrcnt ) {
2764                 slapi_log_error( SLAPI_LOG_FATAL, logname,
2765                     "PR_EnumerateAddrInfo for %s failed - %s error %d (%s)\     n",           
2766                     listenhost, SLAPI_COMPONENT_NAME_NSPR, prerr,
2767                     slapd_pr_strerror(prerr));
2768                 rval = -1;
2769             } else {
2770                 *addr = (PRNetAddr **)slapi_ch_calloc(addrcnt + 1, sizeof (     PRNetAddr *));
2771                 iter = NULL; /* from the beginning */
2772                 memset( netaddr, 0, sizeof( PRNetAddr ));
2773                 for  ( i = 0; i < addrcnt; i++ ) {
2774                     iter = PR_EnumerateAddrInfo( iter, infop, 0, netaddr );
2775                     if ( NULL == iter ) {
2776                         break;
2777                     }
2778                     (*addr)[i] = netaddr;
2779                     netaddr = (PRNetAddr *)slapi_ch_calloc(1, sizeof(PRNetA     ddr));
2780                 }
2781                 slapi_ch_free((void **)&netaddr); /* not used */
2782             }
2783             PR_FreeAddrInfo( infop );

Comment 3 Martin Kosek 2012-01-04 13:26:17 UTC
Upstream ticket:
https://fedorahosted.org/389/ticket/52


Note You need to log in before you can comment on or make changes to this bug.