diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-10-22 22:25:18 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-10-24 12:02:02 +0200 |
commit | 4530e5b8e2dad63dcad2206232dd86e4b1489b6c (patch) | |
tree | 806e7aac4724a7907dcdb16e650adde1508bb070 | |
parent | gtp: uapi: fix GTPA_MAX (diff) | |
download | linux-4530e5b8e2dad63dcad2206232dd86e4b1489b6c.tar.xz linux-4530e5b8e2dad63dcad2206232dd86e4b1489b6c.zip |
gtp: fix fragmentation needed check with gso
Call skb_gso_validate_network_len() to check if packet is over PMTU.
Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r-- | drivers/net/gtp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index 144ec626230d..b22596b18ee8 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -872,8 +872,9 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev, skb_dst_update_pmtu_no_confirm(skb, mtu); - if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) && - mtu < ntohs(iph->tot_len)) { + if (iph->frag_off & htons(IP_DF) && + ((!skb_is_gso(skb) && skb->len > mtu) || + (skb_is_gso(skb) && !skb_gso_validate_network_len(skb, mtu)))) { netdev_dbg(dev, "packet too big, fragmentation needed\n"); icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); |