Skip to content

icmp.c: do not include linux headers

asmadeus requested to merge asmadeus/l2tpns:icmp_header into master

net/if.h and linux/if.h headers conflict with each other as of linux 6.3 and glibc 2.37 headers:

In file included from /usr/include/linux/icmp.h:23,
                 from icmp.c:5:
/usr/include/net/if.h:44:5: error: redeclaration of enumerator ‘IFF_UP’
   44 |     IFF_UP = 0x1,               /* Interface is up.  */
      |     ^~~~~~
/usr/include/linux/if.h:83:9: note: previous definition of ‘IFF_UP’ with type ‘enum net_device_flags’
   83 |         IFF_UP                          = 1<<0,  /* sysfs */
      |         ^~~~~~

icmp.c gets net/if.h from l2tpns.h, and linux/if.h from linux/icmp.h.

In our case, we do not need to use the linux headers at all here as we are doing normal userspace things: just use glibc headers all the way.

This has been tested with kernel 3.2 / glibc 2.13 headers, so it's probably fine. (l2tpns does not currently build with musl)

Merge request reports