From 9e105d21d4e4155248f98cd081543ef5203eacd4 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Wed, 8 Apr 2015 08:42:05 +0200 Subject: [PATCH] Add explanation for tun packet headers --- src/tun.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tun.c b/src/tun.c index 44bb220..c05a591 100644 --- a/src/tun.c +++ b/src/tun.c @@ -521,11 +521,15 @@ write_tun(int tun_fd, char *data, size_t len) len -= 4; } else { #ifdef LINUX + // Linux prefixes with 32 bits ethertype + // 0x0800 for IPv4, 0x86DD for IPv6 data[0] = 0x00; data[1] = 0x00; data[2] = 0x08; data[3] = 0x00; #else /* OPENBSD and DARWIN(utun) */ + // BSDs prefix with 32 bits address family + // AF_INET for IPv4, AF_INET6 for IPv6 data[0] = 0x00; data[1] = 0x00; data[2] = 0x00;