[dhcp] Another improvement of getifaddrs.patch

Jiří Popelka jpopelka at fedoraproject.org
Mon Mar 26 17:24:01 UTC 2012


commit f0f508f3bfb1cd11491ff6b44a9cb6b3f30795c9
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Mon Mar 26 19:19:37 2012 +0200

    Another improvement of getifaddrs.patch

 dhcp-4.2.3-P2-getifaddrs.patch |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/dhcp-4.2.3-P2-getifaddrs.patch b/dhcp-4.2.3-P2-getifaddrs.patch
index f84e9ab..b8a5048 100644
--- a/dhcp-4.2.3-P2-getifaddrs.patch
+++ b/dhcp-4.2.3-P2-getifaddrs.patch
@@ -406,14 +406,20 @@ diff -up dhcp-4.2.3-P2/common/discover.c.getifaddrs dhcp-4.2.3-P2/common/discove
  	if (ifaces->next == NULL) {
  		*err = 0;
  		return 0;
-@@ -825,8 +446,18 @@ next_iface(struct iface_info *info, int
+@@ -825,8 +446,24 @@ next_iface(struct iface_info *info, int
  		return 0;
  	}
  	strcpy(info->name, ifaces->next->ifa_name);
 -	memcpy(&info->addr, ifaces->next->ifa_addr, 
 -	       ifaces->next->ifa_addr->sa_len);
 +
++	memset(&info->addr, 0 , sizeof(info->addr));
++	/*
++	 * getifaddrs() can on Linux with some interfaces like PPP or TEQL
++	 * result in a record with no address (ifa_addr).
++	 */
 +	if (ifaces->next->ifa_addr != NULL) {
++/* Linux lacks the sa_len member in struct sockaddr. */
 +#if defined(__linux)
 +		if (ifaces->next->ifa_addr->sa_family == AF_INET)
 +			sa_len = sizeof(struct sockaddr_in);


More information about the scm-commits mailing list