one more fix (#806342)

This commit is contained in:
Jiri Popelka 2012-03-23 20:07:34 +01:00
parent 5809fa5584
commit 30f41aa41d
2 changed files with 16 additions and 11 deletions

View File

@ -1,6 +1,6 @@
diff -up dhcp-4.2.3-P2/common/discover.c.getifaddrs dhcp-4.2.3-P2/common/discover.c
--- dhcp-4.2.3-P2/common/discover.c.getifaddrs 2012-03-23 18:07:54.744082263 +0100
+++ dhcp-4.2.3-P2/common/discover.c 2012-03-23 18:14:37.213050709 +0100
--- dhcp-4.2.3-P2/common/discover.c.getifaddrs 2012-03-23 18:15:12.710606929 +0100
+++ dhcp-4.2.3-P2/common/discover.c 2012-03-23 20:03:41.238239134 +0100
@@ -379,394 +379,13 @@ end_iface_scan(struct iface_conf_list *i
ifaces->sock = -1;
}
@ -406,22 +406,24 @@ 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,16 @@ next_iface(struct iface_info *info, int
@@ -825,8 +446,18 @@ 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);
+
+#if __linux
+ if (ifaces->next->ifa_addr->sa_family == AF_INET)
+ sa_len = sizeof(struct sockaddr_in);
+ else if (ifaces->next->ifa_addr->sa_family == AF_INET6)
+ sa_len = sizeof(struct sockaddr_in6);
+ if (ifaces->next->ifa_addr != NULL) {
+#if defined(__linux)
+ if (ifaces->next->ifa_addr->sa_family == AF_INET)
+ sa_len = sizeof(struct sockaddr_in);
+ else if (ifaces->next->ifa_addr->sa_family == AF_INET6)
+ sa_len = sizeof(struct sockaddr_in6);
+#else
+ sa_len = ifaces->next->ifa_addr->sa_len
+ sa_len = ifaces->next->ifa_addr->sa_len;
+#endif
+ memcpy(&info->addr, ifaces->next->ifa_addr, sa_len);
+ memcpy(&info->addr, ifaces->next->ifa_addr, sa_len);
+ }
info->flags = ifaces->next->ifa_flags;
ifaces->next = ifaces->next->ifa_next;
*err = 0;

View File

@ -22,7 +22,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.2.3
Release: 23.%{patchver}%{?dist}
Release: 24.%{patchver}%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was.
@ -624,6 +624,9 @@ fi
%changelog
* Fri Mar 23 2012 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.3-24.P2
- one more fix (#806342)
* Fri Mar 23 2012 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.3-23.P2
- improve #449946 fix (#806342)