Skip to contentSkip to conversation

l2tp: report rx cookie discards in netlink get

PATCH Applied Tom Parkin 2 participants 2 messages Sep 29, 2020

Subsystems (2)
lore
Share & tools
lore

Tom Parkin

author
#0 lore raw

PATCH 1/1 l2tp: report rx cookie discards in netlink get

When an L2TPv3 session receives a data frame with an incorrect cookie l2tp_core logs a warning message and bumps a stats counter to reflect the fact that the packet has been dropped.

However, the stats counter in question is missing from the l2tp_netlink get message for tunnel and session instances.

Include the statistic in the netlink get response.

---
 include/uapi/linux/l2tp.h | 1 +
 net/l2tp/l2tp_netlink.c   | 6 ++++++
 2 files changed, 7 insertions(+)
include/uapi/linux/l2tp.h +1 -0
index 88a0d32b8c07..30c80d5ba4bf 100644
@@ -144,6 +144,7 @@ enum {
 	L2TP_ATTR_RX_OOS_PACKETS,	/* u64 */
 	L2TP_ATTR_RX_ERRORS,		/* u64 */
 	L2TP_ATTR_STATS_PAD,
+	L2TP_ATTR_RX_COOKIE_DISCARDS,	/* u64 */
 	__L2TP_ATTR_STATS_MAX,
 };
 
net/l2tp/l2tp_netlink.c +6 -0
index 83c015f7f20d..5ca5056e9636 100644
@@ -420,6 +420,9 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla
 	    nla_put_u64_64bit(skb, L2TP_ATTR_RX_SEQ_DISCARDS,
 			      atomic_long_read(&tunnel->stats.rx_seq_discards),
 			      L2TP_ATTR_STATS_PAD) ||
+	    nla_put_u64_64bit(skb, L2TP_ATTR_RX_COOKIE_DISCARDS,
+			      atomic_long_read(&tunnel->stats.rx_cookie_discards),
+			      L2TP_ATTR_STATS_PAD) ||
 	    nla_put_u64_64bit(skb, L2TP_ATTR_RX_OOS_PACKETS,
 			      atomic_long_read(&tunnel->stats.rx_oos_packets),
 			      L2TP_ATTR_STATS_PAD) ||
@@ -760,6 +763,9 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
 	    nla_put_u64_64bit(skb, L2TP_ATTR_RX_SEQ_DISCARDS,
 			      atomic_long_read(&session->stats.rx_seq_discards),
 			      L2TP_ATTR_STATS_PAD) ||
+	    nla_put_u64_64bit(skb, L2TP_ATTR_RX_COOKIE_DISCARDS,
+			      atomic_long_read(&session->stats.rx_cookie_discards),
+			      L2TP_ATTR_STATS_PAD) ||
 	    nla_put_u64_64bit(skb, L2TP_ATTR_RX_OOS_PACKETS,
 			      atomic_long_read(&session->stats.rx_oos_packets),
 			      L2TP_ATTR_STATS_PAD) ||
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw

From: Tom Parkin <[email protected]>
Date: Tue, 29 Sep 2020 13:35:41 +0100

Quoted 10 lines

When an L2TPv3 session receives a data frame with an incorrect cookie l2tp_core logs a warning message and bumps a stats counter to reflect the fact that the packet has been dropped.

However, the stats counter in question is missing from the l2tp_netlink get message for tunnel and session instances.

Include the statistic in the netlink get response.

Please in the future put a "v2" into your Subject like like "[PATCH v2 net-next]" when you post a new version of a patch.

Applied to net-next, thanks.