Public bug reported:

The following minimal test program:

  #include <net/if.h>
  #include <linux/rtnetlink.h>
  int main (int argc, char **argv) { return 0; }

compiled successfully in Ubuntu 10.10, but fails in the in-development
Natty series (libc6-dev 2.12.1-0ubuntu8, linux-libc-dev 2.6.37-2.10) as
follows:

  $ gcc -Wall t.c -o t
  In file included from /usr/include/linux/netdevice.h:28:0,
                   from /usr/include/linux/rtnetlink.h:9,
                   from t.c:2:
  /usr/include/linux/if.h:135:8: error: redefinition of ‘struct ifmap’
  /usr/include/net/if.h:112:8: note: originally defined here
  /usr/include/linux/if.h:169:8: error: redefinition of ‘struct ifreq’
  /usr/include/net/if.h:127:8: note: originally defined here
  /usr/include/linux/if.h:218:8: error: redefinition of ‘struct ifconf’
  /usr/include/net/if.h:177:8: note: originally defined here

So far, this problem has bitten busybox, wireless-tools, and
NetworkManager.

This was triggered by a change in Linux 2.6.37-rc1 which added '#include
<linux/netdevice.h>' to include/linux/rtnetlink.h, so I'm filing this
bug on both libc and the kernel.  It might be possible to work around
this in the kernel in a way that's less intrusive to userspace
applications, but really, I think the problem is that you can't include
both <net/if.h> and <linux/if.h> (even transitively) at the same time.
Until that's fixed, it's difficult to use the generic net headers
together with Linux-specific features - note that there's no way to get
at the functionality from <linux/rtnetlink.h> without including a
<linux/*> header directly.

It's possible to work around this by shuffling includes to avoid using
<net/if.h> and only use <linux/if.h> (you typically have to include
<sys/socket.h> too), but it's messy and it would be better to steer in
the direction of fewer <linux/*> inclusions in userspace applications,
not more.

** Affects: eglibc (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

** Also affects: linux (Ubuntu)
   Importance: Undecided
       Status: New

-- 
<net/if.h> and <linux/if.h> are incompatible
https://bugs.launchpad.net/bugs/673073
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to