nshlib: use rtgenmsg for netlib_get_arptable/netlib_get_nbtable lik Linux

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0b28eea6a70d0b5f6c5beef26f6624edfb3d6c86
This commit is contained in:
Xiang Xiao 2020-04-09 08:14:55 -04:00 committed by patacongo
parent 300bc2729a
commit 63157f3a4d
2 changed files with 14 additions and 14 deletions

View File

@ -60,7 +60,7 @@
struct netlib_sendto_request_s struct netlib_sendto_request_s
{ {
struct nlmsghdr hdr; struct nlmsghdr hdr;
struct ndmsg msg; struct rtgenmsg gen;
}; };
struct netlib_recvfrom_response_s struct netlib_recvfrom_response_s
@ -158,12 +158,12 @@ ssize_t netlib_get_arptable(FAR struct arp_entry_s *arptab,
thiseq = ++seqno; thiseq = ++seqno;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.hdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)); req.hdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
req.hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; req.hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
req.hdr.nlmsg_seq = thiseq; req.hdr.nlmsg_seq = thiseq;
req.hdr.nlmsg_type = RTM_GETNEIGH; req.hdr.nlmsg_type = RTM_GETNEIGH;
req.hdr.nlmsg_pid = pid; req.hdr.nlmsg_pid = pid;
req.msg.ndm_family = AF_INET; req.gen.rtgen_family = AF_INET;
nsent = send(fd, &req, req.hdr.nlmsg_len, 0); nsent = send(fd, &req, req.hdr.nlmsg_len, 0);
if (nsent < 0) if (nsent < 0)

View File

@ -60,7 +60,7 @@
struct netlib_sendto_request_s struct netlib_sendto_request_s
{ {
struct nlmsghdr hdr; struct nlmsghdr hdr;
struct ndmsg msg; struct rtgenmsg gen;
}; };
struct netlib_recvfrom_response_s struct netlib_recvfrom_response_s
@ -159,12 +159,12 @@ ssize_t netlib_get_nbtable(FAR struct neighbor_entry_s *nbtab,
thiseq = ++seqno; thiseq = ++seqno;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.hdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)); req.hdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
req.hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; req.hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
req.hdr.nlmsg_seq = thiseq; req.hdr.nlmsg_seq = thiseq;
req.hdr.nlmsg_type = RTM_GETNEIGH; req.hdr.nlmsg_type = RTM_GETNEIGH;
req.hdr.nlmsg_pid = pid; req.hdr.nlmsg_pid = pid;
req.msg.ndm_family = AF_INET6; req.gen.rtgen_family = AF_INET6;
nsent = send(fd, &req, req.hdr.nlmsg_len, 0); nsent = send(fd, &req, req.hdr.nlmsg_len, 0);
if (nsent < 0) if (nsent < 0)