summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2022-04-06 11:26:46 -0700
committerPablo Neira Ayuso <pablo@netfilter.org>2022-04-07 10:40:41 +0200
commit85ef87303df6b4b097a1495af2873a43ed3493d5 (patch)
treec2961a653b68ee103cd04ff4f7184c413b0fa521
parent493aacf2ec9cc61a5b30d77cd55ec248f033bc74 (diff)
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 <stephen@networkplumber.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--examples/rtnl/rtnl-neigh-dump.c8
1 files changed, 4 insertions, 4 deletions
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) {