|
|
86f512 |
From fb287742d4221195708f5865fd5335d43e8a8a5d Mon Sep 17 00:00:00 2001
|
|
|
86f512 |
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
|
|
86f512 |
Date: Sat, 19 Oct 2019 10:44:36 +0200
|
|
|
86f512 |
Subject: [PATCH 64/76] rtnl_link: print pad field in the struct ifla_port_vsi
|
|
|
86f512 |
decoder
|
|
|
86f512 |
|
|
|
86f512 |
And steamline the flow a bit.
|
|
|
86f512 |
|
|
|
86f512 |
* rtnl_link.c (decode_ifla_port_vsi): Factor the printing code out of
|
|
|
86f512 |
the conditional statement, add pad field printing.
|
|
|
86f512 |
* tests/nlattr_ifla_port.c: Add check for the pad field printing.
|
|
|
86f512 |
---
|
|
|
86f512 |
rtnl_link.c | 19 ++++++++++++-------
|
|
|
86f512 |
tests/nlattr_ifla_port.c | 15 +++++++++++++++
|
|
|
86f512 |
2 files changed, 27 insertions(+), 7 deletions(-)
|
|
|
86f512 |
|
|
|
86f512 |
Index: strace-5.1/rtnl_link.c
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/rtnl_link.c 2020-01-29 12:36:17.631477314 +0100
|
|
|
86f512 |
+++ strace-5.1/rtnl_link.c 2020-01-29 12:36:19.726458084 +0100
|
|
|
86f512 |
@@ -560,13 +560,18 @@
|
|
|
86f512 |
|
|
|
86f512 |
if (len < sizeof(vsi))
|
|
|
86f512 |
return false;
|
|
|
86f512 |
- else if (!umove_or_printaddr(tcp, addr, &vsi)) {
|
|
|
86f512 |
- PRINT_FIELD_U("{", vsi, vsi_mgr_id);
|
|
|
86f512 |
- PRINT_FIELD_STRING(", ", vsi, vsi_type_id,
|
|
|
86f512 |
- sizeof(vsi.vsi_type_id), QUOTE_FORCE_HEX);
|
|
|
86f512 |
- PRINT_FIELD_U(", ", vsi, vsi_type_version);
|
|
|
86f512 |
- tprints("}");
|
|
|
86f512 |
- }
|
|
|
86f512 |
+ if (umove_or_printaddr(tcp, addr, &vsi))
|
|
|
86f512 |
+ return true;
|
|
|
86f512 |
+
|
|
|
86f512 |
+ PRINT_FIELD_U("{", vsi, vsi_mgr_id);
|
|
|
86f512 |
+ PRINT_FIELD_STRING(", ", vsi, vsi_type_id,
|
|
|
86f512 |
+ sizeof(vsi.vsi_type_id), QUOTE_FORCE_HEX);
|
|
|
86f512 |
+ PRINT_FIELD_U(", ", vsi, vsi_type_version);
|
|
|
86f512 |
+
|
|
|
86f512 |
+ if (!IS_ARRAY_ZERO(vsi.pad))
|
|
|
86f512 |
+ PRINT_FIELD_HEX_ARRAY(", ", vsi, pad);
|
|
|
86f512 |
+
|
|
|
86f512 |
+ tprints("}");
|
|
|
86f512 |
|
|
|
86f512 |
return true;
|
|
|
86f512 |
}
|
|
|
86f512 |
Index: strace-5.1/tests/nlattr_ifla_port.c
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/tests/nlattr_ifla_port.c 2018-12-10 01:00:00.000000000 +0100
|
|
|
86f512 |
+++ strace-5.1/tests/nlattr_ifla_port.c 2020-01-29 12:36:19.729458056 +0100
|
|
|
86f512 |
@@ -57,6 +57,21 @@
|
|
|
86f512 |
printf(", vsi_type_id=\"\\x61\\x62\\x63\"");
|
|
|
86f512 |
PRINT_FIELD_U(", ", vsi, vsi_type_version);
|
|
|
86f512 |
printf("}"));
|
|
|
86f512 |
+
|
|
|
86f512 |
+ static const struct ifla_port_vsi vsi2 = {
|
|
|
86f512 |
+ .vsi_mgr_id = 0xab,
|
|
|
86f512 |
+ .vsi_type_id = { 10, 0, 255 },
|
|
|
86f512 |
+ .vsi_type_version = 0xef,
|
|
|
86f512 |
+ .pad = { 0, 1, 2 },
|
|
|
86f512 |
+ };
|
|
|
86f512 |
+ TEST_NESTED_NLATTR_OBJECT(fd, nlh0, hdrlen,
|
|
|
86f512 |
+ init_ifinfomsg, print_ifinfomsg,
|
|
|
86f512 |
+ IFLA_PORT_VSI_TYPE, pattern, vsi2,
|
|
|
86f512 |
+ PRINT_FIELD_U("{", vsi2, vsi_mgr_id);
|
|
|
86f512 |
+ printf(", vsi_type_id=\"\\x0a\\x00\\xff\"");
|
|
|
86f512 |
+ PRINT_FIELD_U(", ", vsi2, vsi_type_version);
|
|
|
86f512 |
+ printf(", pad=\"\\x00\\x01\\x02\"");
|
|
|
86f512 |
+ printf("}"));
|
|
|
86f512 |
#endif
|
|
|
86f512 |
|
|
|
86f512 |
puts("+++ exited with 0 +++");
|
|
|
86f512 |
Index: strace-5.1/tests-m32/nlattr_ifla_port.c
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/tests-m32/nlattr_ifla_port.c 2018-12-10 01:00:00.000000000 +0100
|
|
|
86f512 |
+++ strace-5.1/tests-m32/nlattr_ifla_port.c 2020-01-29 12:36:51.841163297 +0100
|
|
|
86f512 |
@@ -57,6 +57,21 @@
|
|
|
86f512 |
printf(", vsi_type_id=\"\\x61\\x62\\x63\"");
|
|
|
86f512 |
PRINT_FIELD_U(", ", vsi, vsi_type_version);
|
|
|
86f512 |
printf("}"));
|
|
|
86f512 |
+
|
|
|
86f512 |
+ static const struct ifla_port_vsi vsi2 = {
|
|
|
86f512 |
+ .vsi_mgr_id = 0xab,
|
|
|
86f512 |
+ .vsi_type_id = { 10, 0, 255 },
|
|
|
86f512 |
+ .vsi_type_version = 0xef,
|
|
|
86f512 |
+ .pad = { 0, 1, 2 },
|
|
|
86f512 |
+ };
|
|
|
86f512 |
+ TEST_NESTED_NLATTR_OBJECT(fd, nlh0, hdrlen,
|
|
|
86f512 |
+ init_ifinfomsg, print_ifinfomsg,
|
|
|
86f512 |
+ IFLA_PORT_VSI_TYPE, pattern, vsi2,
|
|
|
86f512 |
+ PRINT_FIELD_U("{", vsi2, vsi_mgr_id);
|
|
|
86f512 |
+ printf(", vsi_type_id=\"\\x0a\\x00\\xff\"");
|
|
|
86f512 |
+ PRINT_FIELD_U(", ", vsi2, vsi_type_version);
|
|
|
86f512 |
+ printf(", pad=\"\\x00\\x01\\x02\"");
|
|
|
86f512 |
+ printf("}"));
|
|
|
86f512 |
#endif
|
|
|
86f512 |
|
|
|
86f512 |
puts("+++ exited with 0 +++");
|
|
|
86f512 |
Index: strace-5.1/tests-mx32/nlattr_ifla_port.c
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/tests-mx32/nlattr_ifla_port.c 2018-12-10 01:00:00.000000000 +0100
|
|
|
86f512 |
+++ strace-5.1/tests-mx32/nlattr_ifla_port.c 2020-01-29 12:36:51.843163278 +0100
|
|
|
86f512 |
@@ -57,6 +57,21 @@
|
|
|
86f512 |
printf(", vsi_type_id=\"\\x61\\x62\\x63\"");
|
|
|
86f512 |
PRINT_FIELD_U(", ", vsi, vsi_type_version);
|
|
|
86f512 |
printf("}"));
|
|
|
86f512 |
+
|
|
|
86f512 |
+ static const struct ifla_port_vsi vsi2 = {
|
|
|
86f512 |
+ .vsi_mgr_id = 0xab,
|
|
|
86f512 |
+ .vsi_type_id = { 10, 0, 255 },
|
|
|
86f512 |
+ .vsi_type_version = 0xef,
|
|
|
86f512 |
+ .pad = { 0, 1, 2 },
|
|
|
86f512 |
+ };
|
|
|
86f512 |
+ TEST_NESTED_NLATTR_OBJECT(fd, nlh0, hdrlen,
|
|
|
86f512 |
+ init_ifinfomsg, print_ifinfomsg,
|
|
|
86f512 |
+ IFLA_PORT_VSI_TYPE, pattern, vsi2,
|
|
|
86f512 |
+ PRINT_FIELD_U("{", vsi2, vsi_mgr_id);
|
|
|
86f512 |
+ printf(", vsi_type_id=\"\\x0a\\x00\\xff\"");
|
|
|
86f512 |
+ PRINT_FIELD_U(", ", vsi2, vsi_type_version);
|
|
|
86f512 |
+ printf(", pad=\"\\x00\\x01\\x02\"");
|
|
|
86f512 |
+ printf("}"));
|
|
|
86f512 |
#endif
|
|
|
86f512 |
|
|
|
86f512 |
puts("+++ exited with 0 +++");
|