Skip to content

Commit df23bb1

Browse files
sbrivio-rhdavem330
authored andcommitted
ipv4: route: Ignore output interface in FIB lookup for PMTU route
Currently, processes sending traffic to a local bridge with an encapsulation device as a port don't get ICMP errors if they exceed the PMTU of the encapsulated link. David Ahern suggested this as a hack, but it actually looks like the correct solution: when we update the PMTU for a given destination by means of updating or creating a route exception, the encapsulation might trigger this because of PMTU discovery happening either on the encapsulation device itself, or its lower layer. This happens on bridged encapsulations only. The output interface shouldn't matter, because we already have a valid destination. Drop the output interface restriction from the associated route lookup. For UDP tunnels, we will now have a route exception created for the encapsulation itself, with a MTU value reflecting its headroom, which allows a bridge forwarding IP packets originated locally to deliver errors back to the sending socket. The behaviour is now consistent with IPv6 and verified with selftests pmtu_ipv{4,6}_br_{geneve,vxlan}{4,6}_exception introduced later in this series. v2: - reset output interface only for bridge ports (David Ahern) - add and use netif_is_any_bridge_port() helper (David Ahern) Suggested-by: David Ahern <[email protected]> Signed-off-by: Stefano Brivio <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cabf06e commit df23bb1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

include/linux/netdevice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4840,6 +4840,11 @@ static inline bool netif_is_ovs_port(const struct net_device *dev)
48404840
return dev->priv_flags & IFF_OVS_DATAPATH;
48414841
}
48424842

4843+
static inline bool netif_is_any_bridge_port(const struct net_device *dev)
4844+
{
4845+
return netif_is_bridge_port(dev) || netif_is_ovs_port(dev);
4846+
}
4847+
48434848
static inline bool netif_is_team_master(const struct net_device *dev)
48444849
{
48454850
return dev->priv_flags & IFF_TEAM;

net/ipv4/route.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,11 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
10501050
struct flowi4 fl4;
10511051

10521052
ip_rt_build_flow_key(&fl4, sk, skb);
1053+
1054+
/* Don't make lookup fail for bridged encapsulations */
1055+
if (skb && netif_is_any_bridge_port(skb->dev))
1056+
fl4.flowi4_oif = 0;
1057+
10531058
__ip_rt_update_pmtu(rt, &fl4, mtu);
10541059
}
10551060

0 commit comments

Comments
 (0)