aboutsummaryrefslogtreecommitdiff
path: root/net/ipv4/ip_tunnel.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-06-01 11:40:19 +0100
committerMark Brown <broonie@kernel.org>2018-06-01 11:40:19 +0100
commit91983dd5325297de4a2b6e1e3f22497604b6c687 (patch)
tree82a440219533c59dde336b383f89bcfe43da3aa5 /net/ipv4/ip_tunnel.c
parentc36e3982af7020ff66886b6a7d673a8a471c4eac (diff)
parent9c465aceb29ae6033c9021cc38a7dd219d9edb43 (diff)
Merge branch 'linux-linaro-lsk-v4.14' into linux-linaro-lsk-v4.14-rtlsk-v4.14-18.05-rt
Diffstat (limited to 'net/ipv4/ip_tunnel.c')
-rw-r--r--net/ipv4/ip_tunnel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index a2fcc20774a6..4784f3f36b7e 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -1103,8 +1103,14 @@ int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
eth_hw_addr_random(dev);
mtu = ip_tunnel_bind_dev(dev);
- if (!tb[IFLA_MTU])
+ if (tb[IFLA_MTU]) {
+ unsigned int max = 0xfff8 - dev->hard_header_len - nt->hlen;
+
+ dev->mtu = clamp(dev->mtu, (unsigned int)ETH_MIN_MTU,
+ (unsigned int)(max - sizeof(struct iphdr)));
+ } else {
dev->mtu = mtu;
+ }
ip_tunnel_add(itn, nt);
out: