Add explanation for tun packet headers

This commit is contained in:
Erik Ekman 2015-04-08 08:42:05 +02:00
parent b559806a8e
commit 9e105d21d4

View File

@ -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;