diff options
-rw-r--r-- | src/rtnl_link.c | 2 | ||||
-rw-r--r-- | src/xlat/rtnl_link_attrs.in | 2 | ||||
-rw-r--r-- | tests/nlattr_ifinfomsg.c | 36 |
3 files changed, 27 insertions, 13 deletions
diff --git a/src/rtnl_link.c b/src/rtnl_link.c index 2769ad917..f6f585d4d 100644 --- a/src/rtnl_link.c +++ b/src/rtnl_link.c @@ -1003,6 +1003,8 @@ static const nla_decoder_t ifinfomsg_nla_decoders[] = { [IFLA_ALT_IFNAME] = decode_nla_str, [IFLA_PERM_ADDRESS] = decode_ifla_hwaddr, [IFLA_PROTO_DOWN_REASON] = decode_ifla_proto_down_reason, + [IFLA_PARENT_DEV_NAME] = decode_nla_str, + [IFLA_PARENT_DEV_BUS_NAME] = decode_nla_str, }; DECL_NETLINK_ROUTE_DECODER(decode_ifinfomsg) diff --git a/src/xlat/rtnl_link_attrs.in b/src/xlat/rtnl_link_attrs.in index 16f1bbb2c..6649d232f 100644 --- a/src/xlat/rtnl_link_attrs.in +++ b/src/xlat/rtnl_link_attrs.in @@ -56,3 +56,5 @@ IFLA_PROP_LIST IFLA_ALT_IFNAME IFLA_PERM_ADDRESS IFLA_PROTO_DOWN_REASON +IFLA_PARENT_DEV_NAME +IFLA_PARENT_DEV_BUS_NAME diff --git a/tests/nlattr_ifinfomsg.c b/tests/nlattr_ifinfomsg.c index ff09dc1cd..c09ea9dd4 100644 --- a/tests/nlattr_ifinfomsg.c +++ b/tests/nlattr_ifinfomsg.c @@ -446,20 +446,30 @@ main(void) print_quoted_memory(&buf, sizeof(buf)); printf("...")); - /* IFLA_ALT_IFNAME */ - static const char alt_ifname[] = "OH HAI THAR\r\n\t\377\0\v\x7e"; - TEST_NLATTR(fd, nlh0, hdrlen, - init_ifinfomsg, print_ifinfomsg, - IFLA_ALT_IFNAME, - sizeof(alt_ifname), alt_ifname, sizeof(alt_ifname), - print_quoted_memory(alt_ifname, sizeof(alt_ifname) - 1)); + /* IFLA_ALT_IFNAME, IFLA_PARENT_DEV_NAME, IFLA_PARENT_DEV_BUS_NAME */ + static const char str[] = "OH HAI THAR\r\n\t\377\0\v\x7e"; + static const struct { + uint32_t val; + const char *str; + } attrs[] = { + { ARG_STR(IFLA_ALT_IFNAME) }, + { ARG_STR(IFLA_PARENT_DEV_NAME) }, + { ARG_STR(IFLA_PARENT_DEV_BUS_NAME) }, + }; + for (size_t i = 0; i < ARRAY_SIZE(attrs); i++) { + TEST_NLATTR_(fd, nlh0, hdrlen, + init_ifinfomsg, print_ifinfomsg, + attrs[i].val, attrs[i].str, + sizeof(str), str, sizeof(str), + print_quoted_memory(str, sizeof(str) - 1)); - TEST_NLATTR(fd, nlh0, hdrlen, - init_ifinfomsg, print_ifinfomsg, - IFLA_ALT_IFNAME, - sizeof(alt_ifname) - 1, alt_ifname, sizeof(alt_ifname) - 1, - print_quoted_memory(alt_ifname, sizeof(alt_ifname) - 1); - printf("...")); + TEST_NLATTR_(fd, nlh0, hdrlen, + init_ifinfomsg, print_ifinfomsg, + attrs[i].val, attrs[i].str, + sizeof(str) - 1, str, sizeof(str) - 1, + print_quoted_memory(str, sizeof(str) - 1); + printf("...")); + } puts("+++ exited with 0 +++"); return 0; |