From 85ef87303df6b4b097a1495af2873a43ed3493d5 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 6 Apr 2022 11:26:46 -0700 Subject: examples: format neigh dump correctly The request to dump neighbours was attaching a generic route message header but the proper header (used by iproute2) is to use ndmsg. The original way works but better to format the message as a neighbour request. Signed-off-by: Stephen Hemminger Signed-off-by: Pablo Neira Ayuso --- examples/rtnl/rtnl-neigh-dump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/rtnl/rtnl-neigh-dump.c b/examples/rtnl/rtnl-neigh-dump.c index 786e31d..8dd5f7e 100644 --- a/examples/rtnl/rtnl-neigh-dump.c +++ b/examples/rtnl/rtnl-neigh-dump.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) unsigned int seq, portid; struct mnl_socket *nl; struct nlmsghdr *nlh; - struct rtgenmsg *rt; + struct ndmsg *nd; int ret; if (argc != 2) { @@ -116,11 +116,11 @@ int main(int argc, char *argv[]) nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; nlh->nlmsg_seq = seq = time(NULL); - rt = mnl_nlmsg_put_extra_header(nlh, sizeof(struct rtgenmsg)); + nd = mnl_nlmsg_put_extra_header(nlh, sizeof(struct ndmsg)); if (strcmp(argv[1], "inet") == 0) - rt->rtgen_family = AF_INET; + nd->ndm_family = AF_INET; else if (strcmp(argv[1], "inet6") == 0) - rt->rtgen_family = AF_INET6; + nd->ndm_family = AF_INET6; nl = mnl_socket_open(NETLINK_ROUTE); if (nl == NULL) { -- cgit v1.2.1