This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] New getifaddrs implementation


On Fri, Mar 28, Ulrich Drepper wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Thorsten Kukuk wrote:
> 
> > here is the next try of a IPv6 ready getifaddrs() implementation.
> > I make only one calloc for the whole struct given back to the caller,
> 
> Looks good.  There were three bugs or so which I corrected, a few
> optimizations, and a bit of cleanup.  The result is checked in.  Thanks,

Are you sure that the following change from you is correct?

From getifaddrs():
[...]
  if (netlink_open (&nh) < 0)
    {
#if __ASSUME_NETLINK_SUPPORT == 0
       no_netlink_support = 1;
#else
       return -1;
#endif
    }

#if __ASSUME_NETLINK_SUPPORT == 0
  if (no_netlink_support)
    return fallback_getifaddrs (ifap);
#endif
[...]

With this change, we try at first if kernel has AF_NETLINK support.
If not, we set no_netlink_support to 1. Now we try at every further
call if we have netlink support, but independend of the result, we
will always call the fallback function. This means, if there is no
netlink support we will always make a useless try to open a socket.
And if netlink support is loaded later, we will leak a socket every
call.

   Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk at suse dot de
SuSE Linux AG        Deutschherrnstr. 15-19        D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]