[Bridge] Conflict between net/if.h and linux/if.h

Edouard Thuleau doudouyam at gmail.com
Thu Nov 22 03:16:38 PST 2007


I use the libbridge and an other lib (libnl) in a same project.
I include the headers files of the two lib (libnl first and libbridgge
after) and I've a conflict with the inclusion of linux/if.h (in libnl
headers) and net/if.h (in libbridge.h), I've this error :

/usr/include/net/if.h:45: error: parse error before numeric constant
/usr/include/net/if.h:111: error: redefinition of `struct ifmap'
/usr/include/net/if.h:126: error: redefinition of `struct ifreq'
/usr/include/net/if.h:176: error: redefinition of `struct ifconf'

I modify the libbridge.h to include the net/if.h only if the
linux/if.h is not define :

--- libbridge.h 2007-11-22 12:16:17.000000000 +0100
+++ libbridge_modify.h  2007-11-22 12:15:58.000000000 +0100
@@ -19,7 +19,9 @@
 #ifndef _LIBBRIDGE_H
 #define _LIBBRIDGE_H

+#ifndef _LINUX_IF_H
 #include <net/if.h>
 #include <linux/if_bridge.h>

 struct bridge_id

Do you think it's a good solution ?

More information about the Bridge mailing list