netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Bonn <jonas@norrbonn.se>
To: laforge@gnumonks.org, kuba@kernel.org, netdev@vger.kernel.org,
	pablo@netfilter.org
Cc: Jonas Bonn <jonas@norrbonn.se>
Subject: [PATCH net-next v2 7/7] gtp: update rx_length_errors for abnormally short packets
Date: Wed,  3 Feb 2021 08:08:05 +0100	[thread overview]
Message-ID: <20210203070805.281321-8-jonas@norrbonn.se> (raw)
In-Reply-To: <20210203070805.281321-1-jonas@norrbonn.se>

Based on work by Pravin Shelar.

Update appropriate stats when packet transmission isn't possible.

Signed-off-by: Jonas Bonn <jonas@norrbonn.se>
Acked-by: Harald Welte <laforge@gnumonks.org>
---
 drivers/net/gtp.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index a1bb02818977..9a70f05baf6e 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -189,8 +189,10 @@ static int gtp_rx(struct pdp_ctx *pctx, struct sk_buff *skb,
 
 	/* Get rid of the GTP + UDP headers. */
 	if (iptunnel_pull_header(skb, hdrlen, skb->protocol,
-				 !net_eq(sock_net(pctx->sk), dev_net(pctx->dev))))
-		return -1;
+			 !net_eq(sock_net(pctx->sk), dev_net(pctx->dev)))) {
+		pctx->dev->stats.rx_length_errors++;
+		goto err;
+	}
 
 	netdev_dbg(pctx->dev, "forwarding packet from GGSN to uplink\n");
 
@@ -206,6 +208,10 @@ static int gtp_rx(struct pdp_ctx *pctx, struct sk_buff *skb,
 
 	netif_rx(skb);
 	return 0;
+
+err:
+	pctx->dev->stats.rx_dropped++;
+	return -1;
 }
 
 /* 1 means pass up to the stack, -1 means drop and 0 means decapsulated. */
-- 
2.27.0


  parent reply	other threads:[~2021-02-03  7:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  6:51 [PATCH net-next 0/7] GTP Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 1/7] Revert "GTP: add support for flow based tunneling API" Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 2/7] gtp: set initial MTU Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 3/7] gtp: include role in link info Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 4/7] gtp: really check namespaces before xmit Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 5/7] gtp: drop unnecessary call to skb_dst_drop Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 6/7] gtp: set device type Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 7/7] gtp: update rx_length_errors for abnormally short packets Jonas Bonn
2021-02-02 22:00   ` Jakub Kicinski
2021-02-03  7:07 ` [PATCH net-next v2 0/7] GTP Jonas Bonn
2021-02-03  7:07   ` [PATCH net-next v2 1/7] Revert "GTP: add support for flow based tunneling API" Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 2/7] gtp: set initial MTU Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 3/7] gtp: include role in link info Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 4/7] gtp: really check namespaces before xmit Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 5/7] gtp: drop unnecessary call to skb_dst_drop Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 6/7] gtp: set device type Jonas Bonn
2021-02-03  7:08   ` Jonas Bonn [this message]
2021-02-03 20:19   ` [PATCH net-next v2 0/7] GTP Jakub Kicinski
2021-02-04 20:10   ` Jakub Kicinski
2021-02-04  6:09 ` [PATCH net-next " Pravin Shelar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210203070805.281321-8-jonas@norrbonn.se \
    --to=jonas@norrbonn.se \
    --cc=kuba@kernel.org \
    --cc=laforge@gnumonks.org \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).