Commit 6cd8ec58 authored by Xin Long's avatar Xin Long Committed by Jakub Kicinski

tipc: delete tipc_mtu_bad from tipc_udp_enable

Since commit a4dfa72d ("tipc: set default MTU for UDP media"), it's
been no longer using dev->mtu for b->mtu, and the issue described in
commit 3de81b75 ("tipc: check minimum bearer MTU") doesn't exist
in UDP bearer any more.

Besides, dev->mtu can still be changed to a too small mtu after the UDP
bearer is created even with tipc_mtu_bad() check in tipc_udp_enable().
Note that NETDEV_CHANGEMTU event processing in tipc_l2_device_event()
doesn't really work for UDP bearer.

So this patch deletes the unnecessary tipc_mtu_bad from tipc_udp_enable.
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Reviewed-by: default avatarTung Nguyen <tung.q.nguyen@dektech.com.au>
Link: https://lore.kernel.org/r/282f1f5cc40e6cad385aa1c60569e6c5b70e2fb3.1685371933.git.lucien.xin@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c23515ad
...@@ -431,7 +431,7 @@ int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b, ...@@ -431,7 +431,7 @@ int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b,
dev = dev_get_by_name(net, dev_name); dev = dev_get_by_name(net, dev_name);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
if (tipc_mtu_bad(dev, 0)) { if (tipc_mtu_bad(dev)) {
dev_put(dev); dev_put(dev);
return -EINVAL; return -EINVAL;
} }
...@@ -708,7 +708,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt, ...@@ -708,7 +708,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
test_and_set_bit_lock(0, &b->up); test_and_set_bit_lock(0, &b->up);
break; break;
case NETDEV_CHANGEMTU: case NETDEV_CHANGEMTU:
if (tipc_mtu_bad(dev, 0)) { if (tipc_mtu_bad(dev)) {
bearer_disable(net, b); bearer_disable(net, b);
break; break;
} }
......
...@@ -257,9 +257,9 @@ static inline void tipc_loopback_trace(struct net *net, ...@@ -257,9 +257,9 @@ static inline void tipc_loopback_trace(struct net *net,
} }
/* check if device MTU is too low for tipc headers */ /* check if device MTU is too low for tipc headers */
static inline bool tipc_mtu_bad(struct net_device *dev, unsigned int reserve) static inline bool tipc_mtu_bad(struct net_device *dev)
{ {
if (dev->mtu >= TIPC_MIN_BEARER_MTU + reserve) if (dev->mtu >= TIPC_MIN_BEARER_MTU)
return false; return false;
netdev_warn(dev, "MTU too low for tipc bearer\n"); netdev_warn(dev, "MTU too low for tipc bearer\n");
return true; return true;
......
...@@ -739,10 +739,6 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, ...@@ -739,10 +739,6 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
udp_conf.use_udp_checksums = false; udp_conf.use_udp_checksums = false;
ub->ifindex = dev->ifindex; ub->ifindex = dev->ifindex;
b->encap_hlen = sizeof(struct iphdr) + sizeof(struct udphdr); b->encap_hlen = sizeof(struct iphdr) + sizeof(struct udphdr);
if (tipc_mtu_bad(dev, b->encap_hlen)) {
err = -EINVAL;
goto err;
}
b->mtu = b->media->mtu; b->mtu = b->media->mtu;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
} else if (local.proto == htons(ETH_P_IPV6)) { } else if (local.proto == htons(ETH_P_IPV6)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment