diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-08-02 21:10:09 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-08-09 22:09:34 +0200 |
commit | 63ebccdfe350d7e75bbb8e5511bcde26a7e300ad (patch) | |
tree | 700acfb1b9138c72d43866636270f20cb60d53a1 /ggsn | |
parent | d12eab9c4e375e1669637dd34674c8b8208cf867 (diff) |
lib/tun.h: Remove non-endian-safe redefinition of IP header
We can simply use 'struct iphdr' from netinet/ip.h to achieve
the same goal (and be portable).
Change-Id: Ieece22e127dc14a7ffdc3b05656628989ad00b32
Diffstat (limited to 'ggsn')
-rw-r--r-- | ggsn/ggsn.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index 0d0e569..4fb2066 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -34,6 +34,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> +#include <netinet/ip.h> #include <arpa/inet.h> #include <sys/wait.h> #include <sys/stat.h> @@ -43,6 +44,7 @@ #include <sys/socket.h> #include <sys/ioctl.h> #include <net/if.h> +#include <net/if.h> #include <errno.h> @@ -221,13 +223,13 @@ int cb_tun_ind(struct tun_t *tun, void *pack, unsigned len) { struct ippoolm_t *ipm; struct in46_addr dst; - struct tun_packet_t *iph = (struct tun_packet_t *)pack; + struct iphdr *iph = (struct iphdr *)pack; - if (iph->ver == 4) { + if (iph->version == 4) { if (len < sizeof(*iph) || len < 4*iph->ihl) return -1; dst.len = 4; - dst.v4.s_addr = iph->dst; + dst.v4.s_addr = iph->daddr; } else { LOGP(DGGSN, LOGL_NOTICE, "non-IPv4 packet received from tun\n"); return -1; |