netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] GTP tunnel driver fixes
@ 2023-10-22 20:25 Pablo Neira Ayuso
  2023-10-22 20:25 ` [PATCH net 1/2] gtp: uapi: fix GTPA_MAX Pablo Neira Ayuso
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2023-10-22 20:25 UTC (permalink / raw)
  To: netdev; +Cc: osmocom-net-gprs, davem, kuba, pabeni, edumazet, laforge, laforge

Hi,

The following patchset contains two fixes for the GTP tunnel driver:

1) Incorrect GTPA_MAX definition in UAPI headers. This is updating an
   existing UAPI definition but for a good reason, this is certainly
   broken. Similar fixes for incorrect _MAX definition in netlink
   headers were applied in the past too.

2) Fix GTP driver PMTU with GRO packets, add missing call to
   skb_gso_validate_network_len() to handle GRO packets.

Please apply, Thanks.

Pablo Neira Ayuso (2):
  gtp: uapi: fix GTPA_MAX
  gtp: fix fragmentation needed check with gso

 drivers/net/gtp.c        | 5 +++--
 include/uapi/linux/gtp.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] gtp: uapi: fix GTPA_MAX
  2023-10-22 20:25 [PATCH net 0/2] GTP tunnel driver fixes Pablo Neira Ayuso
@ 2023-10-22 20:25 ` Pablo Neira Ayuso
  2023-10-22 20:25 ` [PATCH net 2/2] gtp: fix fragmentation needed check with gso Pablo Neira Ayuso
  2023-10-24 10:30 ` [PATCH net 0/2] GTP tunnel driver fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2023-10-22 20:25 UTC (permalink / raw)
  To: netdev; +Cc: osmocom-net-gprs, davem, kuba, pabeni, edumazet, laforge, laforge

Subtract one to __GTPA_MAX, otherwise GTPA_MAX is off by 2.

Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/uapi/linux/gtp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/gtp.h b/include/uapi/linux/gtp.h
index 2f61298a7b77..3dcdb9e33cba 100644
--- a/include/uapi/linux/gtp.h
+++ b/include/uapi/linux/gtp.h
@@ -33,6 +33,6 @@ enum gtp_attrs {
 	GTPA_PAD,
 	__GTPA_MAX,
 };
-#define GTPA_MAX (__GTPA_MAX + 1)
+#define GTPA_MAX (__GTPA_MAX - 1)
 
 #endif /* _UAPI_LINUX_GTP_H_ */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] gtp: fix fragmentation needed check with gso
  2023-10-22 20:25 [PATCH net 0/2] GTP tunnel driver fixes Pablo Neira Ayuso
  2023-10-22 20:25 ` [PATCH net 1/2] gtp: uapi: fix GTPA_MAX Pablo Neira Ayuso
@ 2023-10-22 20:25 ` Pablo Neira Ayuso
  2023-10-24 10:30 ` [PATCH net 0/2] GTP tunnel driver fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2023-10-22 20:25 UTC (permalink / raw)
  To: netdev; +Cc: osmocom-net-gprs, davem, kuba, pabeni, edumazet, laforge, laforge

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>
---
 drivers/net/gtp.c | 5 +++--
 1 file 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));
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] GTP tunnel driver fixes
  2023-10-22 20:25 [PATCH net 0/2] GTP tunnel driver fixes Pablo Neira Ayuso
  2023-10-22 20:25 ` [PATCH net 1/2] gtp: uapi: fix GTPA_MAX Pablo Neira Ayuso
  2023-10-22 20:25 ` [PATCH net 2/2] gtp: fix fragmentation needed check with gso Pablo Neira Ayuso
@ 2023-10-24 10:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-24 10:30 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: netdev, osmocom-net-gprs, davem, kuba, pabeni, edumazet, laforge,
	laforge

Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Sun, 22 Oct 2023 22:25:16 +0200 you wrote:
> Hi,
> 
> The following patchset contains two fixes for the GTP tunnel driver:
> 
> 1) Incorrect GTPA_MAX definition in UAPI headers. This is updating an
>    existing UAPI definition but for a good reason, this is certainly
>    broken. Similar fixes for incorrect _MAX definition in netlink
>    headers were applied in the past too.
> 
> [...]

Here is the summary with links:
  - [net,1/2] gtp: uapi: fix GTPA_MAX
    https://git.kernel.org/netdev/net/c/adc8df12d91a
  - [net,2/2] gtp: fix fragmentation needed check with gso
    https://git.kernel.org/netdev/net/c/4530e5b8e2da

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-24 10:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-22 20:25 [PATCH net 0/2] GTP tunnel driver fixes Pablo Neira Ayuso
2023-10-22 20:25 ` [PATCH net 1/2] gtp: uapi: fix GTPA_MAX Pablo Neira Ayuso
2023-10-22 20:25 ` [PATCH net 2/2] gtp: fix fragmentation needed check with gso Pablo Neira Ayuso
2023-10-24 10:30 ` [PATCH net 0/2] GTP tunnel driver fixes patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).