Bug 195661

Summary: setting the traffic class on IPv6 tunnels no longer works
Product: Networking Reporter: Peter Dawson (peter.a.dawson)
Component: IPV6Assignee: Hideaki YOSHIFUJI (yoshfuji)
Status: RESOLVED CODE_FIX    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.10.11 Tree: Fedora
Regression: Yes
Attachments: Patch to ip6_tunnel.c, ip6_gre.c to fix bug 195661
fixed style issues in original patch

Description Peter Dawson 2017-05-05 03:00:28 UTC
When I create an IPv6 encapsulated tunnels, setting the traffic class for the tunnel does not change the traffic class of the encapsulating packets.

This was working in Kernel as late as 4.9.8 and no longer works in Kernel 4.10.11.

The following tunnel types exhibit this error:
- ip6ip6
- ipip6
- ip6gre

In the below example I have two hosts and create an IPv6 tunnel with tclass inherit. When observing these packets in wireshark the traffic class of the encapsulated packet is not set on the encapsulating packet.

## Host1
# ip addr flush eth0
# echo “1” > /proc/sys/net/ipv6/conf/all/forwarding
# ip addr add fc00:1111::11/32 dev eth0
# ip link set eth0 up
# ip -6 tunnel add TT01 mode ip6ip6 local fc00:1111::11 remote fc00:1111::12 tclass inherit
# ip addr add fc11:1111::11/32 dev TT01
# ip link set TT01 up

## Host2
# ip addr flush eth0
# echo “1” > /proc/sys/net/ipv6/conf/all/forwarding
# ip addr add fc00:1111::12/32 dev eth0 
# ip link set eth0 up
# ip -6 tunnel add TT01 mode ip6ip6 local fc00:1111::12 remote fc00:1111::11 class inherit
# ip addr add fc11:1111::12/32 dev TT01
# ip link set TT01 up

Ping from Host 1 to Host2

## Host 1
ping fc11:1111::12 -Q 0xb8

Wireshark on Eth0 of Host1:
Frame 3: 158 bytes on wire (1264 bits), 158 bytes captured (1264 bits) on interface 0
Ethernet II, Src: 00:00:00_ca:12:01 (00:00:00:ca:12:01), Dst: 00:00:00_ca:11:01 (00:00:00:ca:11:01)
Internet Protocol Version 6, Src: fc00:1111::12, Dst: fc00:1111::11
.... 0000 0000 .... .... .... .... .... = Traffic class: 0x00 (DSCP: CS0, ECN: Not-ECT)
Internet Protocol Version 6, Src: fc11:1111::12, Dst: fc11:1111::11
.... 1011 1000 .... .... .... .... .... = Traffic class: 0xb8 (DSCP: EF PHB, ECN: Not-ECT)
Internet Control Message Protocol v6
Comment 1 Peter Dawson 2017-05-16 00:40:40 UTC
Created attachment 256553 [details]
Patch to ip6_tunnel.c, ip6_gre.c to fix bug 195661

Created a patch to kernel 4.12-rc1 to fix this bug.
Comment 2 Peter Dawson 2017-05-18 01:58:02 UTC
Created attachment 256605 [details]
fixed style issues in original patch

Fixed style issues.
Comment 3 Peter Dawson 2017-05-28 22:05:17 UTC
Fixed in 6741d51699ac9ef21f1