summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJonas Bonn <jonas@norrbonn.se>2021-02-03 10:08:05 +0300
committerJakub Kicinski <kuba@kernel.org>2021-02-04 20:29:58 +0300
commit9716178a3abd7e4eb00ac44d664cfb2311e88c3b (patch)
tree859063f825f213d15750e77f61a81bc46706f261 /drivers
parent29f53b5c00c1deb27d31603ccf6ee161bd5ebb2f (diff)
downloadlinux-9716178a3abd7e4eb00ac44d664cfb2311e88c3b.tar.xz
gtp: update rx_length_errors for abnormally short packets
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> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/gtp.c10
1 files 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. */