Bug 1300256 - Including <libiptc/libiptc.h> results to redeclaration of enumerator ‘IFF_UP’ in /usr/include/linux/if.h
Including <libiptc/libiptc.h> results to redeclaration of enumerator ‘IFF_UP’...
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Kernel Maintainer List
Fedora Extras Quality Assurance
http://thread.gmane.org/gmane.linux.n...
:
Depends On:
Blocks: 1500910 1294481 1300223 1307398
  Show dependency treegraph
 
Reported: 2016-01-20 06:14 EST by Petr Pisar
Modified: 2017-10-11 13:39 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1500910 (view as bug list)
Environment:
Last Closed: 2016-05-16 10:19:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Petr Pisar 2016-01-20 06:14:26 EST
There was a change in kernel-headers causing including <libiptc/libiptc.h> to fail like this:

$ echo '#include <libiptc/libiptc.h>' | gcc -x c -c /dev/stdin -o /dev/null 2>&1 |head
In file included from /usr/include/libiptc/ipt_kernel_headers.h:14:0,
                 from /usr/include/libiptc/libiptc.h:6,
                 from /dev/stdin:1:
/usr/include/linux/if.h:71:2: error: redeclaration of enumerator ‘IFF_UP’
  IFF_UP    = 1<<0,  /* sysfs */
  ^
/usr/include/net/if.h:44:5: note: previous definition of ‘IFF_UP’ was here
     IFF_UP = 0x1,  /* Interface is up.  */
     ^

I have installed:

iptables-devel-1.4.21-15.fc23.x86_64
kernel-headers-4.5.0-0.rc0.git6.1.fc24.x86_64
glibc-headers-2.22.90-29.fc24.x86_64

This does not happen with kernel-headers-4.5.0-0.rc0.git1.1.fc24.x86_64.
Comment 1 Petr Pisar 2016-01-20 06:51:26 EST
This can be reduced to:

#include <net/if.h>
#include <linux/if.h>

Reassigning to kernel.
Comment 3 Josh Boyer 2016-02-03 09:41:10 EST
(In reply to Petr Pisar from comment #0)
> There was a change in kernel-headers causing including <libiptc/libiptc.h>
> to fail like this:
> 
> $ echo '#include <libiptc/libiptc.h>' | gcc -x c -c /dev/stdin -o /dev/null
> 2>&1 |head
> In file included from /usr/include/libiptc/ipt_kernel_headers.h:14:0,
>                  from /usr/include/libiptc/libiptc.h:6,
>                  from /dev/stdin:1:
> /usr/include/linux/if.h:71:2: error: redeclaration of enumerator ‘IFF_UP’
>   IFF_UP    = 1<<0,  /* sysfs */
>   ^
> /usr/include/net/if.h:44:5: note: previous definition of ‘IFF_UP’ was here
>      IFF_UP = 0x1,  /* Interface is up.  */
>      ^
> 
> I have installed:
> 
> iptables-devel-1.4.21-15.fc23.x86_64
> kernel-headers-4.5.0-0.rc0.git6.1.fc24.x86_64
> glibc-headers-2.22.90-29.fc24.x86_64
> 
> This does not happen with kernel-headers-4.5.0-0.rc0.git1.1.fc24.x86_64.

That's confusing.  There has been no change to the installed linux/if.h file since Linux v3.15.

Did something change in glibc-headers or iptables-devel?
Comment 4 Jiri Popelka 2016-02-03 09:48:04 EST
Nothing has changed in iptables.
Comment 5 Petr Pisar 2016-02-03 12:51:19 EST
The kernel-headers change is that various /usr/include/linux/netfilter_ipv{4,6}/ headers include <linux/if.h> now. One of them is included by <libiptc/libiptc.h>, thus you will get both <net/if.h> and <linux/if.h> to the same compile unit.

Difference of "printf '#include <libiptc/libiptc.h>\n' | cpp -MD /dev/stdin" outputs follows:

--- good	2016-02-03 18:42:43.542000000 +0100
+++ bad	2016-02-03 18:43:23.945000000 +0100
@@ -2015,6 +2015,166 @@
 
 # 1 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 1 3 4
 # 20 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
+# 1 "/usr/include/linux/if.h" 1 3 4
+# 23 "/usr/include/linux/if.h" 3 4
+# 1 "/usr/include/linux/socket.h" 1 3 4
+# 11 "/usr/include/linux/socket.h" 3 4
+typedef unsigned short __kernel_sa_family_t;
+
+struct __kernel_sockaddr_storage {
+ __kernel_sa_family_t ss_family;
+
+ char __data[128 - sizeof(unsigned short)];
+
+
+} __attribute__ ((aligned((__alignof__ (struct sockaddr *)))));
+# 24 "/usr/include/linux/if.h" 2 3 4
+
+
+
+
+# 1 "/usr/include/linux/hdlc/ioctl.h" 1 3 4
+# 39 "/usr/include/linux/hdlc/ioctl.h" 3 4
+typedef struct {
+ unsigned int clock_rate;
+ unsigned int clock_type;
+ unsigned short loopback;
+} sync_serial_settings;
+
+typedef struct {
+ unsigned int clock_rate;
+ unsigned int clock_type;
+ unsigned short loopback;
+ unsigned int slot_map;
+} te1_settings;
+
+typedef struct {
+ unsigned short encoding;
+ unsigned short parity;
+} raw_hdlc_proto;
+
+typedef struct {
+ unsigned int t391;
+ unsigned int t392;
+ unsigned int n391;
+ unsigned int n392;
+ unsigned int n393;
+ unsigned short lmi;
+ unsigned short dce;
+} fr_proto;
+
+typedef struct {
+ unsigned int dlci;
+} fr_proto_pvc;
+
+typedef struct {
+ unsigned int dlci;
+ char master[16];
+}fr_proto_pvc_info;
+
+typedef struct {
+    unsigned int interval;
+    unsigned int timeout;
+} cisco_proto;
+# 29 "/usr/include/linux/if.h" 2 3 4
+# 70 "/usr/include/linux/if.h" 3 4
+enum net_device_flags {
+ IFF_UP = 1<<0,
+ IFF_BROADCAST = 1<<1,
+ IFF_DEBUG = 1<<2,
+ IFF_LOOPBACK = 1<<3,
+ IFF_POINTOPOINT = 1<<4,
+ IFF_NOTRAILERS = 1<<5,
+ IFF_RUNNING = 1<<6,
+ IFF_NOARP = 1<<7,
+ IFF_PROMISC = 1<<8,
+ IFF_ALLMULTI = 1<<9,
+ IFF_MASTER = 1<<10,
+ IFF_SLAVE = 1<<11,
+ IFF_MULTICAST = 1<<12,
+ IFF_PORTSEL = 1<<13,
+ IFF_AUTOMEDIA = 1<<14,
+ IFF_DYNAMIC = 1<<15,
+ IFF_LOWER_UP = 1<<16,
+ IFF_DORMANT = 1<<17,
+ IFF_ECHO = 1<<18,
+};
+# 143 "/usr/include/linux/if.h" 3 4
+enum {
+ IF_OPER_UNKNOWN,
+ IF_OPER_NOTPRESENT,
+ IF_OPER_DOWN,
+ IF_OPER_LOWERLAYERDOWN,
+ IF_OPER_TESTING,
+ IF_OPER_DORMANT,
+ IF_OPER_UP,
+};
+
+
+enum {
+ IF_LINK_MODE_DEFAULT,
+ IF_LINK_MODE_DORMANT,
+};
+# 169 "/usr/include/linux/if.h" 3 4
+struct ifmap {
+ unsigned long mem_start;
+ unsigned long mem_end;
+ unsigned short base_addr;
+ unsigned char irq;
+ unsigned char dma;
+ unsigned char port;
+
+};
+
+struct if_settings {
+ unsigned int type;
+ unsigned int size;
+ union {
+
+  raw_hdlc_proto *raw_hdlc;
+  cisco_proto *cisco;
+  fr_proto *fr;
+  fr_proto_pvc *fr_pvc;
+  fr_proto_pvc_info *fr_pvc_info;
+
+
+  sync_serial_settings *sync;
+  te1_settings *te1;
+ } ifs_ifsu;
+};
+# 203 "/usr/include/linux/if.h" 3 4
+struct ifreq {
+
+ union
+ {
+  char ifrn_name[16];
+ } ifr_ifrn;
+
+ union {
+  struct sockaddr ifru_addr;
+  struct sockaddr ifru_dstaddr;
+  struct sockaddr ifru_broadaddr;
+  struct sockaddr ifru_netmask;
+  struct sockaddr ifru_hwaddr;
+  short ifru_flags;
+  int ifru_ivalue;
+  int ifru_mtu;
+  struct ifmap ifru_map;
+  char ifru_slave[16];
+  char ifru_newname[16];
+  void * ifru_data;
+  struct if_settings ifru_settings;
+ } ifr_ifru;
+};
+# 252 "/usr/include/linux/if.h" 3 4
+struct ifconf {
+ int ifc_len;
+ union {
+  char *ifcu_buf;
+  struct ifreq *ifcu_req;
+ } ifc_ifcu;
+};
+# 21 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 2 3 4
 # 1 "/usr/include/linux/netfilter_ipv4.h" 1 3 4
 
 
@@ -2971,18 +3131,6 @@
 # 22 "/usr/include/linux/in.h" 3 4
 # 1 "/usr/include/linux/libc-compat.h" 1 3 4
 # 23 "/usr/include/linux/in.h" 2 3 4
-# 1 "/usr/include/linux/socket.h" 1 3 4
-# 11 "/usr/include/linux/socket.h" 3 4
-typedef unsigned short __kernel_sa_family_t;
-
-struct __kernel_sockaddr_storage {
- __kernel_sa_family_t ss_family;
-
- char __data[128 - sizeof(unsigned short)];
-
-
-} __attribute__ ((aligned((__alignof__ (struct sockaddr *)))));
-# 24 "/usr/include/linux/in.h" 2 3 4
 # 296 "/usr/include/linux/in.h" 3 4
 # 1 "/usr/include/asm/byteorder.h" 1 3 4
 
@@ -3330,7 +3478,7 @@
  NF_IP_PRI_CONNTRACK_CONFIRM = 0x7fffffff,
  NF_IP_PRI_LAST = 0x7fffffff,
 };
-# 21 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 2 3 4
+# 22 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 2 3 4
 
 # 1 "/usr/include/linux/netfilter/x_tables.h" 1 3 4
 # 10 "/usr/include/linux/netfilter/x_tables.h" 3 4
@@ -3418,8 +3566,8 @@
 
  struct xt_counters counters[0];
 };
-# 23 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 2 3 4
-# 39 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
+# 24 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 2 3 4
+# 40 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
 # 1 "/usr/include/linux/netfilter/xt_tcpudp.h" 1 3 4
 
 
@@ -3441,8 +3589,8 @@
  __u16 dpts[2];
  __u8 invflags;
 };
-# 40 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 2 3 4
-# 67 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
+# 41 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 2 3 4
+# 68 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
 struct ipt_ip {
 
  struct in_addr src, dst;
@@ -3459,7 +3607,7 @@
 
  __u8 invflags;
 };
-# 102 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
+# 103 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
 struct ipt_entry {
  struct ipt_ip ip;
 
@@ -3480,7 +3628,7 @@
 
  unsigned char elems[0];
 };
-# 143 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
+# 144 "/usr/include/linux/netfilter_ipv4/ip_tables.h" 3 4
 struct ipt_icmp {
  __u8 type;
  __u8 code[2];
Comment 6 Josh Boyer 2016-02-04 02:14:01 EST
Ah, ok.  That's because of upstream commit 1ffad83dffd675cd742286ae82dca7d746cb0da8.  I believe upstream is already aware and is looking into it, but I haven't seen anything in the way of a fix yet.
Comment 7 Petr Pisar 2016-02-04 04:19:10 EST
Yes <http://thread.gmane.org/gmane.linux.network/393907/focus=394053>. It broke iproute2 too.
Comment 8 Pavel Šimerda (pavlix) 2016-05-09 09:45:21 EDT
Looks like ConnMan package doesn't build either. Is this going to be fixed? I'm already getting workaround patches from other Fedora developers.

https://kojipkgs.fedoraproject.org//work/tasks/285/13980285/build.log
Comment 9 Josh Boyer 2016-05-09 09:59:52 EDT
(In reply to Pavel Šimerda (pavlix) from comment #8)
> Looks like ConnMan package doesn't build either. Is this going to be fixed?
> I'm already getting workaround patches from other Fedora developers.
> 
> https://kojipkgs.fedoraproject.org//work/tasks/285/13980285/build.log

There was a patch submitted upstream, but it seems to have stalled.  I bumped the thread.
Comment 10 Petr Pisar 2016-05-16 10:14:43 EDT
This seems to work with kernel-headers-4.6.0-0.rc7.git3.1.fc25 again.
Comment 11 Josh Boyer 2016-05-16 10:19:55 EDT
(In reply to Petr Pisar from comment #10)
> This seems to work with kernel-headers-4.6.0-0.rc7.git3.1.fc25 again.

Yes, the patch I mentioned above went in as:

commit 4a91cb61bb995e5571098188092e296192309c77
Author: Mikko Rapeli <mikko.rapeli@iki.fi>
Date:   Sun Apr 24 17:45:00 2016 +0200

    uapi glibc compat: fix compile errors when glibc net/if.h included before li
nux/if.h


It should hit the stable releases at some point soon.

Note You need to log in before you can comment on or make changes to this bug.