++ id -u
+ '[' 0 '!=' 0 ']'
+ which tcpdump
+ expected_tos=0x00
+ expected_ttl=0
+ failed=false
+ printf ┌────────┬───────┬───────┬──────────────┬
┌────────┬───────┬───────┬──────────────┬+ printf '──────────────┬───────┬────────┐\n'
──────────────┬───────┬────────┐
+ for type in gre vxlan geneve
++ modprobe gre
+ for outer in 4 6
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ printf '│  Type  │ outer | inner │     tos      │'
│  Type  │ outer | inner │     tos      │+ printf '      ttl     │  vlan │ result │\n'
      ttl     │  vlan │ result │
+ for inner in 4 6 other
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 4 4 inherit false
+ local type=gre
+ local outer=4
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x4c
+ expected_tos=0x4c
+ '[' 0x4c = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0x4c'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x4c
+ expected_ttl=76
+ '[' 76 = 64 ']'
+ '[' 76 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 76'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 4 'inherit 0x4c' 'inherit 76' false
│    gre │     4 │     4 │ inherit 0x4c │   inherit 76 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 4 4 inherit false
+ local outer=4
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' inherit = inherit ']'
+ ping_pid=510464
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 4 = 4 ']'
+ req_proto_offset=47
+ req_offset=58
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
+ ping -i 0.1 198.19.0.2 -Q 0x4c -t 76
++ head -n 1
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[47]' = 0x01 and 'ip[58]' = 0x08
+ out='01:50:04.179853 IP (tos 0x4c, ttl 76, id 22684, offset 0, flags [DF], proto GRE (47), length 122)'
+ kill -9 510464
+ wait 510464
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:04.179853 IP (tos 0x4c, ttl 76, id 22684, offset 0, flags [DF], proto GRE (47), length 122)'
++ local field=ttl
++ local 'input=01:50:04.179853 IP (tos 0x4c, ttl 76, id 22684, offset 0, flags [DF], proto GRE (47), length 122)'
++ local found=false
+++ echo '01:50:04.179853 IP (tos 0x4c, ttl 76, id 22684, offset 0, flags [DF], proto GRE (47), length 122)'
+++ tr -d '(),'
++ input='01:50:04.179853 IP tos 0x4c ttl 76 id 22684 offset 0 flags [DF] proto GRE 47 length 122'
++ for input_field in $input
++ false
++ '[' 01:50:04.179853 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x4c = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 76
++ return
+ captured_ttl=76
+++ get_field tos '01:50:04.179853 IP (tos 0x4c, ttl 76, id 22684, offset 0, flags [DF], proto GRE (47), length 122)'
+++ local field=tos
+++ local 'input=01:50:04.179853 IP (tos 0x4c, ttl 76, id 22684, offset 0, flags [DF], proto GRE (47), length 122)'
+++ local found=false
++++ echo '01:50:04.179853 IP (tos 0x4c, ttl 76, id 22684, offset 0, flags [DF], proto GRE (47), length 122)'
++++ tr -d '(),'
+++ input='01:50:04.179853 IP tos 0x4c ttl 76 id 22684 offset 0 flags [DF] proto GRE 47 length 122'
+++ for input_field in $input
+++ false
+++ '[' 01:50:04.179853 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x4c
+++ return
++ printf 0x%02x 0x4c
+ captured_tos=0x4c
+ '[' 0x4c = 0x4c ']'
+ '[' 76 = 76 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 4 4 inherit true
+ local type=gre
+ local outer=4
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xcc
+ expected_tos=0xcc
+ '[' 0xcc = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0xcc'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x7c
+ expected_ttl=124
+ '[' 124 = 64 ']'
+ '[' 124 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 124'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 4 'inherit 0xcc' 'inherit 124' true
│    gre │     4 │     4 │ inherit 0xcc │  inherit 124 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev vlan99-0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev vlan99-1
+ verify 4 4 inherit true
+ local outer=4
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' inherit = inherit ']'
+ ping_pid=510615
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 4 = 4 ']'
+ req_proto_offset=47
+ req_offset=58
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ ping -i 0.1 198.19.0.2 -Q 0xcc -t 124
+ req_proto_offset=51
+ req_offset=62
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[51]' = 0x01 and 'ip[62]' = 0x08
++ head -n 1
+ out='01:50:04.671928 IP (tos 0xcc, ttl 124, id 22714, offset 0, flags [DF], proto GRE (47), length 126)'
+ kill -9 510615
+ wait 510615
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:04.671928 IP (tos 0xcc, ttl 124, id 22714, offset 0, flags [DF], proto GRE (47), length 126)'
++ local field=ttl
++ local 'input=01:50:04.671928 IP (tos 0xcc, ttl 124, id 22714, offset 0, flags [DF], proto GRE (47), length 126)'
++ local found=false
+++ echo '01:50:04.671928 IP (tos 0xcc, ttl 124, id 22714, offset 0, flags [DF], proto GRE (47), length 126)'
+++ tr -d '(),'
++ input='01:50:04.671928 IP tos 0xcc ttl 124 id 22714 offset 0 flags [DF] proto GRE 47 length 126'
++ for input_field in $input
++ false
++ '[' 01:50:04.671928 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0xcc = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 124
++ return
+ captured_ttl=124
+++ get_field tos '01:50:04.671928 IP (tos 0xcc, ttl 124, id 22714, offset 0, flags [DF], proto GRE (47), length 126)'
+++ local field=tos
+++ local 'input=01:50:04.671928 IP (tos 0xcc, ttl 124, id 22714, offset 0, flags [DF], proto GRE (47), length 126)'
+++ local found=false
++++ echo '01:50:04.671928 IP (tos 0xcc, ttl 124, id 22714, offset 0, flags [DF], proto GRE (47), length 126)'
++++ tr -d '(),'
+++ input='01:50:04.671928 IP tos 0xcc ttl 124 id 22714 offset 0 flags [DF] proto GRE 47 length 126'
+++ for input_field in $input
+++ false
+++ '[' 01:50:04.671928 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0xcc
+++ return
++ printf 0x%02x 0xcc
+ captured_tos=0xcc
+ '[' 0xcc = 0xcc ']'
+ '[' 124 = 124 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 4 4 random false
+ local type=gre
+ local outer=4
+ local inner=4
+ local tos_ttl=random
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x90
+ expected_tos=0x90
+ '[' 0x90 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0x90
+ tos='fixed 0x90'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x6a
+ expected_ttl=106
+ '[' 106 = 64 ']'
+ '[' 106 = 0 ']'
+ '[' random = random ']'
+ test_ttl=106
+ ttl='fixed 106'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 4 'fixed 0x90' 'fixed 106' false
│    gre │     4 │     4 │   fixed 0x90 │    fixed 106 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos 0x90 ttl 106
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos 0x90 ttl 106
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 4 4 random false
+ local outer=4
+ local inner=4
+ local tos_ttl=random
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' random = inherit ']'
+ ping_pid=510710
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 4 = 4 ']'
+ req_proto_offset=47
+ req_offset=58
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
+ ping -i 0.1 198.19.0.2
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[47]' = 0x01 and 'ip[58]' = 0x08
++ head -n 1
+ out='01:50:05.139900 IP (tos 0x90, ttl 106, id 22765, offset 0, flags [DF], proto GRE (47), length 122)'
+ kill -9 510710
+ wait 510710
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:05.139900 IP (tos 0x90, ttl 106, id 22765, offset 0, flags [DF], proto GRE (47), length 122)'
++ local field=ttl
++ local 'input=01:50:05.139900 IP (tos 0x90, ttl 106, id 22765, offset 0, flags [DF], proto GRE (47), length 122)'
++ local found=false
+++ echo '01:50:05.139900 IP (tos 0x90, ttl 106, id 22765, offset 0, flags [DF], proto GRE (47), length 122)'
+++ tr -d '(),'
++ input='01:50:05.139900 IP tos 0x90 ttl 106 id 22765 offset 0 flags [DF] proto GRE 47 length 122'
++ for input_field in $input
++ false
++ '[' 01:50:05.139900 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x90 = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 106
++ return
+ captured_ttl=106
+++ get_field tos '01:50:05.139900 IP (tos 0x90, ttl 106, id 22765, offset 0, flags [DF], proto GRE (47), length 122)'
+++ local field=tos
+++ local 'input=01:50:05.139900 IP (tos 0x90, ttl 106, id 22765, offset 0, flags [DF], proto GRE (47), length 122)'
+++ local found=false
++++ echo '01:50:05.139900 IP (tos 0x90, ttl 106, id 22765, offset 0, flags [DF], proto GRE (47), length 122)'
++++ tr -d '(),'
+++ input='01:50:05.139900 IP tos 0x90 ttl 106 id 22765 offset 0 flags [DF] proto GRE 47 length 122'
+++ for input_field in $input
+++ false
+++ '[' 01:50:05.139900 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x90
+++ return
++ printf 0x%02x 0x90
+ captured_tos=0x90
+ '[' 0x90 = 0x90 ']'
+ '[' 106 = 106 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 4 4 random true
+ local type=gre
+ local outer=4
+ local inner=4
+ local tos_ttl=random
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x64
+ expected_tos=0x64
+ '[' 0x64 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0x64
+ tos='fixed 0x64'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x76
+ expected_ttl=118
+ '[' 118 = 64 ']'
+ '[' 118 = 0 ']'
+ '[' random = random ']'
+ test_ttl=118
+ ttl='fixed 118'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 4 'fixed 0x64' 'fixed 118' true
│    gre │     4 │     4 │   fixed 0x64 │    fixed 118 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos 0x64 ttl 118
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos 0x64 ttl 118
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev vlan99-0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev vlan99-1
+ verify 4 4 random true
+ local outer=4
+ local inner=4
+ local tos_ttl=random
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' random = inherit ']'
+ ping_pid=510857
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 4 = 4 ']'
+ req_proto_offset=47
+ req_offset=58
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=51
+ ping -i 0.1 198.19.0.2
+ req_offset=62
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[51]' = 0x01 and 'ip[62]' = 0x08
++ head -n 1
+ out='01:50:05.667872 IP (tos 0x64, ttl 118, id 22787, offset 0, flags [DF], proto GRE (47), length 126)'
+ kill -9 510857
+ wait 510857
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:05.667872 IP (tos 0x64, ttl 118, id 22787, offset 0, flags [DF], proto GRE (47), length 126)'
++ local field=ttl
++ local 'input=01:50:05.667872 IP (tos 0x64, ttl 118, id 22787, offset 0, flags [DF], proto GRE (47), length 126)'
++ local found=false
+++ echo '01:50:05.667872 IP (tos 0x64, ttl 118, id 22787, offset 0, flags [DF], proto GRE (47), length 126)'
+++ tr -d '(),'
++ input='01:50:05.667872 IP tos 0x64 ttl 118 id 22787 offset 0 flags [DF] proto GRE 47 length 126'
++ for input_field in $input
++ false
++ '[' 01:50:05.667872 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x64 = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 118
++ return
+ captured_ttl=118
+++ get_field tos '01:50:05.667872 IP (tos 0x64, ttl 118, id 22787, offset 0, flags [DF], proto GRE (47), length 126)'
+++ local field=tos
+++ local 'input=01:50:05.667872 IP (tos 0x64, ttl 118, id 22787, offset 0, flags [DF], proto GRE (47), length 126)'
+++ local found=false
++++ echo '01:50:05.667872 IP (tos 0x64, ttl 118, id 22787, offset 0, flags [DF], proto GRE (47), length 126)'
++++ tr -d '(),'
+++ input='01:50:05.667872 IP tos 0x64 ttl 118 id 22787 offset 0 flags [DF] proto GRE 47 length 126'
+++ for input_field in $input
+++ false
+++ '[' 01:50:05.667872 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x64
+++ return
++ printf 0x%02x 0x64
+ captured_tos=0x64
+ '[' 0x64 = 0x64 ']'
+ '[' 118 = 118 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for inner in 4 6 other
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 4 6 inherit false
+ local type=gre
+ local outer=4
+ local inner=6
+ local tos_ttl=inherit
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x0c
+ expected_tos=0x0c
+ '[' 0x0c = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0x0c'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0xbb
+ expected_ttl=187
+ '[' 187 = 64 ']'
+ '[' 187 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 187'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 6 'inherit 0x0c' 'inherit 187' false
│    gre │     4 │     6 │ inherit 0x0c │  inherit 187 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 6 = 4 ']'
+ '[' 6 = other ']'
+ '[' 6 = 6 ']'
+ ip addr add fdd4:96cf:4eae:443b::1/64 dev tep0
+ ip netns exec testing ip addr add fdd4:96cf:4eae:443b::2/64 dev tep1
+ verify 4 6 inherit false
+ local outer=4
+ local inner=6
+ local tos_ttl=inherit
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping_dst=fdd4:96cf:4eae:443b::2
+ '[' inherit = inherit ']'
+ ping_pid=510950
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ req_proto_offset=44
+ req_offset=78
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
+ ping -i 0.1 fdd4:96cf:4eae:443b::2 -Q 0x0c -t 187
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[44]' = 0x3a and 'ip[78]' = 0x80
++ head -n 1
+ out='01:50:09.044110 IP (tos 0xc, ttl 187, id 23073, offset 0, flags [DF], proto GRE (47), length 142)'
+ kill -9 510950
+ wait 510950
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:09.044110 IP (tos 0xc, ttl 187, id 23073, offset 0, flags [DF], proto GRE (47), length 142)'
++ local field=ttl
++ local 'input=01:50:09.044110 IP (tos 0xc, ttl 187, id 23073, offset 0, flags [DF], proto GRE (47), length 142)'
++ local found=false
+++ echo '01:50:09.044110 IP (tos 0xc, ttl 187, id 23073, offset 0, flags [DF], proto GRE (47), length 142)'
+++ tr -d '(),'
++ input='01:50:09.044110 IP tos 0xc ttl 187 id 23073 offset 0 flags [DF] proto GRE 47 length 142'
++ for input_field in $input
++ false
++ '[' 01:50:09.044110 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0xc = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 187
++ return
+ captured_ttl=187
+++ get_field tos '01:50:09.044110 IP (tos 0xc, ttl 187, id 23073, offset 0, flags [DF], proto GRE (47), length 142)'
+++ local field=tos
+++ local 'input=01:50:09.044110 IP (tos 0xc, ttl 187, id 23073, offset 0, flags [DF], proto GRE (47), length 142)'
+++ local found=false
++++ echo '01:50:09.044110 IP (tos 0xc, ttl 187, id 23073, offset 0, flags [DF], proto GRE (47), length 142)'
++++ tr -d '(),'
+++ input='01:50:09.044110 IP tos 0xc ttl 187 id 23073 offset 0 flags [DF] proto GRE 47 length 142'
+++ for input_field in $input
+++ false
+++ '[' 01:50:09.044110 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0xc
+++ return
++ printf 0x%02x 0xc
+ captured_tos=0x0c
+ '[' 0x0c = 0x0c ']'
+ '[' 187 = 187 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 4 6 inherit true
+ local type=gre
+ local outer=4
+ local inner=6
+ local tos_ttl=inherit
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x54
+ expected_tos=0x54
+ '[' 0x54 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0x54'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0xfc
+ expected_ttl=252
+ '[' 252 = 64 ']'
+ '[' 252 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 252'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 6 'inherit 0x54' 'inherit 252' true
│    gre │     4 │     6 │ inherit 0x54 │  inherit 252 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' 6 = 4 ']'
+ '[' 6 = other ']'
+ '[' 6 = 6 ']'
+ ip addr add fdd4:96cf:4eae:443b::1/64 dev vlan99-0
+ ip netns exec testing ip addr add fdd4:96cf:4eae:443b::2/64 dev vlan99-1
+ verify 4 6 inherit true
+ local outer=4
+ local inner=6
+ local tos_ttl=inherit
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping_dst=fdd4:96cf:4eae:443b::2
+ '[' inherit = inherit ']'
+ ping_pid=511099
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ req_proto_offset=44
+ req_offset=78
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ ping -i 0.1 fdd4:96cf:4eae:443b::2 -Q 0x54 -t 252
+ true
+ req_proto_offset=48
+ req_offset=82
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[48]' = 0x3a and 'ip[82]' = 0x80
++ head -n 1
+ out='01:50:12.468364 IP (tos 0x54, ttl 252, id 23501, offset 0, flags [DF], proto GRE (47), length 146)'
+ kill -9 511099
+ wait 511099
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:12.468364 IP (tos 0x54, ttl 252, id 23501, offset 0, flags [DF], proto GRE (47), length 146)'
++ local field=ttl
++ local 'input=01:50:12.468364 IP (tos 0x54, ttl 252, id 23501, offset 0, flags [DF], proto GRE (47), length 146)'
++ local found=false
+++ echo '01:50:12.468364 IP (tos 0x54, ttl 252, id 23501, offset 0, flags [DF], proto GRE (47), length 146)'
+++ tr -d '(),'
++ input='01:50:12.468364 IP tos 0x54 ttl 252 id 23501 offset 0 flags [DF] proto GRE 47 length 146'
++ for input_field in $input
++ false
++ '[' 01:50:12.468364 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x54 = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 252
++ return
+ captured_ttl=252
+++ get_field tos '01:50:12.468364 IP (tos 0x54, ttl 252, id 23501, offset 0, flags [DF], proto GRE (47), length 146)'
+++ local field=tos
+++ local 'input=01:50:12.468364 IP (tos 0x54, ttl 252, id 23501, offset 0, flags [DF], proto GRE (47), length 146)'
+++ local found=false
++++ echo '01:50:12.468364 IP (tos 0x54, ttl 252, id 23501, offset 0, flags [DF], proto GRE (47), length 146)'
++++ tr -d '(),'
+++ input='01:50:12.468364 IP tos 0x54 ttl 252 id 23501 offset 0 flags [DF] proto GRE 47 length 146'
+++ for input_field in $input
+++ false
+++ '[' 01:50:12.468364 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x54
+++ return
++ printf 0x%02x 0x54
+ captured_tos=0x54
+ '[' 0x54 = 0x54 ']'
+ '[' 252 = 252 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 4 6 random false
+ local type=gre
+ local outer=4
+ local inner=6
+ local tos_ttl=random
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xbc
+ expected_tos=0xbc
+ '[' 0xbc = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0xbc
+ tos='fixed 0xbc'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x2d
+ expected_ttl=45
+ '[' 45 = 64 ']'
+ '[' 45 = 0 ']'
+ '[' random = random ']'
+ test_ttl=45
+ ttl='fixed 45'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 6 'fixed 0xbc' 'fixed 45' false
│    gre │     4 │     6 │   fixed 0xbc │     fixed 45 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos 0xbc ttl 45
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos 0xbc ttl 45
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 6 = 4 ']'
+ '[' 6 = other ']'
+ '[' 6 = 6 ']'
+ ip addr add fdd4:96cf:4eae:443b::1/64 dev tep0
+ ip netns exec testing ip addr add fdd4:96cf:4eae:443b::2/64 dev tep1
+ verify 4 6 random false
+ local outer=4
+ local inner=6
+ local tos_ttl=random
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping_dst=fdd4:96cf:4eae:443b::2
+ '[' random = inherit ']'
+ ping_pid=511198
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ req_proto_offset=44
+ req_offset=78
+ ping -i 0.1 fdd4:96cf:4eae:443b::2
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[44]' = 0x3a and 'ip[78]' = 0x80
++ head -n 1
+ out='01:50:15.860128 IP (tos 0xbc, ttl 45, id 23922, offset 0, flags [DF], proto GRE (47), length 142)'
+ kill -9 511198
+ wait 511198
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:15.860128 IP (tos 0xbc, ttl 45, id 23922, offset 0, flags [DF], proto GRE (47), length 142)'
++ local field=ttl
++ local 'input=01:50:15.860128 IP (tos 0xbc, ttl 45, id 23922, offset 0, flags [DF], proto GRE (47), length 142)'
++ local found=false
+++ echo '01:50:15.860128 IP (tos 0xbc, ttl 45, id 23922, offset 0, flags [DF], proto GRE (47), length 142)'
+++ tr -d '(),'
++ input='01:50:15.860128 IP tos 0xbc ttl 45 id 23922 offset 0 flags [DF] proto GRE 47 length 142'
++ for input_field in $input
++ false
++ '[' 01:50:15.860128 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0xbc = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 45
++ return
+ captured_ttl=45
+++ get_field tos '01:50:15.860128 IP (tos 0xbc, ttl 45, id 23922, offset 0, flags [DF], proto GRE (47), length 142)'
+++ local field=tos
+++ local 'input=01:50:15.860128 IP (tos 0xbc, ttl 45, id 23922, offset 0, flags [DF], proto GRE (47), length 142)'
+++ local found=false
++++ echo '01:50:15.860128 IP (tos 0xbc, ttl 45, id 23922, offset 0, flags [DF], proto GRE (47), length 142)'
++++ tr -d '(),'
+++ input='01:50:15.860128 IP tos 0xbc ttl 45 id 23922 offset 0 flags [DF] proto GRE 47 length 142'
+++ for input_field in $input
+++ false
+++ '[' 01:50:15.860128 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0xbc
+++ return
++ printf 0x%02x 0xbc
+ captured_tos=0xbc
+ '[' 0xbc = 0xbc ']'
+ '[' 45 = 45 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 4 6 random true
+ local type=gre
+ local outer=4
+ local inner=6
+ local tos_ttl=random
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x14
+ expected_tos=0x14
+ '[' 0x14 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0x14
+ tos='fixed 0x14'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x01
+ expected_ttl=1
+ '[' 1 = 64 ']'
+ '[' 1 = 0 ']'
+ '[' random = random ']'
+ test_ttl=1
+ ttl='fixed 1'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 6 'fixed 0x14' 'fixed 1' true
│    gre │     4 │     6 │   fixed 0x14 │      fixed 1 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos 0x14 ttl 1
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos 0x14 ttl 1
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' 6 = 4 ']'
+ '[' 6 = other ']'
+ '[' 6 = 6 ']'
+ ip addr add fdd4:96cf:4eae:443b::1/64 dev vlan99-0
+ ip netns exec testing ip addr add fdd4:96cf:4eae:443b::2/64 dev vlan99-1
+ verify 4 6 random true
+ local outer=4
+ local inner=6
+ local tos_ttl=random
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping_dst=fdd4:96cf:4eae:443b::2
+ '[' random = inherit ']'
+ ping_pid=511345
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ req_proto_offset=44
+ req_offset=78
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=48
+ req_offset=82
+ ping -i 0.1 fdd4:96cf:4eae:443b::2
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[48]' = 0x3a and 'ip[82]' = 0x80
++ head -n 1
+ out='01:50:19.316111 IP (tos 0x14, ttl 1, id 24217, offset 0, flags [DF], proto GRE (47), length 146)'
+ kill -9 511345
+ wait 511345
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:19.316111 IP (tos 0x14, ttl 1, id 24217, offset 0, flags [DF], proto GRE (47), length 146)'
++ local field=ttl
++ local 'input=01:50:19.316111 IP (tos 0x14, ttl 1, id 24217, offset 0, flags [DF], proto GRE (47), length 146)'
++ local found=false
+++ echo '01:50:19.316111 IP (tos 0x14, ttl 1, id 24217, offset 0, flags [DF], proto GRE (47), length 146)'
+++ tr -d '(),'
++ input='01:50:19.316111 IP tos 0x14 ttl 1 id 24217 offset 0 flags [DF] proto GRE 47 length 146'
++ for input_field in $input
++ false
++ '[' 01:50:19.316111 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x14 = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 1
++ return
+ captured_ttl=1
+++ get_field tos '01:50:19.316111 IP (tos 0x14, ttl 1, id 24217, offset 0, flags [DF], proto GRE (47), length 146)'
+++ local field=tos
+++ local 'input=01:50:19.316111 IP (tos 0x14, ttl 1, id 24217, offset 0, flags [DF], proto GRE (47), length 146)'
+++ local found=false
++++ echo '01:50:19.316111 IP (tos 0x14, ttl 1, id 24217, offset 0, flags [DF], proto GRE (47), length 146)'
++++ tr -d '(),'
+++ input='01:50:19.316111 IP tos 0x14 ttl 1 id 24217 offset 0 flags [DF] proto GRE 47 length 146'
+++ for input_field in $input
+++ false
+++ '[' 01:50:19.316111 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x14
+++ return
++ printf 0x%02x 0x14
+ captured_tos=0x14
+ '[' 0x14 = 0x14 ']'
+ '[' 1 = 1 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for inner in 4 6 other
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 4 other inherit false
+ local type=gre
+ local outer=4
+ local inner=other
+ local tos_ttl=inherit
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xfc
+ expected_tos=0xfc
+ '[' 0xfc = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0xfc'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0xf1
+ expected_ttl=241
+ '[' 241 = 64 ']'
+ '[' 241 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 241'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 other 'inherit 0xfc' 'inherit 241' false
│    gre │     4 │ other │ inherit 0xfc │  inherit 241 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' other = 4 ']'
+ '[' other = other ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 4 other inherit false
+ local outer=4
+ local inner=other
+ local tos_ttl=inherit
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ ping_dst=198.19.0.3
+ '[' inherit = inherit ']'
+ ping_pid=511444
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ ping -i 0.1 198.19.0.3 -Q 0xfc -t 241
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ req_proto_offset=36
+ req_offset=45
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
+ '[' inherit = inherit ']'
+ expected_tos=0x00
+ expected_ttl=64
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[36]' = 0x08 and 'ip[37]' = 0x06 and 'ip[45]' = 0x01
++ head -n 1
+ out='01:50:20.691766 IP (tos 0x0, ttl 64, id 24350, offset 0, flags [DF], proto GRE (47), length 66)'
+ kill -9 511444
+ wait 511444
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:20.691766 IP (tos 0x0, ttl 64, id 24350, offset 0, flags [DF], proto GRE (47), length 66)'
++ local field=ttl
++ local 'input=01:50:20.691766 IP (tos 0x0, ttl 64, id 24350, offset 0, flags [DF], proto GRE (47), length 66)'
++ local found=false
+++ echo '01:50:20.691766 IP (tos 0x0, ttl 64, id 24350, offset 0, flags [DF], proto GRE (47), length 66)'
+++ tr -d '(),'
++ input='01:50:20.691766 IP tos 0x0 ttl 64 id 24350 offset 0 flags [DF] proto GRE 47 length 66'
++ for input_field in $input
++ false
++ '[' 01:50:20.691766 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x0 = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 64
++ return
+ captured_ttl=64
+++ get_field tos '01:50:20.691766 IP (tos 0x0, ttl 64, id 24350, offset 0, flags [DF], proto GRE (47), length 66)'
+++ local field=tos
+++ local 'input=01:50:20.691766 IP (tos 0x0, ttl 64, id 24350, offset 0, flags [DF], proto GRE (47), length 66)'
+++ local found=false
++++ echo '01:50:20.691766 IP (tos 0x0, ttl 64, id 24350, offset 0, flags [DF], proto GRE (47), length 66)'
++++ tr -d '(),'
+++ input='01:50:20.691766 IP tos 0x0 ttl 64 id 24350 offset 0 flags [DF] proto GRE 47 length 66'
+++ for input_field in $input
+++ false
+++ '[' 01:50:20.691766 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x0
+++ return
++ printf 0x%02x 0x0
+ captured_tos=0x00
+ '[' 0x00 = 0x00 ']'
+ '[' 64 = 64 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 4 other inherit true
+ local type=gre
+ local outer=4
+ local inner=other
+ local tos_ttl=inherit
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xa4
+ expected_tos=0xa4
+ '[' 0xa4 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0xa4'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x93
+ expected_ttl=147
+ '[' 147 = 64 ']'
+ '[' 147 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 147'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 other 'inherit 0xa4' 'inherit 147' true
│    gre │     4 │ other │ inherit 0xa4 │  inherit 147 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' other = 4 ']'
+ '[' other = other ']'
+ ip addr add 198.19.0.1/24 brd + dev vlan99-0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev vlan99-1
+ verify 4 other inherit true
+ local outer=4
+ local inner=other
+ local tos_ttl=inherit
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ ping_dst=198.19.0.3
+ '[' inherit = inherit ']'
+ ping_pid=511587
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ req_proto_offset=36
+ req_offset=45
+ ping -i 0.1 198.19.0.3 -Q 0xa4 -t 147
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=40
+ req_offset=49
+ '[' inherit = inherit ']'
+ expected_tos=0x00
+ expected_ttl=64
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[40]' = 0x08 and 'ip[41]' = 0x06 and 'ip[49]' = 0x01
++ head -n 1
+ out='01:50:22.068035 IP (tos 0x0, ttl 64, id 24537, offset 0, flags [DF], proto GRE (47), length 70)'
+ kill -9 511587
+ wait 511587
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:22.068035 IP (tos 0x0, ttl 64, id 24537, offset 0, flags [DF], proto GRE (47), length 70)'
++ local field=ttl
++ local 'input=01:50:22.068035 IP (tos 0x0, ttl 64, id 24537, offset 0, flags [DF], proto GRE (47), length 70)'
++ local found=false
+++ echo '01:50:22.068035 IP (tos 0x0, ttl 64, id 24537, offset 0, flags [DF], proto GRE (47), length 70)'
+++ tr -d '(),'
++ input='01:50:22.068035 IP tos 0x0 ttl 64 id 24537 offset 0 flags [DF] proto GRE 47 length 70'
++ for input_field in $input
++ false
++ '[' 01:50:22.068035 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x0 = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 64
++ return
+ captured_ttl=64
+++ get_field tos '01:50:22.068035 IP (tos 0x0, ttl 64, id 24537, offset 0, flags [DF], proto GRE (47), length 70)'
+++ local field=tos
+++ local 'input=01:50:22.068035 IP (tos 0x0, ttl 64, id 24537, offset 0, flags [DF], proto GRE (47), length 70)'
+++ local found=false
++++ echo '01:50:22.068035 IP (tos 0x0, ttl 64, id 24537, offset 0, flags [DF], proto GRE (47), length 70)'
++++ tr -d '(),'
+++ input='01:50:22.068035 IP tos 0x0 ttl 64 id 24537 offset 0 flags [DF] proto GRE 47 length 70'
+++ for input_field in $input
+++ false
+++ '[' 01:50:22.068035 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x0
+++ return
++ printf 0x%02x 0x0
+ captured_tos=0x00
+ '[' 0x00 = 0x00 ']'
+ '[' 64 = 64 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 4 other random false
+ local type=gre
+ local outer=4
+ local inner=other
+ local tos_ttl=random
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x74
+ expected_tos=0x74
+ '[' 0x74 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0x74
+ tos='fixed 0x74'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0xdd
+ expected_ttl=221
+ '[' 221 = 64 ']'
+ '[' 221 = 0 ']'
+ '[' random = random ']'
+ test_ttl=221
+ ttl='fixed 221'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 other 'fixed 0x74' 'fixed 221' false
│    gre │     4 │ other │   fixed 0x74 │    fixed 221 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos 0x74 ttl 221
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos 0x74 ttl 221
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' other = 4 ']'
+ '[' other = other ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 4 other random false
+ local outer=4
+ local inner=other
+ local tos_ttl=random
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ ping_dst=198.19.0.3
+ '[' random = inherit ']'
+ ping_pid=511681
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ req_proto_offset=36
+ req_offset=45
+ ping -i 0.1 198.19.0.3
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
+ '[' random = inherit ']'
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[36]' = 0x08 and 'ip[37]' = 0x06 and 'ip[45]' = 0x01
++ head -n 1
+ out='01:50:23.415822 IP (tos 0x74, ttl 221, id 24737, offset 0, flags [DF], proto GRE (47), length 66)'
+ kill -9 511681
+ wait 511681
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:23.415822 IP (tos 0x74, ttl 221, id 24737, offset 0, flags [DF], proto GRE (47), length 66)'
++ local field=ttl
++ local 'input=01:50:23.415822 IP (tos 0x74, ttl 221, id 24737, offset 0, flags [DF], proto GRE (47), length 66)'
++ local found=false
+++ echo '01:50:23.415822 IP (tos 0x74, ttl 221, id 24737, offset 0, flags [DF], proto GRE (47), length 66)'
+++ tr -d '(),'
++ input='01:50:23.415822 IP tos 0x74 ttl 221 id 24737 offset 0 flags [DF] proto GRE 47 length 66'
++ for input_field in $input
++ false
++ '[' 01:50:23.415822 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x74 = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 221
++ return
+ captured_ttl=221
+++ get_field tos '01:50:23.415822 IP (tos 0x74, ttl 221, id 24737, offset 0, flags [DF], proto GRE (47), length 66)'
+++ local field=tos
+++ local 'input=01:50:23.415822 IP (tos 0x74, ttl 221, id 24737, offset 0, flags [DF], proto GRE (47), length 66)'
+++ local found=false
++++ echo '01:50:23.415822 IP (tos 0x74, ttl 221, id 24737, offset 0, flags [DF], proto GRE (47), length 66)'
++++ tr -d '(),'
+++ input='01:50:23.415822 IP tos 0x74 ttl 221 id 24737 offset 0 flags [DF] proto GRE 47 length 66'
+++ for input_field in $input
+++ false
+++ '[' 01:50:23.415822 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x74
+++ return
++ printf 0x%02x 0x74
+ captured_tos=0x74
+ '[' 0x74 = 0x74 ']'
+ '[' 221 = 221 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 4 other random true
+ local type=gre
+ local outer=4
+ local inner=other
+ local tos_ttl=random
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x80
+ expected_tos=0x80
+ '[' 0x80 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0x80
+ tos='fixed 0x80'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0xc8
+ expected_ttl=200
+ '[' 200 = 64 ']'
+ '[' 200 = 0 ']'
+ '[' random = random ']'
+ test_ttl=200
+ ttl='fixed 200'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 4 other 'fixed 0x80' 'fixed 200' true
│    gre │     4 │ other │   fixed 0x80 │    fixed 200 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 4 = 4 ']'
+ '[' gre = gre ']'
+ type=gretap
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type gretap local 198.18.0.1 remote 198.18.0.2 tos 0x80 ttl 200
+ ip netns exec testing ip link add name tep1 type gretap local 198.18.0.2 remote 198.18.0.1 tos 0x80 ttl 200
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' other = 4 ']'
+ '[' other = other ']'
+ ip addr add 198.19.0.1/24 brd + dev vlan99-0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev vlan99-1
+ verify 4 other random true
+ local outer=4
+ local inner=other
+ local tos_ttl=random
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ ping_dst=198.19.0.3
+ '[' random = inherit ']'
+ ping_pid=511826
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ req_proto_offset=36
+ req_offset=45
+ ping -i 0.1 198.19.0.3
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=40
+ req_offset=49
+ '[' random = inherit ']'
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x2f and 'ip[40]' = 0x08 and 'ip[41]' = 0x06 and 'ip[49]' = 0x01
++ head -n 1
+ out='01:50:24.819827 IP (tos 0x80, ttl 200, id 24904, offset 0, flags [DF], proto GRE (47), length 70)'
+ kill -9 511826
+ wait 511826
+ result=FAIL
+ '[' 4 = 4 ']'
++ get_field ttl '01:50:24.819827 IP (tos 0x80, ttl 200, id 24904, offset 0, flags [DF], proto GRE (47), length 70)'
++ local field=ttl
++ local 'input=01:50:24.819827 IP (tos 0x80, ttl 200, id 24904, offset 0, flags [DF], proto GRE (47), length 70)'
++ local found=false
+++ echo '01:50:24.819827 IP (tos 0x80, ttl 200, id 24904, offset 0, flags [DF], proto GRE (47), length 70)'
+++ tr -d '(),'
++ input='01:50:24.819827 IP tos 0x80 ttl 200 id 24904 offset 0 flags [DF] proto GRE 47 length 70'
++ for input_field in $input
++ false
++ '[' 01:50:24.819827 = ttl ']'
++ for input_field in $input
++ false
++ '[' IP = ttl ']'
++ for input_field in $input
++ false
++ '[' tos = ttl ']'
++ for input_field in $input
++ false
++ '[' 0x80 = ttl ']'
++ for input_field in $input
++ false
++ '[' ttl = ttl ']'
++ found=true
++ for input_field in $input
++ true
++ echo 200
++ return
+ captured_ttl=200
+++ get_field tos '01:50:24.819827 IP (tos 0x80, ttl 200, id 24904, offset 0, flags [DF], proto GRE (47), length 70)'
+++ local field=tos
+++ local 'input=01:50:24.819827 IP (tos 0x80, ttl 200, id 24904, offset 0, flags [DF], proto GRE (47), length 70)'
+++ local found=false
++++ echo '01:50:24.819827 IP (tos 0x80, ttl 200, id 24904, offset 0, flags [DF], proto GRE (47), length 70)'
++++ tr -d '(),'
+++ input='01:50:24.819827 IP tos 0x80 ttl 200 id 24904 offset 0 flags [DF] proto GRE 47 length 70'
+++ for input_field in $input
+++ false
+++ '[' 01:50:24.819827 = tos ']'
+++ for input_field in $input
+++ false
+++ '[' IP = tos ']'
+++ for input_field in $input
+++ false
+++ '[' tos = tos ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x80
+++ return
++ printf 0x%02x 0x80
+ captured_tos=0x80
+ '[' 0x80 = 0x80 ']'
+ '[' 200 = 200 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for outer in 4 6
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ printf '│  Type  │ outer | inner │     tos      │'
│  Type  │ outer | inner │     tos      │+ printf '      ttl     │  vlan │ result │\n'
      ttl     │  vlan │ result │
+ for inner in 4 6 other
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 6 4 inherit false
+ local type=gre
+ local outer=6
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x20
+ expected_tos=0x20
+ '[' 0x20 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0x20'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x58
+ expected_ttl=88
+ '[' 88 = 64 ']'
+ '[' 88 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 88'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 4 'inherit 0x20' 'inherit 88' false
│    gre │     6 │     4 │ inherit 0x20 │   inherit 88 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 6 4 inherit false
+ local outer=6
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' inherit = inherit ']'
+ ping_pid=511924
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ ping -i 0.1 198.19.0.2 -Q 0x20 -t 88
+ '[' 4 = 4 ']'
+ local req_proto_offset=75
+ local req_offset=86
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[75]' = 0x01 and 'ip6[86]' = 0x08
++ head -n 1
+ out='01:50:27.219991 IP6 (class 0x20, flowlabel 0xb9664, hlim 88, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
+ kill -9 511924
+ wait 511924
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:27.219991 IP6 (class 0x20, flowlabel 0xb9664, hlim 88, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
++ local field=hlim
++ local 'input=01:50:27.219991 IP6 (class 0x20, flowlabel 0xb9664, hlim 88, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
++ local found=false
+++ echo '01:50:27.219991 IP6 (class 0x20, flowlabel 0xb9664, hlim 88, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
+++ tr -d '(),'
++ input='01:50:27.219991 IP6 class 0x20 flowlabel 0xb9664 hlim 88 next-header unknown 60 payload length: 110 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 102'
++ for input_field in $input
++ false
++ '[' 01:50:27.219991 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x20 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xb9664 = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 88
++ return
+ captured_ttl=88
+++ get_field class '01:50:27.219991 IP6 (class 0x20, flowlabel 0xb9664, hlim 88, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
+++ local field=class
+++ local 'input=01:50:27.219991 IP6 (class 0x20, flowlabel 0xb9664, hlim 88, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
+++ local found=false
++++ echo '01:50:27.219991 IP6 (class 0x20, flowlabel 0xb9664, hlim 88, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
++++ tr -d '(),'
+++ input='01:50:27.219991 IP6 class 0x20 flowlabel 0xb9664 hlim 88 next-header unknown 60 payload length: 110 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 102'
+++ for input_field in $input
+++ false
+++ '[' 01:50:27.219991 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x20
+++ return
++ printf 0x%02x 0x20
+ captured_tos=0x20
+ '[' 0x20 = 0x20 ']'
+ '[' 88 = 88 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 6 4 inherit true
+ local type=gre
+ local outer=6
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xa8
+ expected_tos=0xa8
+ '[' 0xa8 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0xa8'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x7a
+ expected_ttl=122
+ '[' 122 = 64 ']'
+ '[' 122 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 122'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 4 'inherit 0xa8' 'inherit 122' true
│    gre │     6 │     4 │ inherit 0xa8 │  inherit 122 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev vlan99-0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev vlan99-1
+ verify 6 4 inherit true
+ local outer=6
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' inherit = inherit ']'
+ ping_pid=512065
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' 4 = 4 ']'
+ local req_proto_offset=75
+ local req_offset=86
+ '[' gre = vxlan ']'
+ ping -i 0.1 198.19.0.2 -Q 0xa8 -t 122
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=79
+ req_offset=90
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[79]' = 0x01 and 'ip6[90]' = 0x08
++ head -n 1
+ out='01:50:29.655928 IP6 (class 0xa8, flowlabel 0xb9664, hlim 122, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
+ kill -9 512065
+ wait 512065
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:29.655928 IP6 (class 0xa8, flowlabel 0xb9664, hlim 122, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
++ local field=hlim
++ local 'input=01:50:29.655928 IP6 (class 0xa8, flowlabel 0xb9664, hlim 122, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
++ local found=false
+++ echo '01:50:29.655928 IP6 (class 0xa8, flowlabel 0xb9664, hlim 122, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
+++ tr -d '(),'
++ input='01:50:29.655928 IP6 class 0xa8 flowlabel 0xb9664 hlim 122 next-header unknown 60 payload length: 114 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 106'
++ for input_field in $input
++ false
++ '[' 01:50:29.655928 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xa8 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xb9664 = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 122
++ return
+ captured_ttl=122
+++ get_field class '01:50:29.655928 IP6 (class 0xa8, flowlabel 0xb9664, hlim 122, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
+++ local field=class
+++ local 'input=01:50:29.655928 IP6 (class 0xa8, flowlabel 0xb9664, hlim 122, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
+++ local found=false
++++ echo '01:50:29.655928 IP6 (class 0xa8, flowlabel 0xb9664, hlim 122, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
++++ tr -d '(),'
+++ input='01:50:29.655928 IP6 class 0xa8 flowlabel 0xb9664 hlim 122 next-header unknown 60 payload length: 114 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 106'
+++ for input_field in $input
+++ false
+++ '[' 01:50:29.655928 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0xa8
+++ return
++ printf 0x%02x 0xa8
+ captured_tos=0xa8
+ '[' 0xa8 = 0xa8 ']'
+ '[' 122 = 122 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 6 4 random false
+ local type=gre
+ local outer=6
+ local inner=4
+ local tos_ttl=random
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x40
+ expected_tos=0x40
+ '[' 0x40 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0x40
+ tos='fixed 0x40'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x59
+ expected_ttl=89
+ '[' 89 = 64 ']'
+ '[' 89 = 0 ']'
+ '[' random = random ']'
+ test_ttl=89
+ ttl='fixed 89'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 4 'fixed 0x40' 'fixed 89' false
│    gre │     6 │     4 │   fixed 0x40 │     fixed 89 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos 0x40 ttl 89
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos 0x40 ttl 89
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 6 4 random false
+ local outer=6
+ local inner=4
+ local tos_ttl=random
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' random = inherit ']'
+ ping_pid=512161
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ ping -i 0.1 198.19.0.2
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' 4 = 4 ']'
+ local req_proto_offset=75
+ local req_offset=86
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[75]' = 0x01 and 'ip6[86]' = 0x08
++ head -n 1
+ out='01:50:32.788186 IP6 (class 0x40, flowlabel 0xb9664, hlim 89, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
+ kill -9 512161
+ wait 512161
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:32.788186 IP6 (class 0x40, flowlabel 0xb9664, hlim 89, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
++ local field=hlim
++ local 'input=01:50:32.788186 IP6 (class 0x40, flowlabel 0xb9664, hlim 89, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
++ local found=false
+++ echo '01:50:32.788186 IP6 (class 0x40, flowlabel 0xb9664, hlim 89, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
+++ tr -d '(),'
++ input='01:50:32.788186 IP6 class 0x40 flowlabel 0xb9664 hlim 89 next-header unknown 60 payload length: 110 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 102'
++ for input_field in $input
++ false
++ '[' 01:50:32.788186 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x40 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xb9664 = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 89
++ return
+ captured_ttl=89
+++ get_field class '01:50:32.788186 IP6 (class 0x40, flowlabel 0xb9664, hlim 89, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
+++ local field=class
+++ local 'input=01:50:32.788186 IP6 (class 0x40, flowlabel 0xb9664, hlim 89, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
+++ local found=false
++++ echo '01:50:32.788186 IP6 (class 0x40, flowlabel 0xb9664, hlim 89, next-header unknown (60) payload length: 110) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 102'
++++ tr -d '(),'
+++ input='01:50:32.788186 IP6 class 0x40 flowlabel 0xb9664 hlim 89 next-header unknown 60 payload length: 110 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 102'
+++ for input_field in $input
+++ false
+++ '[' 01:50:32.788186 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x40
+++ return
++ printf 0x%02x 0x40
+ captured_tos=0x40
+ '[' 0x40 = 0x40 ']'
+ '[' 89 = 89 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 6 4 random true
+ local type=gre
+ local outer=6
+ local inner=4
+ local tos_ttl=random
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x88
+ expected_tos=0x88
+ '[' 0x88 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0x88
+ tos='fixed 0x88'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x32
+ expected_ttl=50
+ '[' 50 = 64 ']'
+ '[' 50 = 0 ']'
+ '[' random = random ']'
+ test_ttl=50
+ ttl='fixed 50'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 4 'fixed 0x88' 'fixed 50' true
│    gre │     6 │     4 │   fixed 0x88 │     fixed 50 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos 0x88 ttl 50
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos 0x88 ttl 50
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev vlan99-0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev vlan99-1
+ verify 6 4 random true
+ local outer=6
+ local inner=4
+ local tos_ttl=random
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' random = inherit ']'
+ ping_pid=512268
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' 4 = 4 ']'
+ local req_proto_offset=75
+ local req_offset=86
+ '[' gre = vxlan ']'
+ ping -i 0.1 198.19.0.2
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=79
+ req_offset=90
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[79]' = 0x01 and 'ip6[90]' = 0x08
++ head -n 1
+ out='01:50:35.155990 IP6 (class 0x88, flowlabel 0xb9664, hlim 50, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
+ kill -9 512268
+ wait 512268
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:35.155990 IP6 (class 0x88, flowlabel 0xb9664, hlim 50, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
++ local field=hlim
++ local 'input=01:50:35.155990 IP6 (class 0x88, flowlabel 0xb9664, hlim 50, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
++ local found=false
+++ echo '01:50:35.155990 IP6 (class 0x88, flowlabel 0xb9664, hlim 50, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
+++ tr -d '(),'
++ input='01:50:35.155990 IP6 class 0x88 flowlabel 0xb9664 hlim 50 next-header unknown 60 payload length: 114 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 106'
++ for input_field in $input
++ false
++ '[' 01:50:35.155990 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x88 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xb9664 = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 50
++ return
+ captured_ttl=50
+++ get_field class '01:50:35.155990 IP6 (class 0x88, flowlabel 0xb9664, hlim 50, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
+++ local field=class
+++ local 'input=01:50:35.155990 IP6 (class 0x88, flowlabel 0xb9664, hlim 50, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
+++ local found=false
++++ echo '01:50:35.155990 IP6 (class 0x88, flowlabel 0xb9664, hlim 50, next-header unknown (60) payload length: 114) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 106'
++++ tr -d '(),'
+++ input='01:50:35.155990 IP6 class 0x88 flowlabel 0xb9664 hlim 50 next-header unknown 60 payload length: 114 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 106'
+++ for input_field in $input
+++ false
+++ '[' 01:50:35.155990 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x88
+++ return
++ printf 0x%02x 0x88
+ captured_tos=0x88
+ '[' 0x88 = 0x88 ']'
+ '[' 50 = 50 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for inner in 4 6 other
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 6 6 inherit false
+ local type=gre
+ local outer=6
+ local inner=6
+ local tos_ttl=inherit
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x00
+ expected_tos=0x00
+ '[' 0x00 = 0x00 ']'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xd8
+ expected_tos=0xd8
+ '[' 0xd8 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0xd8'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x27
+ expected_ttl=39
+ '[' 39 = 64 ']'
+ '[' 39 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 39'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 6 'inherit 0xd8' 'inherit 39' false
│    gre │     6 │     6 │ inherit 0xd8 │   inherit 39 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 6 = 4 ']'
+ '[' 6 = other ']'
+ '[' 6 = 6 ']'
+ ip addr add fdd4:96cf:4eae:443b::1/64 dev tep0
+ ip netns exec testing ip addr add fdd4:96cf:4eae:443b::2/64 dev tep1
+ verify 6 6 inherit false
+ local outer=6
+ local inner=6
+ local tos_ttl=inherit
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping_dst=fdd4:96cf:4eae:443b::2
+ '[' inherit = inherit ']'
+ ping_pid=512373
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local req_proto_offset=72
+ local req_offset=106
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
+ ping -i 0.1 fdd4:96cf:4eae:443b::2 -Q 0xd8 -t 39
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[72]' = 0x3a and 'ip6[106]' = 0x80
++ head -n 1
+ out='01:50:38.548194 IP6 (class 0xd8, flowlabel 0x921dd, hlim 39, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
+ kill -9 512373
+ wait 512373
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:38.548194 IP6 (class 0xd8, flowlabel 0x921dd, hlim 39, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
++ local field=hlim
++ local 'input=01:50:38.548194 IP6 (class 0xd8, flowlabel 0x921dd, hlim 39, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
++ local found=false
+++ echo '01:50:38.548194 IP6 (class 0xd8, flowlabel 0x921dd, hlim 39, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
+++ tr -d '(),'
++ input='01:50:38.548194 IP6 class 0xd8 flowlabel 0x921dd hlim 39 next-header unknown 60 payload length: 130 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 122'
++ for input_field in $input
++ false
++ '[' 01:50:38.548194 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xd8 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x921dd = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 39
++ return
+ captured_ttl=39
+++ get_field class '01:50:38.548194 IP6 (class 0xd8, flowlabel 0x921dd, hlim 39, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
+++ local field=class
+++ local 'input=01:50:38.548194 IP6 (class 0xd8, flowlabel 0x921dd, hlim 39, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
+++ local found=false
++++ echo '01:50:38.548194 IP6 (class 0xd8, flowlabel 0x921dd, hlim 39, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
++++ tr -d '(),'
+++ input='01:50:38.548194 IP6 class 0xd8 flowlabel 0x921dd hlim 39 next-header unknown 60 payload length: 130 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 122'
+++ for input_field in $input
+++ false
+++ '[' 01:50:38.548194 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0xd8
+++ return
++ printf 0x%02x 0xd8
+ captured_tos=0xd8
+ '[' 0xd8 = 0xd8 ']'
+ '[' 39 = 39 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 6 6 inherit true
+ local type=gre
+ local outer=6
+ local inner=6
+ local tos_ttl=inherit
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x30
+ expected_tos=0x30
+ '[' 0x30 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0x30'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x8b
+ expected_ttl=139
+ '[' 139 = 64 ']'
+ '[' 139 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 139'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 6 'inherit 0x30' 'inherit 139' true
│    gre │     6 │     6 │ inherit 0x30 │  inherit 139 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' 6 = 4 ']'
+ '[' 6 = other ']'
+ '[' 6 = 6 ']'
+ ip addr add fdd4:96cf:4eae:443b::1/64 dev vlan99-0
+ ip netns exec testing ip addr add fdd4:96cf:4eae:443b::2/64 dev vlan99-1
+ verify 6 6 inherit true
+ local outer=6
+ local inner=6
+ local tos_ttl=inherit
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping_dst=fdd4:96cf:4eae:443b::2
+ '[' inherit = inherit ']'
+ ping_pid=512529
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local req_proto_offset=72
+ local req_offset=106
+ ping -i 0.1 fdd4:96cf:4eae:443b::2 -Q 0x30 -t 139
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=76
+ req_offset=110
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[76]' = 0x3a and 'ip6[110]' = 0x80
++ head -n 1
+ out='01:50:42.008070 IP6 (class 0x30, flowlabel 0x921dd, hlim 139, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
+ kill -9 512529
+ wait 512529
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:42.008070 IP6 (class 0x30, flowlabel 0x921dd, hlim 139, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
++ local field=hlim
++ local 'input=01:50:42.008070 IP6 (class 0x30, flowlabel 0x921dd, hlim 139, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
++ local found=false
+++ echo '01:50:42.008070 IP6 (class 0x30, flowlabel 0x921dd, hlim 139, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
+++ tr -d '(),'
++ input='01:50:42.008070 IP6 class 0x30 flowlabel 0x921dd hlim 139 next-header unknown 60 payload length: 134 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 126'
++ for input_field in $input
++ false
++ '[' 01:50:42.008070 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x30 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x921dd = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 139
++ return
+ captured_ttl=139
+++ get_field class '01:50:42.008070 IP6 (class 0x30, flowlabel 0x921dd, hlim 139, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
+++ local field=class
+++ local 'input=01:50:42.008070 IP6 (class 0x30, flowlabel 0x921dd, hlim 139, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
+++ local found=false
++++ echo '01:50:42.008070 IP6 (class 0x30, flowlabel 0x921dd, hlim 139, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
++++ tr -d '(),'
+++ input='01:50:42.008070 IP6 class 0x30 flowlabel 0x921dd hlim 139 next-header unknown 60 payload length: 134 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 126'
+++ for input_field in $input
+++ false
+++ '[' 01:50:42.008070 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x30
+++ return
++ printf 0x%02x 0x30
+ captured_tos=0x30
+ '[' 0x30 = 0x30 ']'
+ '[' 139 = 139 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 6 6 random false
+ local type=gre
+ local outer=6
+ local inner=6
+ local tos_ttl=random
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x30
+ expected_tos=0x30
+ '[' 0x30 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0x30
+ tos='fixed 0x30'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0xf8
+ expected_ttl=248
+ '[' 248 = 64 ']'
+ '[' 248 = 0 ']'
+ '[' random = random ']'
+ test_ttl=248
+ ttl='fixed 248'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 6 'fixed 0x30' 'fixed 248' false
│    gre │     6 │     6 │   fixed 0x30 │    fixed 248 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos 0x30 ttl 248
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos 0x30 ttl 248
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 6 = 4 ']'
+ '[' 6 = other ']'
+ '[' 6 = 6 ']'
+ ip addr add fdd4:96cf:4eae:443b::1/64 dev tep0
+ ip netns exec testing ip addr add fdd4:96cf:4eae:443b::2/64 dev tep1
+ verify 6 6 random false
+ local outer=6
+ local inner=6
+ local tos_ttl=random
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping_dst=fdd4:96cf:4eae:443b::2
+ '[' random = inherit ']'
+ ping_pid=512630
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local req_proto_offset=72
+ ping -i 0.1 fdd4:96cf:4eae:443b::2
+ local req_offset=106
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[72]' = 0x3a and 'ip6[106]' = 0x80
++ head -n 1
+ out='01:50:45.396137 IP6 (class 0x30, flowlabel 0x921dd, hlim 248, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
+ kill -9 512630
+ wait 512630
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:45.396137 IP6 (class 0x30, flowlabel 0x921dd, hlim 248, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
++ local field=hlim
++ local 'input=01:50:45.396137 IP6 (class 0x30, flowlabel 0x921dd, hlim 248, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
++ local found=false
+++ echo '01:50:45.396137 IP6 (class 0x30, flowlabel 0x921dd, hlim 248, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
+++ tr -d '(),'
++ input='01:50:45.396137 IP6 class 0x30 flowlabel 0x921dd hlim 248 next-header unknown 60 payload length: 130 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 122'
++ for input_field in $input
++ false
++ '[' 01:50:45.396137 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x30 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x921dd = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 248
++ return
+ captured_ttl=248
+++ get_field class '01:50:45.396137 IP6 (class 0x30, flowlabel 0x921dd, hlim 248, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
+++ local field=class
+++ local 'input=01:50:45.396137 IP6 (class 0x30, flowlabel 0x921dd, hlim 248, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
+++ local found=false
++++ echo '01:50:45.396137 IP6 (class 0x30, flowlabel 0x921dd, hlim 248, next-header unknown (60) payload length: 130) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 122'
++++ tr -d '(),'
+++ input='01:50:45.396137 IP6 class 0x30 flowlabel 0x921dd hlim 248 next-header unknown 60 payload length: 130 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 122'
+++ for input_field in $input
+++ false
+++ '[' 01:50:45.396137 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0x30
+++ return
++ printf 0x%02x 0x30
+ captured_tos=0x30
+ '[' 0x30 = 0x30 ']'
+ '[' 248 = 248 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 6 6 random true
+ local type=gre
+ local outer=6
+ local inner=6
+ local tos_ttl=random
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xf0
+ expected_tos=0xf0
+ '[' 0xf0 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0xf0
+ tos='fixed 0xf0'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x7e
+ expected_ttl=126
+ '[' 126 = 64 ']'
+ '[' 126 = 0 ']'
+ '[' random = random ']'
+ test_ttl=126
+ ttl='fixed 126'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 6 'fixed 0xf0' 'fixed 126' true
│    gre │     6 │     6 │   fixed 0xf0 │    fixed 126 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos 0xf0 ttl 126
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos 0xf0 ttl 126
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' 6 = 4 ']'
+ '[' 6 = other ']'
+ '[' 6 = 6 ']'
+ ip addr add fdd4:96cf:4eae:443b::1/64 dev vlan99-0
+ ip netns exec testing ip addr add fdd4:96cf:4eae:443b::2/64 dev vlan99-1
+ verify 6 6 random true
+ local outer=6
+ local inner=6
+ local tos_ttl=random
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping_dst=fdd4:96cf:4eae:443b::2
+ '[' random = inherit ']'
+ ping_pid=512740
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local req_proto_offset=72
+ local req_offset=106
+ ping -i 0.1 fdd4:96cf:4eae:443b::2
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=76
+ req_offset=110
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[76]' = 0x3a and 'ip6[110]' = 0x80
++ head -n 1
+ out='01:50:48.820117 IP6 (class 0xf0, flowlabel 0x921dd, hlim 126, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
+ kill -9 512740
+ wait 512740
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:48.820117 IP6 (class 0xf0, flowlabel 0x921dd, hlim 126, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
++ local field=hlim
++ local 'input=01:50:48.820117 IP6 (class 0xf0, flowlabel 0x921dd, hlim 126, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
++ local found=false
+++ echo '01:50:48.820117 IP6 (class 0xf0, flowlabel 0x921dd, hlim 126, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
+++ tr -d '(),'
++ input='01:50:48.820117 IP6 class 0xf0 flowlabel 0x921dd hlim 126 next-header unknown 60 payload length: 134 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 126'
++ for input_field in $input
++ false
++ '[' 01:50:48.820117 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xf0 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0x921dd = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 126
++ return
+ captured_ttl=126
+++ get_field class '01:50:48.820117 IP6 (class 0xf0, flowlabel 0x921dd, hlim 126, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
+++ local field=class
+++ local 'input=01:50:48.820117 IP6 (class 0xf0, flowlabel 0x921dd, hlim 126, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
+++ local found=false
++++ echo '01:50:48.820117 IP6 (class 0xf0, flowlabel 0x921dd, hlim 126, next-header unknown (60) payload length: 134) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 126'
++++ tr -d '(),'
+++ input='01:50:48.820117 IP6 class 0xf0 flowlabel 0x921dd hlim 126 next-header unknown 60 payload length: 134 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 126'
+++ for input_field in $input
+++ false
+++ '[' 01:50:48.820117 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0xf0
+++ return
++ printf 0x%02x 0xf0
+ captured_tos=0xf0
+ '[' 0xf0 = 0xf0 ']'
+ '[' 126 = 126 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for inner in 4 6 other
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 6 other inherit false
+ local type=gre
+ local outer=6
+ local inner=other
+ local tos_ttl=inherit
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0x74
+ expected_tos=0x74
+ '[' 0x74 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0x74'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x87
+ expected_ttl=135
+ '[' 135 = 64 ']'
+ '[' 135 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 135'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 other 'inherit 0x74' 'inherit 135' false
│    gre │     6 │ other │ inherit 0x74 │  inherit 135 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' other = 4 ']'
+ '[' other = other ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 6 other inherit false
+ local outer=6
+ local inner=other
+ local tos_ttl=inherit
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ ping_dst=198.19.0.3
+ '[' inherit = inherit ']'
+ ping_pid=512842
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ local req_proto_offset=64
+ ping -i 0.1 198.19.0.3 -Q 0x74 -t 135
+ local req_offset=73
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
+ '[' inherit = inherit ']'
+ expected_tos=0x00
+ expected_ttl=64
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[64]' = 0x08 and 'ip6[65]' = 0x06 and 'ip6[73]' = 0x01
++ head -n 1
+ out='01:50:51.219827 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
+ kill -9 512842
+ wait 512842
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:51.219827 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
++ local field=hlim
++ local 'input=01:50:51.219827 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
++ local found=false
+++ echo '01:50:51.219827 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
+++ tr -d '(),'
++ input='01:50:51.219827 IP6 flowlabel 0xb9664 hlim 64 next-header unknown 60 payload length: 54 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 46'
++ for input_field in $input
++ false
++ '[' 01:50:51.219827 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xb9664 = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 64
++ return
+ captured_ttl=64
+++ get_field class '01:50:51.219827 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
+++ local field=class
+++ local 'input=01:50:51.219827 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
+++ local found=false
++++ echo '01:50:51.219827 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
++++ tr -d '(),'
+++ input='01:50:51.219827 IP6 flowlabel 0xb9664 hlim 64 next-header unknown 60 payload length: 54 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 46'
+++ for input_field in $input
+++ false
+++ '[' 01:50:51.219827 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' flowlabel = class ']'
+++ for input_field in $input
+++ false
+++ '[' 0xb9664 = class ']'
+++ for input_field in $input
+++ false
+++ '[' hlim = class ']'
+++ for input_field in $input
+++ false
+++ '[' 64 = class ']'
+++ for input_field in $input
+++ false
+++ '[' next-header = class ']'
+++ for input_field in $input
+++ false
+++ '[' unknown = class ']'
+++ for input_field in $input
+++ false
+++ '[' 60 = class ']'
+++ for input_field in $input
+++ false
+++ '[' payload = class ']'
+++ for input_field in $input
+++ false
+++ '[' length: = class ']'
+++ for input_field in $input
+++ false
+++ '[' 54 = class ']'
+++ for input_field in $input
+++ false
+++ '[' fdd1:ced0:5d88:3fce::1 = class ']'
+++ for input_field in $input
+++ false
+++ '[' '>' = class ']'
+++ for input_field in $input
+++ false
+++ '[' fdd1:ced0:5d88:3fce::2: = class ']'
+++ for input_field in $input
+++ false
+++ '[' DSTOPT = class ']'
+++ for input_field in $input
+++ false
+++ '[' opt_type = class ']'
+++ for input_field in $input
+++ false
+++ '[' 0x04: = class ']'
+++ for input_field in $input
+++ false
+++ '[' len=1padn = class ']'
+++ for input_field in $input
+++ false
+++ '[' GREv0 = class ']'
+++ for input_field in $input
+++ false
+++ '[' Flags = class ']'
+++ for input_field in $input
+++ false
+++ '[' '[none]' = class ']'
+++ for input_field in $input
+++ false
+++ '[' length = class ']'
+++ for input_field in $input
+++ false
+++ '[' 46 = class ']'
+++ echo 0
++ printf 0x%02x 0
+ captured_tos=0x00
+ '[' 0x00 = 0x00 ']'
+ '[' 64 = 64 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 6 other inherit true
+ local type=gre
+ local outer=6
+ local inner=other
+ local tos_ttl=inherit
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xa4
+ expected_tos=0xa4
+ '[' 0xa4 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0xa4'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0xa1
+ expected_ttl=161
+ '[' 161 = 64 ']'
+ '[' 161 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 161'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 other 'inherit 0xa4' 'inherit 161' true
│    gre │     6 │ other │ inherit 0xa4 │  inherit 161 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos inherit ttl inherit
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos inherit ttl inherit
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' other = 4 ']'
+ '[' other = other ']'
+ ip addr add 198.19.0.1/24 brd + dev vlan99-0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev vlan99-1
+ verify 6 other inherit true
+ local outer=6
+ local inner=other
+ local tos_ttl=inherit
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ ping_dst=198.19.0.3
+ '[' inherit = inherit ']'
+ ping_pid=512996
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ ping -i 0.1 198.19.0.3 -Q 0xa4 -t 161
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ local req_proto_offset=64
+ local req_offset=73
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=68
+ req_offset=77
+ '[' inherit = inherit ']'
+ expected_tos=0x00
+ expected_ttl=64
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[68]' = 0x08 and 'ip6[69]' = 0x06 and 'ip6[77]' = 0x01
++ head -n 1
+ out='01:50:53.652113 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
+ kill -9 512996
+ wait 512996
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:53.652113 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
++ local field=hlim
++ local 'input=01:50:53.652113 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
++ local found=false
+++ echo '01:50:53.652113 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
+++ tr -d '(),'
++ input='01:50:53.652113 IP6 flowlabel 0xb9664 hlim 64 next-header unknown 60 payload length: 58 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 50'
++ for input_field in $input
++ false
++ '[' 01:50:53.652113 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xb9664 = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 64
++ return
+ captured_ttl=64
+++ get_field class '01:50:53.652113 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
+++ local field=class
+++ local 'input=01:50:53.652113 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
+++ local found=false
++++ echo '01:50:53.652113 IP6 (flowlabel 0xb9664, hlim 64, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
++++ tr -d '(),'
+++ input='01:50:53.652113 IP6 flowlabel 0xb9664 hlim 64 next-header unknown 60 payload length: 58 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 50'
+++ for input_field in $input
+++ false
+++ '[' 01:50:53.652113 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' flowlabel = class ']'
+++ for input_field in $input
+++ false
+++ '[' 0xb9664 = class ']'
+++ for input_field in $input
+++ false
+++ '[' hlim = class ']'
+++ for input_field in $input
+++ false
+++ '[' 64 = class ']'
+++ for input_field in $input
+++ false
+++ '[' next-header = class ']'
+++ for input_field in $input
+++ false
+++ '[' unknown = class ']'
+++ for input_field in $input
+++ false
+++ '[' 60 = class ']'
+++ for input_field in $input
+++ false
+++ '[' payload = class ']'
+++ for input_field in $input
+++ false
+++ '[' length: = class ']'
+++ for input_field in $input
+++ false
+++ '[' 58 = class ']'
+++ for input_field in $input
+++ false
+++ '[' fdd1:ced0:5d88:3fce::1 = class ']'
+++ for input_field in $input
+++ false
+++ '[' '>' = class ']'
+++ for input_field in $input
+++ false
+++ '[' fdd1:ced0:5d88:3fce::2: = class ']'
+++ for input_field in $input
+++ false
+++ '[' DSTOPT = class ']'
+++ for input_field in $input
+++ false
+++ '[' opt_type = class ']'
+++ for input_field in $input
+++ false
+++ '[' 0x04: = class ']'
+++ for input_field in $input
+++ false
+++ '[' len=1padn = class ']'
+++ for input_field in $input
+++ false
+++ '[' GREv0 = class ']'
+++ for input_field in $input
+++ false
+++ '[' Flags = class ']'
+++ for input_field in $input
+++ false
+++ '[' '[none]' = class ']'
+++ for input_field in $input
+++ false
+++ '[' length = class ']'
+++ for input_field in $input
+++ false
+++ '[' 50 = class ']'
+++ echo 0
++ printf 0x%02x 0
+ captured_tos=0x00
+ '[' 0x00 = 0x00 ']'
+ '[' 64 = 64 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup gre 6 other random false
+ local type=gre
+ local outer=6
+ local inner=other
+ local tos_ttl=random
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xdc
+ expected_tos=0xdc
+ '[' 0xdc = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0xdc
+ tos='fixed 0xdc'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x29
+ expected_ttl=41
+ '[' 41 = 64 ']'
+ '[' 41 = 0 ']'
+ '[' random = random ']'
+ test_ttl=41
+ ttl='fixed 41'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 other 'fixed 0xdc' 'fixed 41' false
│    gre │     6 │ other │   fixed 0xdc │     fixed 41 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos 0xdc ttl 41
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos 0xdc ttl 41
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' other = 4 ']'
+ '[' other = other ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 6 other random false
+ local outer=6
+ local inner=other
+ local tos_ttl=random
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ ping_dst=198.19.0.3
+ '[' random = inherit ']'
+ ping_pid=513093
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ local req_proto_offset=64
+ local req_offset=73
+ ping -i 0.1 198.19.0.3
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ false
+ '[' random = inherit ']'
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[64]' = 0x08 and 'ip6[65]' = 0x06 and 'ip6[73]' = 0x01
++ head -n 1
+ out='01:50:56.084022 IP6 (class 0xdc, flowlabel 0xb9664, hlim 41, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
+ kill -9 513093
+ wait 513093
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:56.084022 IP6 (class 0xdc, flowlabel 0xb9664, hlim 41, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
++ local field=hlim
++ local 'input=01:50:56.084022 IP6 (class 0xdc, flowlabel 0xb9664, hlim 41, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
++ local found=false
+++ echo '01:50:56.084022 IP6 (class 0xdc, flowlabel 0xb9664, hlim 41, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
+++ tr -d '(),'
++ input='01:50:56.084022 IP6 class 0xdc flowlabel 0xb9664 hlim 41 next-header unknown 60 payload length: 54 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 46'
++ for input_field in $input
++ false
++ '[' 01:50:56.084022 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xdc = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xb9664 = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 41
++ return
+ captured_ttl=41
+++ get_field class '01:50:56.084022 IP6 (class 0xdc, flowlabel 0xb9664, hlim 41, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
+++ local field=class
+++ local 'input=01:50:56.084022 IP6 (class 0xdc, flowlabel 0xb9664, hlim 41, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
+++ local found=false
++++ echo '01:50:56.084022 IP6 (class 0xdc, flowlabel 0xb9664, hlim 41, next-header unknown (60) payload length: 54) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 46'
++++ tr -d '(),'
+++ input='01:50:56.084022 IP6 class 0xdc flowlabel 0xb9664 hlim 41 next-header unknown 60 payload length: 54 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 46'
+++ for input_field in $input
+++ false
+++ '[' 01:50:56.084022 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0xdc
+++ return
++ printf 0x%02x 0xdc
+ captured_tos=0xdc
+ '[' 0xdc = 0xdc ']'
+ '[' 41 = 41 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for vlan in false true
+ setup gre 6 other random true
+ local type=gre
+ local outer=6
+ local inner=other
+ local tos_ttl=random
+ local vlan=true
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xd8
+ expected_tos=0xd8
+ '[' 0xd8 = 0x00 ']'
+ '[' random = random ']'
+ test_tos=0xd8
+ tos='fixed 0xd8'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0x8e
+ expected_ttl=142
+ '[' 142 = 64 ']'
+ '[' 142 = 0 ']'
+ '[' random = random ']'
+ test_ttl=142
+ ttl='fixed 142'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' gre 6 other 'fixed 0xd8' 'fixed 142' true
│    gre │     6 │ other │   fixed 0xd8 │    fixed 142 │  true │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' gre = gre ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ local_addr1='local fdd1:ced0:5d88:3fce::1'
+ local_addr2='local fdd1:ced0:5d88:3fce::2'
+ local vxlan=
+ '[' gre = vxlan ']'
+ local geneve=
+ '[' gre = geneve ']'
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ type=ip6gretap
+ ip addr add fdd1:ced0:5d88:3fce::1/64 dev veth0
+ ip netns exec testing ip addr add fdd1:ced0:5d88:3fce::2/64 dev veth1
+ ip link add name tep0 type ip6gretap local fdd1:ced0:5d88:3fce::1 remote fdd1:ced0:5d88:3fce::2 tos 0xd8 ttl 142
+ ip netns exec testing ip link add name tep1 type ip6gretap local fdd1:ced0:5d88:3fce::2 remote fdd1:ced0:5d88:3fce::1 tos 0xd8 ttl 142
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ true
+ parent=vlan99-
+ ip link add link tep0 name vlan99-0 type vlan id 99
+ ip netns exec testing ip link add link tep1 name vlan99-1 type vlan id 99
+ ip link set vlan99-0 up
+ ip netns exec testing ip link set vlan99-1 up
+ ip addr flush dev vlan99-0
+ ip netns exec testing ip addr flush dev vlan99-1
+ '[' other = 4 ']'
+ '[' other = other ']'
+ ip addr add 198.19.0.1/24 brd + dev vlan99-0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev vlan99-1
+ verify 6 other random true
+ local outer=6
+ local inner=other
+ local tos_ttl=random
+ local vlan=true
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' other = 4 ']'
+ '[' other = 6 ']'
+ '[' other = other ']'
+ ping_dst=198.19.0.3
+ '[' random = inherit ']'
+ ping_pid=513233
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' gre = gre ']'
+ tunnel_type_proto=0x2f
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
+ '[' gre = gre ']'
+ tunnel_type_offset=40
+ '[' other = 4 ']'
+ ping -i 0.1 198.19.0.3
+ '[' other = 6 ']'
+ '[' other = other ']'
+ local req_proto_offset=64
+ local req_offset=73
+ '[' gre = vxlan ']'
+ '[' gre = geneve ']'
+ true
+ req_proto_offset=68
+ req_offset=77
+ '[' random = inherit ']'
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip6[40]' = 0x2f and 'ip6[68]' = 0x08 and 'ip6[69]' = 0x06 and 'ip6[77]' = 0x01
++ head -n 1
+ out='01:50:58.547986 IP6 (class 0xd8, flowlabel 0xb9664, hlim 142, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
+ kill -9 513233
+ wait 513233
+ result=FAIL
+ '[' 6 = 4 ']'
+ '[' 6 = 6 ']'
++ get_field hlim '01:50:58.547986 IP6 (class 0xd8, flowlabel 0xb9664, hlim 142, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
++ local field=hlim
++ local 'input=01:50:58.547986 IP6 (class 0xd8, flowlabel 0xb9664, hlim 142, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
++ local found=false
+++ echo '01:50:58.547986 IP6 (class 0xd8, flowlabel 0xb9664, hlim 142, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
+++ tr -d '(),'
++ input='01:50:58.547986 IP6 class 0xd8 flowlabel 0xb9664 hlim 142 next-header unknown 60 payload length: 58 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 50'
++ for input_field in $input
++ false
++ '[' 01:50:58.547986 = hlim ']'
++ for input_field in $input
++ false
++ '[' IP6 = hlim ']'
++ for input_field in $input
++ false
++ '[' class = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xd8 = hlim ']'
++ for input_field in $input
++ false
++ '[' flowlabel = hlim ']'
++ for input_field in $input
++ false
++ '[' 0xb9664 = hlim ']'
++ for input_field in $input
++ false
++ '[' hlim = hlim ']'
++ found=true
++ for input_field in $input
++ true
++ echo 142
++ return
+ captured_ttl=142
+++ get_field class '01:50:58.547986 IP6 (class 0xd8, flowlabel 0xb9664, hlim 142, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
+++ local field=class
+++ local 'input=01:50:58.547986 IP6 (class 0xd8, flowlabel 0xb9664, hlim 142, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
+++ local found=false
++++ echo '01:50:58.547986 IP6 (class 0xd8, flowlabel 0xb9664, hlim 142, next-header unknown (60) payload length: 58) fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT (opt_type 0x04: len=1)(padn) GREv0, Flags [none], length 50'
++++ tr -d '(),'
+++ input='01:50:58.547986 IP6 class 0xd8 flowlabel 0xb9664 hlim 142 next-header unknown 60 payload length: 58 fdd1:ced0:5d88:3fce::1 > fdd1:ced0:5d88:3fce::2: DSTOPT opt_type 0x04: len=1padn GREv0 Flags [none] length 50'
+++ for input_field in $input
+++ false
+++ '[' 01:50:58.547986 = class ']'
+++ for input_field in $input
+++ false
+++ '[' IP6 = class ']'
+++ for input_field in $input
+++ false
+++ '[' class = class ']'
+++ found=true
+++ for input_field in $input
+++ true
+++ echo 0xd8
+++ return
++ printf 0x%02x 0xd8
+ captured_tos=0xd8
+ '[' 0xd8 = 0xd8 ']'
+ '[' 142 = 142 ']'
+ result=OK
+ printf '%7s │\n' OK
     OK │
+ '[' OK = FAIL ']'
+ cleanup
+ ip link del veth0
+ ip netns del testing
+ ip link del tep0
+ for type in gre vxlan geneve
++ modprobe vxlan
+ for outer in 4 6
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ printf '│  Type  │ outer | inner │     tos      │'
│  Type  │ outer | inner │     tos      │+ printf '      ttl     │  vlan │ result │\n'
      ttl     │  vlan │ result │
+ for inner in 4 6 other
+ printf ├────────┼───────┼───────┼──────────────┼
├────────┼───────┼───────┼──────────────┼+ printf '──────────────┼───────┼────────┤\n'
──────────────┼───────┼────────┤
+ for tos_ttl in inherit random
+ for vlan in false true
+ setup vxlan 4 4 inherit false
+ local type=vxlan
+ local outer=4
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=false
+ local test_tos=0x00
+ local test_ttl=0
+ local 'ns=ip netns exec testing'
++ get_random_tos
+++ tr -dc 0-9a-f
+++ head -c 1
+++ tr -dc 048c
+++ head -c 1
++ echo 0xc8
+ expected_tos=0xc8
+ '[' 0xc8 = 0x00 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_tos=inherit
+ tos='inherit 0xc8'
++ get_random_ttl
+++ tr -dc 0-9a-f
+++ head -c 2
++ printf %d 0xa0
+ expected_ttl=160
+ '[' 160 = 64 ']'
+ '[' 160 = 0 ']'
+ '[' inherit = random ']'
+ '[' inherit = inherit ']'
+ test_ttl=inherit
+ ttl='inherit 160'
+ printf '│%7s │%6s │%6s │%13s │%13s │%6s │' vxlan 4 4 'inherit 0xc8' 'inherit 160' false
│  vxlan │     4 │     4 │ inherit 0xc8 │  inherit 160 │ false │+ ip netns add testing
+ ip link add type veth
+ ip link set veth1 netns testing
+ ip link set veth0 up
+ ip netns exec testing ip link set veth1 up
+ ip addr flush dev veth0
+ ip netns exec testing ip addr flush dev veth1
+ local local_addr1=
+ local local_addr2=
+ '[' vxlan = gre ']'
+ '[' vxlan = vxlan ']'
+ '[' 4 = 4 ']'
+ local_addr1='local 198.18.0.1'
+ local_addr2='local 198.18.0.2'
+ local vxlan=
+ '[' vxlan = vxlan ']'
+ vxlan='vni 100 dstport 4789'
+ local geneve=
+ '[' vxlan = geneve ']'
+ '[' 4 = 4 ']'
+ '[' vxlan = gre ']'
+ ip addr add 198.18.0.1/24 dev veth0
+ ip netns exec testing ip addr add 198.18.0.2/24 dev veth1
+ ip link add name tep0 type vxlan local 198.18.0.1 remote 198.18.0.2 tos inherit ttl inherit vni 100 dstport 4789
+ ip netns exec testing ip link add name tep1 type vxlan local 198.18.0.2 remote 198.18.0.1 tos inherit ttl inherit vni 100 dstport 4789
+ ip link set tep0 up
+ ip netns exec testing ip link set tep1 up
+ ip addr flush dev tep0
+ ip netns exec testing ip addr flush dev tep1
+ local parent
+ false
+ parent=tep
+ '[' 4 = 4 ']'
+ ip addr add 198.19.0.1/24 brd + dev tep0
+ ip netns exec testing ip addr add 198.19.0.2/24 brd + dev tep1
+ verify 4 4 inherit false
+ local outer=4
+ local inner=4
+ local tos_ttl=inherit
+ local vlan=false
+ local ping_pid out captured_tos captured_ttl result
+ local ping_dst
+ '[' 4 = 4 ']'
+ ping_dst=198.19.0.2
+ '[' inherit = inherit ']'
+ ping_pid=513334
+ local tunnel_type_offset tunnel_type_proto req_proto_offset req_offset
+ '[' vxlan = gre ']'
+ '[' vxlan = vxlan ']'
+ tunnel_type_proto=0x11
+ '[' 4 = 4 ']'
+ tunnel_type_offset=9
+ '[' 4 = 4 ']'
+ req_proto_offset=47
+ req_offset=58
+ '[' vxlan = vxlan ']'
+ req_proto_offset=59
+ ping -i 0.1 198.19.0.2 -Q 0xc8 -t 160
+ req_offset=70
+ false
++ tcpdump --immediate-mode -p -c 1 -v -i veth0 -n 'ip[9]' = 0x11 and 'ip[59]' = 0x01 and 'ip[70]' = 0x08
++ head -n 1