Skip to content

Commit 582442d

Browse files
Oussama Ghorbeldavem330
authored andcommitted
ipv6: Allow the MTU of ipip6 tunnel to be set below 1280
The (inner) MTU of a ipip6 (IPv4-in-IPv6) tunnel cannot be set below 1280, which is the minimum MTU in IPv6. However, there should be no IPv6 on the tunnel interface at all, so the IPv6 rules should not apply. More info at https://bugzilla.kernel.org/show_bug.cgi?id=15530 This patch allows to check the minimum MTU for ipv6 tunnel according to these rules: -In case the tunnel is configured with ipip6 mode the minimum MTU is 68. -In case the tunnel is configured with ip6ip6 or any mode the minimum MTU is 1280. Signed-off-by: Oussama Ghorbel <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3573540 commit 582442d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

net/ipv6/ip6_tunnel.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,9 +1430,17 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
14301430
static int
14311431
ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
14321432
{
1433-
if (new_mtu < IPV6_MIN_MTU) {
1434-
return -EINVAL;
1433+
struct ip6_tnl *tnl = netdev_priv(dev);
1434+
1435+
if (tnl->parms.proto == IPPROTO_IPIP) {
1436+
if (new_mtu < 68)
1437+
return -EINVAL;
1438+
} else {
1439+
if (new_mtu < IPV6_MIN_MTU)
1440+
return -EINVAL;
14351441
}
1442+
if (new_mtu > 0xFFF8 - dev->hard_header_len)
1443+
return -EINVAL;
14361444
dev->mtu = new_mtu;
14371445
return 0;
14381446
}

0 commit comments

Comments
 (0)