]> granicus.if.org Git - strace/commitdiff
rtnl_link: add new IFLA_XDP_* attributes
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 19 Aug 2018 09:14:27 +0000 (11:14 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 27 Aug 2018 23:41:41 +0000 (23:41 +0000)
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
tests/nlattr_ifla_xdp.c
xlat/rtnl_ifla_xdp_attrs.in

index 1fbfd26714747dfcad67998d5f821d7068785f6b..6f63d7fcbf0053c031e842af9a1430d8f3ede8b5 100644 (file)
@@ -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
index 93149fa9bc7a061b15e8b0ed5a98ee3e911cda37..c98f8a3f3dd9d4fc70a4ef307b5c91c8b6e9c622 100644 (file)
@@ -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;
 }
index ef3f458f79141a97e0f6cec06d7dc5b614c253d9..b12958f5700fc4a80d6e6e9abf8362577b8f90ab 100644 (file)
@@ -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