Add explanation for tun packet headers
This commit is contained in:
parent
b559806a8e
commit
9e105d21d4
|
@ -521,11 +521,15 @@ write_tun(int tun_fd, char *data, size_t len)
|
||||||
len -= 4;
|
len -= 4;
|
||||||
} else {
|
} else {
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
|
// Linux prefixes with 32 bits ethertype
|
||||||
|
// 0x0800 for IPv4, 0x86DD for IPv6
|
||||||
data[0] = 0x00;
|
data[0] = 0x00;
|
||||||
data[1] = 0x00;
|
data[1] = 0x00;
|
||||||
data[2] = 0x08;
|
data[2] = 0x08;
|
||||||
data[3] = 0x00;
|
data[3] = 0x00;
|
||||||
#else /* OPENBSD and DARWIN(utun) */
|
#else /* OPENBSD and DARWIN(utun) */
|
||||||
|
// BSDs prefix with 32 bits address family
|
||||||
|
// AF_INET for IPv4, AF_INET6 for IPv6
|
||||||
data[0] = 0x00;
|
data[0] = 0x00;
|
||||||
data[1] = 0x00;
|
data[1] = 0x00;
|
||||||
data[2] = 0x00;
|
data[2] = 0x00;
|
||||||
|
|
Loading…
Reference in New Issue