Re: Initial libnl support committed



On 10/27/2005 11:24 PM, Dan Williams wrote:
Hi,

I've converted all the functions in NetworkManagerSystem.c (with the
exception of nm_system_device_set_ip4_route_with_iface()) to use libnl
rather than a lot of nasty ioctl() code.  The patch for libnl is about
2/3 the size of the old code, thus continuing the divine unbreakable
rule that all patches must remove more code than they add, or you
personally owe me $100.  This rule does not apply to me, since I would
simply be paying myself.
NetworkManager doesn't compile against libnl with newer kernels.

In file included from /usr/include/netlink/route/link.h:15,
from NetworkManagerSystem.c:52:
/usr/include/linux/if.h:59: error: redefinition of ‘struct ifmap’
/usr/include/linux/if.h:77: error: redefinition of ‘struct ifreq’
/usr/include/linux/if.h:126: error: redefinition of ‘struct ifconf’


The attached patch to libnl fixes this, using the macro guard from iwlib.h (also under GPL).


--- libnl-1.0-pre4/include/netlink/route/link.h.compile	2005-10-31 13:46:05.000000000 -0500
+++ libnl-1.0-pre4/include/netlink/route/link.h	2005-11-01 22:32:06.000000000 -0500
@@ -12,7 +12,19 @@
 #ifndef NETLINK_LINK_H_
 #define NETLINK_LINK_H_
 
+#if defined(__GLIBC__) \
+      && __GLIBC__ == 2 \
+      && __GLIBC_MINOR__ == 1 \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
+#define HEADERS_KERNEL
+#endif
+
+#ifdef HEADERS_KERNEL
 #include <linux/if.h>
+#else   /* !HEADERS_KERNEL */
+#include <net/if.h>
+#endif  /* !HEADERS_KERNEL */
+
 #include <netlink/netlink.h>
 #include <netlink/cache.h>
 #include <netlink/addr.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]