gtp: fix fragmentation needed check with gso
[ Upstream commit 4530e5b8e2dad63dcad2206232dd86e4b1489b6c ]
Call skb_gso_validate_network_len() to check if packet is over PMTU.
Fixes: 459aa660eb
("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
3ae8b75fce
commit
fe65fc90e9
@@ -538,8 +538,9 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev,
|
|||||||
|
|
||||||
rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu, false);
|
rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu, false);
|
||||||
|
|
||||||
if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) &&
|
if (iph->frag_off & htons(IP_DF) &&
|
||||||
mtu < ntohs(iph->tot_len)) {
|
((!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");
|
netdev_dbg(dev, "packet too big, fragmentation needed\n");
|
||||||
icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
|
icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
|
||||||
htonl(mtu));
|
htonl(mtu));
|
||||||
|
Reference in New Issue
Block a user