From: JingPiao Chen Date: Mon, 28 Aug 2017 08:13:56 +0000 (+0800) Subject: rtnl_neigh: fix ndm_type field decode in struct ndmsg X-Git-Tag: v4.19~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62c573a002f905659cc9f4f21115fa2a9671ff8b;p=strace rtnl_neigh: fix ndm_type field decode in struct ndmsg * defs.h (routing_types): New xlat prototype. * rtnl_neigh.c (decode_ndmsg): Fix ndm_type decode. * xlat/nda_types.in: Remove it. * tests/netlink_route.c (test_rtnl_neigh): Update the test. * tests/nlattr_ndmsg.c (init_ndmsg, print_ndmsg): Likewise. --- diff --git a/defs.h b/defs.h index e37c555b..5323920c 100644 --- a/defs.h +++ b/defs.h @@ -294,6 +294,7 @@ extern const struct xlat open_mode_flags[]; extern const struct xlat resource_flags[]; extern const struct xlat routing_scopes[]; extern const struct xlat routing_table_ids[]; +extern const struct xlat routing_types[]; extern const struct xlat setns_types[]; extern const struct xlat sg_io_info[]; extern const struct xlat socketlayers[]; diff --git a/rtnl_neigh.c b/rtnl_neigh.c index 2ce237a6..7191ecba 100644 --- a/rtnl_neigh.c +++ b/rtnl_neigh.c @@ -38,7 +38,6 @@ # include #endif -#include "xlat/nda_types.h" #include "xlat/neighbor_cache_entry_flags.h" #include "xlat/neighbor_cache_entry_states.h" #include "xlat/rtnl_neigh_attrs.h" @@ -64,7 +63,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_ndmsg) neighbor_cache_entry_flags, "NTF_???"); PRINT_FIELD_XVAL(", ", ndmsg, ndm_type, - nda_types, "NDA_???"); + routing_types, "RTN_???"); decode_nla = true; } } else diff --git a/tests/netlink_route.c b/tests/netlink_route.c index f9bd0d8e..6af3b13a 100644 --- a/tests/netlink_route.c +++ b/tests/netlink_route.c @@ -308,7 +308,7 @@ test_rtnl_neigh(const int fd) .ndm_ifindex = ifindex_lo(), .ndm_state = NUD_PERMANENT, .ndm_flags = NTF_PROXY, - .ndm_type = NDA_UNSPEC + .ndm_type = RTN_UNSPEC }; TEST_NL_ROUTE(fd, nlh0, RTM_GETNEIGH, msg, @@ -316,7 +316,7 @@ test_rtnl_neigh(const int fd) printf(", ndm_ifindex=" IFINDEX_LO_STR ", ndm_state=NUD_PERMANENT" ", ndm_flags=NTF_PROXY" - ", ndm_type=NDA_UNSPEC}")); + ", ndm_type=RTN_UNSPEC}")); } static void diff --git a/tests/nlattr_ndmsg.c b/tests/nlattr_ndmsg.c index adf51479..67aee883 100644 --- a/tests/nlattr_ndmsg.c +++ b/tests/nlattr_ndmsg.c @@ -50,7 +50,7 @@ init_ndmsg(struct nlmsghdr *const nlh, const unsigned int msg_len) .ndm_ifindex = ifindex_lo(), .ndm_state = NUD_PERMANENT, .ndm_flags = NTF_PROXY, - .ndm_type = NDA_UNSPEC + .ndm_type = RTN_UNSPEC ); } @@ -62,7 +62,7 @@ print_ndmsg(const unsigned int msg_len) ", ndm_ifindex=" IFINDEX_LO_STR ", ndm_state=NUD_PERMANENT" ", ndm_flags=NTF_PROXY" - ", ndm_type=NDA_UNSPEC}", + ", ndm_type=RTN_UNSPEC}", msg_len); } diff --git a/xlat/nda_types.in b/xlat/nda_types.in deleted file mode 100644 index fed013a1..00000000 --- a/xlat/nda_types.in +++ /dev/null @@ -1,12 +0,0 @@ -NDA_UNSPEC 0 -NDA_DST 1 -NDA_LLADDR 2 -NDA_CACHEINFO 3 -NDA_PROBES 4 -NDA_VLAN 5 -NDA_PORT 6 -NDA_VNI 7 -NDA_IFINDEX 8 -NDA_MASTER 9 -NDA_LINK_NETNSID 10 -NDA_SRC_VNI 11