AI_ADDRCONFIG once again [was: Re: svn commit: trunk/uClibc: extra/Configs include libc/inet]

Ricard Wanderlof ricard.wanderlof at axis.com
Wed Oct 22 09:13:14 UTC 2008


On Wed, 22 Oct 2008, Bernhard Reutner-Fischer wrote:

>> I could remove the __ASSUME_NETLINK_SUPPORT stuff completely from all
>> source files, but it would make it difficult for someone who really
>> needed this. On the other hand the approach below looks a bit half
>> hearted. Could expand the comment I suppose.
>
> removing it completely woundn't be nice, agreed.
> ISTR that you (tried to) write to __no_netlink_support, so this spot
> would need adjustment too, i'd think.

Looking closely at the code, __no_netlink_support is only used by 
libc/inet/ifaddrs.c . And the whole body of that file goes away when 
__ASSUME_NETLINK_SUPPORT == 0. In conclusion, we can remove all internal 
references to __ASSUME_NETLINK_SUPPORT within the body, and consequently 
remove all reference to __no_netlink_support, as the variable will never 
be used, as the file is written.

Like this:

Index: libc/inet/ifaddrs.c
===================================================================
--- libc/inet/ifaddrs.c	(revision 23762)
+++ libc/inet/ifaddrs.c	(working copy)
@@ -308,9 +308,6 @@
      close_and_out:
        __netlink_close (h);
      out:
-#if __ASSUME_NETLINK_SUPPORT == 0
-      __no_netlink_support = 1;
-#endif
        return -1;
      }
    /* Determine the ID the kernel assigned for this netlink connection.
@@ -374,18 +371,11 @@
    if (ifap)
      *ifap = NULL;

-  if (! __no_netlink_support && __netlink_open (&nh) < 0)
+  if (__netlink_open (&nh) < 0)
      {
-#if __ASSUME_NETLINK_SUPPORT != 0
        return -1;
-#endif
      }

-#if __ASSUME_NETLINK_SUPPORT == 0
-  if (__no_netlink_support)
-    return fallback_getifaddrs (ifap);
-#endif
-
    /* Tell the kernel that we wish to get a list of all
       active interfaces, collect all data for every interface.  */
    if (__netlink_request (&nh, RTM_GETLINK) < 0)
@@ -864,13 +854,11 @@
  }


-#if __ASSUME_NETLINK_SUPPORT != 0
  void
  freeifaddrs (struct ifaddrs *ifa)
  {
    free (ifa);
  }
-#endif

  #endif /* __UCLIBC_SUPPORT_AI_ADDRCONFIG__ */

Index: libc/inet/netlinkaccess.h
===================================================================
--- libc/inet/netlinkaccess.h	(revision 23762)
+++ libc/inet/netlinkaccess.h	(working copy)
@@ -57,16 +57,6 @@
  #define __ASSUME_NETLINK_SUPPORT 1
  #endif

-#ifdef __UCLIBC_SUPPORT_AI_ADDRCONFIG__
-#if __ASSUME_NETLINK_SUPPORT == 0
-/* suspicious: This will simply not work.. */
-extern smallint __no_netlink_support attribute_hidden;
-#else
-# define __no_netlink_support 0
-#endif
-#endif /* __UCLIBC_SUPPORT_AI_ADDRCONFIG__ */
-
-
  extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
  extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
  extern void __netlink_free_handle (struct netlink_handle *h) attribute_hidden;


/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



More information about the uClibc mailing list