diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2019-03-19 10:29:40 +0000 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2019-03-19 10:29:59 +0000 |
commit | 30bccaecced94f6d92f4516b3ac85897e03fdee2 (patch) | |
tree | afee1d4c236c8849633488c0ba5ec53fda854cbe /tun.c | |
parent | 0024a3850c28ddb78f83d2914f3ea71d115566e2 (diff) |
Check TCP/UDP packet field presence
Some system uses "th_sum" and "uh_sum" for checksum fields while
other use "check".
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Diffstat (limited to 'tun.c')
-rw-r--r-- | tun.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1,4 +1,5 @@ #define _GNU_SOURCE +#include <config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -29,6 +30,20 @@ #include "utils.h" #include "pcap.h" +#ifndef HAVE_STRUCT_TCPHDR_TH_SUM +#ifndef HAVE_STRUCT_TCPHDR_CHECK +#error No checksum field found in tcphdr +#endif +#define th_sum check +#endif + +#ifndef HAVE_STRUCT_UDPHDR_UH_SUM +#ifndef HAVE_STRUCT_UDPHDR_CHECK +#error No checksum field found in udphdr +#endif +#define uh_sum check +#endif + static int tun_fd = -1; static int tun_fd_back = -1; static int remote_sock = -1; |