Merge "net/ipv4: always honour route mtu during forwarding"

This commit is contained in:
qctecmdr 2020-10-14 13:09:05 -07:00 • committed by Gerrit - the friendly Code Review server
commit 37cdb7af00

View file

@ -451,12 +451,18 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
bool forwarding)
{
struct net *net = dev_net(dst->dev);
unsigned int mtu;
if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
ip_mtu_locked(dst) ||
!forwarding)
return dst_mtu(dst);
/* 'forwarding = true' case should always honour route mtu */
mtu = dst_metric_raw(dst, RTAX_MTU);
if (mtu)
return mtu;
return min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU);
}