Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
	* sysdeps/unix/sysv/linux/ifaddrs.c (netlink_open): Call getsockname
	to get the actual PID value used in the records passed up.
	(getifaddrs): Don't initialize nh.pid here.

2003-06-02  Ulrich Drepper  <drepper@redhat.com>
  • Loading branch information
Ulrich Drepper committed Jun 3, 2003
1 parent 7aebf85 commit 332afd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2003-06-02 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/sysv/linux/ifaddrs.c (netlink_open): Call getsockname
to get the actual PID value used in the records passed up.
(getifaddrs): Don't initialize nh.pid here.

2003-06-02 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/sysv/linux/ifaddrs.c (netlink_receive): Minor
Expand Down
10 changes: 8 additions & 2 deletions sysdeps/unix/sysv/linux/ifaddrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,17 @@ netlink_open (struct netlink_handle *h)
nladdr.nl_family = AF_NETLINK;
if (__bind (h->fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) < 0)
{
close_and_out:
netlink_close (h);
return -1;
}
/* Determine the ID the kernel assigned for this netlink connection.
It is not necessarily the PID if there is more than one socket
open. */
socklen_t addr_len = sizeof (nladdr);
if (__getsockname (h->fd, (struct sockaddr *) &nladdr, &addr_len) < 0)
goto close_and_out;
h->pid = nladdr.nl_pid;
return 0;
}

Expand Down Expand Up @@ -303,8 +311,6 @@ getifaddrs (struct ifaddrs **ifap)
return fallback_getifaddrs (ifap);
#endif

nh.pid = getpid ();

/* Tell the kernel that we wish to get a list of all
active interfaces. */
if (netlink_sendreq (&nh, RTM_GETLINK) < 0)
Expand Down

0 comments on commit 332afd9

Please sign in to comment.