strace/rtnl_link-add-new-IFLA_XDP_-attributes.patch
2019-09-30 11:17:43 -04:00

102 lines
2.8 KiB
Diff

From eded21f5c020cb5cdbf10dadf818746ca094a48a Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Sun, 19 Aug 2018 11:14:27 +0200
Subject: [PATCH 024/293] rtnl_link: add new IFLA_XDP_* attributes
Introduced by Linux commit v4.19-rc1~140^2~364^2~6^2~6.
* xlat/rtnl_ifla_xdp_attrs.in (IFLA_XDP_DRV_PROG_ID,
IFLA_XDP_SKB_PROG_ID, IFLA_XDP_HW_PROG_ID): New constants.
* rtnl_link.c (ifla_xdp_nla_decoders): Add decoders for
IFLA_XDP_DRV_PROG_ID, IFLA_XDP_SKB_PROG_ID, and IFLA_XDP_HW_PROG_ID.
* tests/nlattr_ifla_xdp.c: Add checks for new attributes.
---
rtnl_link.c | 5 ++++-
tests/nlattr_ifla_xdp.c | 35 +++++++++++++++++++++++++++++++++++
xlat/rtnl_ifla_xdp_attrs.in | 3 +++
3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/rtnl_link.c b/rtnl_link.c
index 1fbfd26..6f63d7f 100644
--- a/rtnl_link.c
+++ b/rtnl_link.c
@@ -578,7 +578,10 @@ static const nla_decoder_t ifla_xdp_nla_decoders[] = {
[IFLA_XDP_FD] = decode_nla_fd,
[IFLA_XDP_ATTACHED] = decode_nla_u8,
[IFLA_XDP_FLAGS] = decode_ifla_xdp_flags,
- [IFLA_XDP_PROG_ID] = decode_nla_u32
+ [IFLA_XDP_PROG_ID] = decode_nla_u32,
+ [IFLA_XDP_DRV_PROG_ID] = decode_nla_u32,
+ [IFLA_XDP_SKB_PROG_ID] = decode_nla_u32,
+ [IFLA_XDP_HW_PROG_ID] = decode_nla_u32,
};
static bool
diff --git a/tests/nlattr_ifla_xdp.c b/tests/nlattr_ifla_xdp.c
index 93149fa..c98f8a3 100644
--- a/tests/nlattr_ifla_xdp.c
+++ b/tests/nlattr_ifla_xdp.c
@@ -44,6 +44,22 @@ enum { IFLA_XDP = 43 };
# define IFLA_XDP_FD 1
#endif
+#ifndef IFLA_XDP_PROG_ID
+# define IFLA_XDP_PROG_ID 4
+#endif
+
+#ifndef IFLA_XDP_DRV_PROG_ID
+# define IFLA_XDP_DRV_PROG_ID 5
+#endif
+
+#ifndef IFLA_XDP_SKB_PROG_ID
+# define IFLA_XDP_SKB_PROG_ID 6
+#endif
+
+#ifndef IFLA_XDP_HW_PROG_ID
+# define IFLA_XDP_HW_PROG_ID 7
+#endif
+
#define IFLA_ATTR IFLA_XDP
#include "nlattr_ifla.h"
@@ -73,6 +89,25 @@ main(void)
printf("XDP_FLAGS_UPDATE_IF_NOEXIST"));
#endif
+ static const struct {
+ uint32_t val;
+ const char *str;
+ } attrs[] = {
+ { ARG_STR(IFLA_XDP_PROG_ID) },
+ { ARG_STR(IFLA_XDP_DRV_PROG_ID) },
+ { ARG_STR(IFLA_XDP_SKB_PROG_ID) },
+ { ARG_STR(IFLA_XDP_HW_PROG_ID) },
+ };
+
+ for (size_t i = 0; i < ARRAY_SIZE(attrs); i++) {
+ TEST_NESTED_NLATTR_OBJECT_EX_(fd, nlh0, hdrlen,
+ init_ifinfomsg, print_ifinfomsg,
+ attrs[i].val, attrs[i].str,
+ pattern, num,
+ print_quoted_hex, 1,
+ printf("%u", num));
+ }
+
puts("+++ exited with 0 +++");
return 0;
}
diff --git a/xlat/rtnl_ifla_xdp_attrs.in b/xlat/rtnl_ifla_xdp_attrs.in
index ef3f458..b12958f 100644
--- a/xlat/rtnl_ifla_xdp_attrs.in
+++ b/xlat/rtnl_ifla_xdp_attrs.in
@@ -3,3 +3,6 @@ IFLA_XDP_FD 1
IFLA_XDP_ATTACHED 2
IFLA_XDP_FLAGS 3
IFLA_XDP_PROG_ID 4
+IFLA_XDP_DRV_PROG_ID 5
+IFLA_XDP_SKB_PROG_ID 6
+IFLA_XDP_HW_PROG_ID 7
--
1.7.12.4