Skip to content

Commit 4530e5b

Browse files
ummakynesPaolo Abeni
authored andcommitted
gtp: fix fragmentation needed check with gso
Call skb_gso_validate_network_len() to check if packet is over PMTU. Fixes: 459aa66 ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)") Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent adc8df1 commit 4530e5b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/gtp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,9 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev,
872872

873873
skb_dst_update_pmtu_no_confirm(skb, mtu);
874874

875-
if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) &&
876-
mtu < ntohs(iph->tot_len)) {
875+
if (iph->frag_off & htons(IP_DF) &&
876+
((!skb_is_gso(skb) && skb->len > mtu) ||
877+
(skb_is_gso(skb) && !skb_gso_validate_network_len(skb, mtu)))) {
877878
netdev_dbg(dev, "packet too big, fragmentation needed\n");
878879
icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
879880
htonl(mtu));

0 commit comments

Comments
 (0)