[PATCH 3/5] OpenBSD getifaddrs returns netmask without sa_family

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So we relax netmask check and set to same family as ipaddr
if needed
---
 exec/totemip.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/exec/totemip.c b/exec/totemip.c
index b5b5a74..77bcad5 100644
--- a/exec/totemip.c
+++ b/exec/totemip.c
@@ -333,9 +333,14 @@ int totemip_getifaddrs(struct list_head *addrs)
 			continue ;
 
 		if ((ifa->ifa_addr->sa_family != AF_INET && ifa->ifa_addr->sa_family != AF_INET6) ||
-		    (ifa->ifa_netmask->sa_family != AF_INET && ifa->ifa_netmask->sa_family != AF_INET6))
+		    (ifa->ifa_netmask->sa_family != AF_INET && ifa->ifa_netmask->sa_family != AF_INET6 &&
+		     ifa->ifa_netmask->sa_family != 0))
 			continue ;
 
+		if (ifa->ifa_netmask->sa_family == 0) {
+			ifa->ifa_netmask->sa_family = ifa->ifa_addr->sa_family;
+		}
+
 		if_addr = malloc(sizeof(struct totem_ip_if_address));
 		if (if_addr == NULL) {
 			goto error_free_ifaddrs;
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux