]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Check for correct first nibble
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 20 Apr 2018 03:30:22 +0000 (05:30 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 20 Apr 2018 04:51:28 +0000 (06:51 +0200)
The code before assumed that the flow label was always zero.

tun_linux.go

index a37b727e92cf5f2d03c404e1083f1bdfd6dbbc40..1abc86fd884335536dcd0a3f646fcf845022f2fc 100644 (file)
@@ -273,7 +273,7 @@ func (tun *NativeTun) Write(buff []byte, offset int) (int, error) {
                buff[0] = 0x00
                buff[1] = 0x00
 
-               if buff[4] == ipv6.Version<<4 {
+               if buff[4]>>4 == ipv6.Version {
                        buff[2] = 0x86
                        buff[3] = 0xdd
                } else {