Björn,
Have you actually tested this yourself? I ask since I can't replicate
this misbehavior when vio(4) is not used or IPv4 is used. I agree that
this is surprising behavior since if the bug were a simple disregard of
padding causing an MTU "overflow", then it should be trivial to get it to
trigger.
My VPS provider doesn't filter ICMPv6 traffic, and I never stated that I
used the same ping6(8)/ping(8) commands when IPv4 is used to establish
the tunnel because I didn't. I properly adjusted the data size.
More explictly vis-a-vis vio(4) being necessary:
Let's change Peer 2 to be an OpenBSD 7.9-stable client running on a
physical machine connected to a switch via rge(4) with a 1500 MTU. This
device is on a separate L2/L3 network from Peer 1. The switch it
connects to is connected to a router via ixl(4) also with a 1500 MTU.
This ixl(4) interface is the "trunk" interface of the switch and is used
as the parent interface of the vlan(4) (also with a 1500 MTU) that Peer
2 is part of.
Peer 1 is the exact same as it is my original post. It's connected via
Ethernet to the same switch. It's part of a different vlan(4). The switch
is not configured to route traffic across vlans.
build$ uname -a
OpenBSD build.philomathiclife.com 7.9 GENERIC.MP#11 amd64
build$ ifconfig rge0
rge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr 78:2d:7e:1e:2c:98
index 3 priority 0 llprio 3
groups: egress
media: Ethernet autoselect (2500baseT full-duplex)
status: active
inet6 fe80::7a2d:7eff:fe1e:2c98%rge0 prefixlen 64 scopeid 0x3
inet6 fd6f:b9f1:09b3::2 prefixlen 64
inet 192.168.2.2 netmask 0xffffff00 broadcast 192.168.2.255
build# cat hostname.wg0
wgkey AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAI=
wgport 4987
wgpeer /TOE4TKtAqVsePRVR+5AA43HkAK5DSntkOCO7nYq5xU= wgendpoint
2601:283:4e00:fdd4::2 4987 wgaip fe80::1/128 wgaip 10.0.0.1/32
inet6 fe80::2%wg0 64
inet 10.0.0.2 255.255.255.252 NONE
mtu 1420
1500 MTU of physical interfaces is fine:
[zack@laptop ~]$ ping -6c1 -M do -s 1452 fd6f:b9f1:09b3::2
PING fd6f:b9f1:09b3::2 (fd6f:b9f1:09b3::2) 1452 data bytes
1460 bytes from fd6f:b9f1:09b3::2 icmp_seq=1 ttl=63 time=1.33 ms
--- fd6f:b9f1:09b3::2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.328/1.328/1.328/0.000 ms
build$ ping6 -Dc1 -s 1452 2601:283:4e00:fdd4::2
PING 2601:283:4e00:fdd4::2 (2601:283:4e00:fdd4::2): 1452 data bytes
1460 bytes from 2601:283:4e00:fdd4::2: icmp_seq=0 hlim=63 time=1.251 ms
--- 2601:283:4e00:fdd4::2 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.251/1.251/1.251/0.000 ms
Premature fragmentation does _not_ occur in the WireGuard tunnel:
zack@laptop ~]$ ping -6c1 -M do -s 1372 fe80::2%wg0
PING fe80::2%wg0 (fe80::2%wg0) 1372 data bytes
1380 bytes from fe80::2%wg0: icmp_seq=1 ttl=64 time=1.88 ms
--- fe80::2%wg0 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.881/1.881/1.881/0.000 ms
[zack@laptop ~]$ ping -4c1 -M do -s 1392 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 1392(1420) bytes of data.
1400 bytes from 10.0.0.2: icmp_seq=1 ttl=255 time=3.32 ms
--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 3.319/3.319/3.319/0.000 ms
build$ ping6 -Dc1 -s 1372 fe80::1%wg0
PING fe80::1%wg0 (fe80::1%wg0): 1372 data bytes
1380 bytes from fe80::1%wg0: icmp_seq=0 hlim=64 time=1.766 ms
--- fe80::1%wg0 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.766/1.766/1.766/0.000 ms
build$ ping -Dc1 -s 1392 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 1392 data bytes
1400 bytes from 10.0.0.1: icmp_seq=0 ttl=64 time=1.411 ms
--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.411/1.411/1.411/0.000 ms
The above peer is not the only one that doesn't experience this bug.
Currently the 5G cellular network my iPhone is connected to uses a
1500 MTU (again confirmed via ping6(8)). I have a wg(4) interface
configured that I use as a VPN that it connects to. It's connected
to it via IPv6. When I ping6(8)/ping(8) my phone through the wg(4) tunnel,
premature fragmentation doesn't occur. I've two other devices, and I
simply can't trigger this bug when vio(4) isn't used.
As far as IPv6 being required is concerned, this one is a little harder
to test since I just established above I can't trigger the bug using
devices in my home lab. In contrast since I know my VPS triggers this bug,
I'll configure it to use an IPv4 endpoint as well as adjust the MTUs. I'll
change Peer 1 to be my router which runs OpenBSD 7.9-stable and has a
public IPv4 address. I'll first confirm that despite swapping Peer 1 for
this peer that I still trigger premature fragmentation when IPv6 is used
for the endpoints. After I'll show that's _not_ the case for IPv4.
router$ uname -a
OpenBSD router.philomathiclife.com 7.9 GENERIC.MP#8 amd64
router$ ifconfig ixl2
ixl2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr f0:b2:b9:36:91:a4
index 3 priority 0 llprio 3
groups: egress
media: Ethernet autoselect (autoselect full-duplex)
status: active
inet6 fe80::f2b2:b9ff:fe36:91a4%ixl2 prefixlen 64 scopeid 0x3
inet6 2001:558:6040:b9:7ce5:5b1a:d32c:1bf0 prefixlen 128 pltime 5294
vltime 5294
inet 76.131.95.65 netmask 0xfffffe00 broadcast 76.131.95.255
router# cat /etc/hostname.wg0
wgkey AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=
wgport 4987
wgpeer rYxIwmdlrqetxTYolgXBq+qVBQCT29IYyWq9JIGgNWU= wgendpoint
2607:f2f8:a600::1 4987 wgaip fe80::2/128 wgaip 10.0.0.2/32
inet6 fe80::1%wg0 64
inet 10.0.0.1 255.255.255.252 NONE
mtu 1420
MTU of 1500 is fine for the physical interfaces:
router$ ping6 -Dc1 -s 1452 2607:f2f8:a600::1
PING 2607:f2f8:a600::1 (2607:f2f8:a600::1): 1452 data bytes
1460 bytes from 2607:f2f8:a600::1: icmp_seq=0 hlim=55 time=55.132 ms
--- 2607:f2f8:a600::1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 55.132/55.132/55.132/0.000 ms
vps$ ping6 -Dc1 -s 1452 2001:558:6040:b9:7ce5:5b1a:d32c:1bf0
PING 2001:558:6040:b9:7ce5:5b1a:d32c:1bf0
(2001:558:6040:b9:7ce5:5b1a:d32c:1bf0): 1452 data bytes
1460 bytes from 2001:558:6040:b9:7ce5:5b1a:d32c:1bf0: icmp_seq=0 hlim=50
time=52.424 ms
--- 2001:558:6040:b9:7ce5:5b1a:d32c:1bf0 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 52.424/52.424/52.424/0.000 ms
Premature fragmentation occurs when IPv6 is used to establish the tunnel:
router$ ping6 -Dc1 -s 1361 fe80::2%wg0
PING fe80::2%wg0 (fe80::2%wg0): 1361 data bytes
--- fe80::2%wg0 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
router# ping -Dc1 -s 1381 10.0.0.2
PING 10.0.0.2 (10.0.0.2): 1381 data bytes
--- 10.0.0.2 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
vps$ ping6 -Dc1 -s 1361 fe80::1%wg0
PING fe80::1%wg0 (fe80::1%wg0): 1361 data bytes
--- fe80::1%wg0 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
vps# ping -Dc1 -s 1381 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 1381 data bytes
--- 10.0.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
Now let's configure the endpoints for IPv4 and adjust the MTUs:
router# ifconfig wg0
wg0: flags=80c3<UP,BROADCAST,RUNNING,NOARP,MULTICAST> mtu 1439
index 130 priority 0 llprio 3
wgport 4987
wgpubkey /TOE4TKtAqVsePRVR+5AA43HkAK5DSntkOCO7nYq5xU=
wgpeer rYxIwmdlrqetxTYolgXBq+qVBQCT29IYyWq9JIGgNWU=
wgendpoint 174.136.97.9 4987
tx: 8964, rx: 8908
last handshake: 127 seconds ago
wgaip 10.0.0.2/32
wgaip fe80::2/128
groups: wg
inet6 fe80::1%wg0 prefixlen 64 scopeid 0x82
inet 10.0.0.1 netmask 0xfffffffc broadcast 10.0.0.3
vps$ ifconfig vio0
vio0: flags=2008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LRO> mtu 1499
lladdr 52:54:00:0c:b2:d8
index 1 priority 0 llprio 3
groups: egress
media: Ethernet autoselect
status: active
inet6 fe80::5054:ff:fe0c:b2d8%vio0 prefixlen 64 scopeid 0x1
inet6 fe80::2%vio0 prefixlen 64 scopeid 0x1
inet6 2607:f2f8:a600::1 prefixlen 128
inet 10.0.121.2 netmask 0xfffffffc broadcast 10.0.121.3
inet 174.136.97.9 netmask 0xffffffff
vps# ifconfig wg0
wg0: flags=80c3<UP,BROADCAST,RUNNING,NOARP,MULTICAST> mtu 1439
index 4 priority 0 llprio 3
wgport 4987
wgpubkey rYxIwmdlrqetxTYolgXBq+qVBQCT29IYyWq9JIGgNWU=
wgpeer /TOE4TKtAqVsePRVR+5AA43HkAK5DSntkOCO7nYq5xU=
wgendpoint 76.131.95.65 4987
tx: 8908, rx: 8964
last handshake: 191 seconds ago
wgaip 10.0.0.1/32
wgaip fe80::1/128
groups: wg
inet6 fe80::2%wg0 prefixlen 64 scopeid 0x4
inet 10.0.0.2 netmask 0xfffffffc broadcast 10.0.0.3
Confirm MTU of vio(4) is 1499:
router$ ping -Dc1 -s 1471 174.136.97.9
PING 174.136.97.9 (174.136.97.9): 1471 data bytes
1479 bytes from 174.136.97.9: icmp_seq=0 ttl=246 time=53.347 ms
--- 174.136.97.9 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 53.347/53.347/53.347/0.000 ms
router$ ping -Dc1 -s 1472 174.136.97.9
PING 174.136.97.9 (174.136.97.9): 1472 data bytes
--- 174.136.97.9 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
Premature fragmentation does _not_ occur:
router$ ping6 -Dc1 -s 1391 fe80::2%wg0
PING fe80::2%wg0 (fe80::2%wg0): 1391 data bytes
1399 bytes from fe80::2%wg0: icmp_seq=0 hlim=64 time=52.236 ms
--- fe80::2%wg0 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 52.236/52.236/52.236/0.000 ms
router$ ping -Dc1 -s 1411 10.0.0.2
PING 10.0.0.2 (10.0.0.2): 1411 data bytes
1419 bytes from 10.0.0.2: icmp_seq=0 ttl=255 time=53.047 ms
--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 53.047/53.047/53.047/0.000 ms
vps$ ping6 -Dc1 -s 1391 fe80::1%wg0
PING fe80::1%wg0 (fe80::1%wg0): 1391 data bytes
1399 bytes from fe80::1%wg0: icmp_seq=0 hlim=64 time=55.534 ms
--- fe80::1%wg0 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 55.534/55.534/55.534/0.000 ms
vps$ ping -Dc1 -s 1411 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 1411 data bytes
1419 bytes from 10.0.0.1: icmp_seq=0 ttl=255 time=52.533 ms
--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 52.533/52.533/52.533/0.000 ms
Above suggests that padding is properly being handled in some cases but
in others-namely when vio(4) and IPv6 are used to establish the tunnel-
it is not.