Thread (20 messages) flat view 20 messages, 3 authors, 2021-02-04

Re: [PATCH net-next 7/7] gtp: update rx_length_errors for abnormally short packets

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-02-02 22:01:44

On Tue,  2 Feb 2021 07:51:59 +0100 Jonas Bonn wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index a1bb02818977..fa8880c51101 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)))) {
+		gtp->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:
+	gtp->dev->stats.rx_dropped++;
+	return -1;
 }
 
 /* 1 means pass up to the stack, -1 means drop and 0 means decapsulated. */
drivers/net/gtp.c: In function ‘gtp_rx’:
drivers/net/gtp.c:193:3: error: ‘gtp’ undeclared (first use in this function)
  193 |   gtp->dev->stats.rx_length_errors++;
      |   ^~~
drivers/net/gtp.c:193:3: note: each undeclared identifier is reported only once for each function it appears in


Thanks for working on these patches!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help