Skip to content

Commit 3f47cb4

Browse files
tomparkindavem330
authored andcommitted
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. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2bd056f commit 3f47cb4

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎include/uapi/linux/l2tp.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ enum {
144144
L2TP_ATTR_RX_OOS_PACKETS, /* u64 */
145145
L2TP_ATTR_RX_ERRORS, /* u64 */
146146
L2TP_ATTR_STATS_PAD,
147+
L2TP_ATTR_RX_COOKIE_DISCARDS, /* u64 */
147148
__L2TP_ATTR_STATS_MAX,
148149
};
149150

‎net/l2tp/l2tp_netlink.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla
420420
nla_put_u64_64bit(skb, L2TP_ATTR_RX_SEQ_DISCARDS,
421421
atomic_long_read(&tunnel->stats.rx_seq_discards),
422422
L2TP_ATTR_STATS_PAD) ||
423+
nla_put_u64_64bit(skb, L2TP_ATTR_RX_COOKIE_DISCARDS,
424+
atomic_long_read(&tunnel->stats.rx_cookie_discards),
425+
L2TP_ATTR_STATS_PAD) ||
423426
nla_put_u64_64bit(skb, L2TP_ATTR_RX_OOS_PACKETS,
424427
atomic_long_read(&tunnel->stats.rx_oos_packets),
425428
L2TP_ATTR_STATS_PAD) ||
@@ -760,6 +763,9 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
760763
nla_put_u64_64bit(skb, L2TP_ATTR_RX_SEQ_DISCARDS,
761764
atomic_long_read(&session->stats.rx_seq_discards),
762765
L2TP_ATTR_STATS_PAD) ||
766+
nla_put_u64_64bit(skb, L2TP_ATTR_RX_COOKIE_DISCARDS,
767+
atomic_long_read(&session->stats.rx_cookie_discards),
768+
L2TP_ATTR_STATS_PAD) ||
763769
nla_put_u64_64bit(skb, L2TP_ATTR_RX_OOS_PACKETS,
764770
atomic_long_read(&session->stats.rx_oos_packets),
765771
L2TP_ATTR_STATS_PAD) ||

0 commit comments

Comments
 (0)