icmp.c: do not include linux headers

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)
This commit is contained in:
Dominique Martinet 2023-08-02 19:58:28 +09:00
parent b46c2aa671
commit e168cc6ff7

4
icmp.c
View file

@ -1,8 +1,8 @@
// L2TPNS: icmp // L2TPNS: icmp
#include <arpa/inet.h> #include <arpa/inet.h>
#include <linux/ip.h> #include <netinet/ip.h>
#include <linux/icmp.h> #include <netinet/ip_icmp.h>
#include <netinet/icmp6.h> #include <netinet/icmp6.h>
#include <unistd.h> #include <unistd.h>
#include <netinet/ip6.h> #include <netinet/ip6.h>