mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-09-01 22:53:05 +00:00
netutils/netlib/netlib_getarptab.c: Per an old Linux Journal article, the nl_pid fild of struct sockaddr_nl should be set to the PID of the task that created the Netlink socket. Also fixes a warning.
This commit is contained in:
parent
91276ba94e
commit
f4f1ddccd7
1 changed files with 5 additions and 2 deletions
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include <sys/socket.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <errno.h>
|
||||
|
|
@ -135,11 +136,13 @@ ssize_t netlib_get_arptable(FAR struct arp_entry_s *arptab, unsigned int nentrie
|
|||
|
||||
/* Bind the socket so that we can use send() and receive() */
|
||||
|
||||
memset(&addr, 0, sizeof(struct sockaddr_nl));
|
||||
addr.nl_family = AF_NETLINK;
|
||||
addr.nl_pad = 0;
|
||||
addr.nl_pid = getpid();
|
||||
addr.nl_groups = RTM_GETNEIGH;
|
||||
|
||||
ret = bind(fd, &addr, sizeof( struct sockaddr_nl));
|
||||
ret = bind(fd, (FAR const struct sockaddr *)&addr,
|
||||
sizeof( struct sockaddr_nl));
|
||||
if (fd < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue