summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-11-14 22:48:42 -0500
committerMarek PikuĊ‚a <m.pikula@partner.samsung.com>2023-02-08 14:46:44 +0100
commit976b629c3b188cce409262217523f9e061da72a4 (patch)
treedae58e851db67a2d6610f20bb7cdbe291d9839c6
parent629e2c6e2ec0aa33ce1be277cb32751fddea8e53 (diff)
downloadnet-tools-submit/tizen_base_dev/20230612.021243.tar.gz
net-tools-submit/tizen_base_dev/20230612.021243.tar.bz2
net-tools-submit/tizen_base_dev/20230612.021243.zip
While linux-4.8+ headers work, older ones are missing includes. Dropping netinet/ip.h uncovered that mess, so add linux/ip.h. Change-Id: I6799b8b33b178a9926beee2c72d6ede6c971f85c URL: https://bugs.gentoo.org/599542 Reported-by: Conrad Kostecki <ck@bl4ckb0x.de> Source: https://sourceforge.net/p/net-tools/code/ci/ea3935bd7c0f36c86c40e5785326698fa3336c6a/
-rw-r--r--iptunnel.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/iptunnel.c b/iptunnel.c
index 68f6bdf..b2e74d1 100644
--- a/iptunnel.c
+++ b/iptunnel.c
@@ -27,14 +27,14 @@
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1))
#include <net/if.h>
#include <net/if_arp.h>
-#else
-#include <linux/if.h>
-#include <linux/if_arp.h>
-#endif
+/* We only care about linux/if_tunnel.h. Unfortunately, older Linux headers
+ * (pre linux-4.8) did not include all the proper headers leading to missing
+ * structs and types.
+ */
#include <linux/types.h>
+#include <linux/ip.h>
#include <linux/if_tunnel.h>
#include "config.h"
@@ -377,7 +377,7 @@ static int do_add(int cmd, int argc, char **argv)
return do_add_ioctl(cmd, "gre0", &p);
case IPPROTO_IPV6:
return do_add_ioctl(cmd, "sit0", &p);
- default:
+ default:
fprintf(stderr, _("cannot determine tunnel mode (ipip, gre or sit)\n"));
return -1;
}
@@ -392,13 +392,13 @@ int do_del(int argc, char **argv)
return -1;
switch (p.iph.protocol) {
- case IPPROTO_IPIP:
+ case IPPROTO_IPIP:
return do_del_ioctl(p.name[0] ? p.name : "tunl0", &p);
- case IPPROTO_GRE:
+ case IPPROTO_GRE:
return do_del_ioctl(p.name[0] ? p.name : "gre0", &p);
- case IPPROTO_IPV6:
+ case IPPROTO_IPV6:
return do_del_ioctl(p.name[0] ? p.name : "sit0", &p);
- default:
+ default:
return do_del_ioctl(p.name, &p);
}
return -1;
@@ -539,7 +539,7 @@ static int do_show(int argc, char **argv)
return -1;
switch (p.iph.protocol) {
- case IPPROTO_IPIP:
+ case IPPROTO_IPIP:
err = do_get_ioctl(p.name[0] ? p.name : "tunl0", &p);
break;
case IPPROTO_GRE:
@@ -598,7 +598,7 @@ int main(int argc, char **argv)
basename = argv[0];
else
basename++;
-
+
while (argc > 1) {
if (argv[1][0] != '-')
break;