PMTUD broken inside network namespace with multipath routing
From: mastertheknife <hidden>
Date: 2020-08-03 11:14:31
Hi, I have observed that PMTUD (Path MTU discovery) is broken using multipath routing inside a network namespace. This breaks TCP, because it keeps trying to send oversized packets. Observed on kernel 5.4.44, other kernels weren't tested. However i went through net/ipv4/route.c and haven't spotted changes in this area, so i believe this bug is still there. Host test with multipath routing: --------------------------------- root@host1:~# ip route add 192.168.247.100/32 dev vmbr2 nexthop via 192.168.252.250 dev vmbr2 nexthop via 192.168.252.252 dev vmbr2 root@host1:~# ip route | grep -A2 192.168.247.100 192.168.247.100 nexthop via 192.168.252.250 dev vmbr2 weight 1 nexthop via 192.168.252.252 dev vmbr2 weight 1 root@host1:~# ping -M do -s 1380 192.168.247.100 PING 192.168.247.100 (192.168.247.100) 1380(1408) bytes of data. From 192.168.252.252 icmp_seq=1 Frag needed and DF set (mtu = 1406) ping: local error: Message too long, mtu=1406 ping: local error: Message too long, mtu=1406 ping: local error: Message too long, mtu=1406 ping: local error: Message too long, mtu=1406 ^C
--- 192.168.247.100 ping statistics ---5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 80ms
root@host1:~# ip route get 192.168.247.100
192.168.247.100 via 192.168.252.250 dev vmbr2 src 192.168.252.15 uid 0
cache expires 583sec mtu 1406
LXC container inside that host with multipath routing:
------------------------------------------------------
[root@lxctest ~]# ip route add 192.168.247.100/32 dev eth0 nexthop via
192.168.252.250 dev eth0 nexthop via 192.168.252.252 dev eth0
[root@lxctest ~]# ip route
default via 192.168.252.100 dev eth0 proto static metric 100
192.168.247.100
nexthop via 192.168.252.250 dev eth0 weight 1
nexthop via 192.168.252.252 dev eth0 weight 1
192.168.252.0/24 dev eth0 proto kernel scope link src 192.168.252.207 metric 100
[root@lxctest ~]# ping -M do -s 1380 192.168.247.100
PING 192.168.247.100 (192.168.247.100) 1380(1408) bytes of data.
From 192.168.252.252 icmp_seq=1 Frag needed and DF set (mtu = 1406)
From 192.168.252.252 icmp_seq=2 Frag needed and DF set (mtu = 1406)
From 192.168.252.252 icmp_seq=3 Frag needed and DF set (mtu = 1406)
From 192.168.252.252 icmp_seq=4 Frag needed and DF set (mtu = 1406)
[root@lxctest ~]# ip route get 192.168.247.100
192.168.247.100 via 192.168.252.252 dev eth0 src 192.168.252.207 uid 0
cache
LXC container inside that host with regular routing:
----------------------------------------------------
[root@lxctest ~]# ip route add 192.168.247.100/32 via 192.168.252.252 dev eth0
[root@lxctest ~]# ip route
default via 192.168.252.100 dev eth0 proto static metric 100
192.168.247.100 via 192.168.252.252 dev eth0
192.168.252.0/24 dev eth0 proto kernel scope link src 192.168.252.207 metric 100
[root@lxctest ~]# ping -M do -s 1380 192.168.247.100
PING 192.168.247.100 (192.168.247.100) 1380(1408) bytes of data.
From 192.168.252.252 icmp_seq=1 Frag needed and DF set (mtu = 1406)
ping: local error: Message too long, mtu=1406
ping: local error: Message too long, mtu=1406
ping: local error: Message too long, mtu=1406
^C--- 192.168.247.100 ping statistics ---4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 82ms
[root@lxctest ~]# ip route get 192.168.247.100
192.168.247.100 via 192.168.252.252 dev eth0 src 192.168.252.207 uid 0
cache expires 591sec mtu 1406
What seems to be happening, is that when multipath routing is used
inside LXC (or any network namespace), the kernel doesn't generate a
routing exception to force the lower MTU.
I believe this is a bug inside the kernel.
Kfir Itzhak