• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From bab9e77c87d3b596e77d669b0a827b50e725bb62 Mon Sep 17 00:00:00 2001
2From: Ilya Pronin <ipronin@twitter.com>
3Date: Fri, 3 Apr 2020 20:00:37 -0700
4Subject: [PATCH] route/link: add RTNL_LINK_REASM_OVERLAPS stat
5
6The new stat exposes IPSTATS_MIB_REASM_OVERLAPS link stat. However, the
7original motivation for this change was fixing the issue with missing RX
8packets link stat.
9
10The regression was introduced in version 3.5.0 with commit 73c1d047,
11that added a new enum constant IPSTATS_MIB_REASM_OVERLAPS. Without this
12patch, IPSTATS_MIB_REASM_OVERLAPS is missing from
13map_stat_id_from_IPSTATS_MIB_v2 and is mapped by it to 0. This tricks
14inet6_parse_protinfo() into erroneously overwriting RTNL_LINK_RX_PACKETS
15stat, which happens to have value 0, when it tries to set
16IPSTATS_MIB_REASM_OVERLAPS.
17
18Fixes: 73c1d0479643 ('Sync linux headers to 4.19.66')
19
20https://github.com/thom311/libnl/pull/235
21
22Conflict:NA
23Reference:https://github.com/thom311/libnl/commit/bab9e77c87d3b596e77d669b0a827b50e725bb62
24
25---
26 include/netlink/route/link.h | 1 +
27 lib/route/link.c             | 1 +
28 lib/route/link/inet6.c       | 1 +
29 3 files changed, 3 insertions(+)
30
31diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h
32index 516d8e16..d0d6d2b5 100644
33--- a/include/netlink/route/link.h
34+++ b/include/netlink/route/link.h
35@@ -93,6 +93,7 @@ typedef enum {
36 	RTNL_LINK_IP6_ECT0PKTS,		/*!< IPv6 SNMP InECT0Pkts */
37 	RTNL_LINK_IP6_CEPKTS,		/*!< IPv6 SNMP InCEPkts */
38 	RTNL_LINK_RX_NOHANDLER,		/*!< Received packets dropped on inactive device */
39+	RTNL_LINK_REASM_OVERLAPS,       /*!< SNMP ReasmOverlaps */
40 	__RTNL_LINK_STATS_MAX,
41 } rtnl_link_stat_id_t;
42
43diff --git a/lib/route/link.c b/lib/route/link.c
44index 9439fe6d..ed6f4558 100644
45--- a/lib/route/link.c
46+++ b/lib/route/link.c
47@@ -3007,6 +3007,7 @@ static const struct trans_tbl link_stats[] = {
48 	__ADD(RTNL_LINK_IP6_ECT0PKTS, Ip6_InECT0Pkts),
49 	__ADD(RTNL_LINK_IP6_CEPKTS, Ip6_InCEPkts),
50 	__ADD(RTNL_LINK_RX_NOHANDLER, rx_nohandler),
51+	__ADD(RTNL_LINK_REASM_OVERLAPS, ReasmOverlaps),
52 };
53
54 char *rtnl_link_stat2str(int st, char *buf, size_t len)
55diff --git a/lib/route/link/inet6.c b/lib/route/link/inet6.c
56index c977b617..1ad49bf1 100644
57--- a/lib/route/link/inet6.c
58+++ b/lib/route/link/inet6.c
59@@ -135,6 +135,7 @@ static const uint8_t map_stat_id_from_IPSTATS_MIB_v2[__IPSTATS_MIB_MAX] = {
60 	[33] = RTNL_LINK_IP6_ECT1PKTS,                  /* IPSTATS_MIB_ECT1PKTS                 */
61 	[34] = RTNL_LINK_IP6_ECT0PKTS,                  /* IPSTATS_MIB_ECT0PKTS                 */
62 	[35] = RTNL_LINK_IP6_CEPKTS,                    /* IPSTATS_MIB_CEPKTS                   */
63+	[36] = RTNL_LINK_REASM_OVERLAPS,                /* IPSTATS_MIB_REASM_OVERLAPS           */
64 };
65
66 static int inet6_parse_protinfo(struct rtnl_link *link, struct nlattr *attr,
67