Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tom Parkin and committed by
David S. Miller
3f47cb4c 2bd056f5

+7
+1
include/uapi/linux/l2tp.h
··· 144 144 L2TP_ATTR_RX_OOS_PACKETS, /* u64 */ 145 145 L2TP_ATTR_RX_ERRORS, /* u64 */ 146 146 L2TP_ATTR_STATS_PAD, 147 + L2TP_ATTR_RX_COOKIE_DISCARDS, /* u64 */ 147 148 __L2TP_ATTR_STATS_MAX, 148 149 }; 149 150
+6
net/l2tp/l2tp_netlink.c
··· 420 420 nla_put_u64_64bit(skb, L2TP_ATTR_RX_SEQ_DISCARDS, 421 421 atomic_long_read(&tunnel->stats.rx_seq_discards), 422 422 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) || 423 426 nla_put_u64_64bit(skb, L2TP_ATTR_RX_OOS_PACKETS, 424 427 atomic_long_read(&tunnel->stats.rx_oos_packets), 425 428 L2TP_ATTR_STATS_PAD) || ··· 762 759 L2TP_ATTR_STATS_PAD) || 763 760 nla_put_u64_64bit(skb, L2TP_ATTR_RX_SEQ_DISCARDS, 764 761 atomic_long_read(&session->stats.rx_seq_discards), 762 + L2TP_ATTR_STATS_PAD) || 763 + nla_put_u64_64bit(skb, L2TP_ATTR_RX_COOKIE_DISCARDS, 764 + atomic_long_read(&session->stats.rx_cookie_discards), 765 765 L2TP_ATTR_STATS_PAD) || 766 766 nla_put_u64_64bit(skb, L2TP_ATTR_RX_OOS_PACKETS, 767 767 atomic_long_read(&session->stats.rx_oos_packets),