Pull in fixes from upstream for interface enumeration, fixes segfault on SunOS.

Bump PKGREVISION.
This commit is contained in:
jperkin 2013-04-04 12:38:59 +00:00
parent de80ad4e04
commit 4542fd335c
3 changed files with 31 additions and 2 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.20 2012/12/06 12:24:04 roy Exp $
# $NetBSD: Makefile,v 1.21 2013/04/04 12:38:59 jperkin Exp $
#
DISTNAME= dnsmasq-2.64
PKGREVISION= 1
CATEGORIES= net
MASTER_SITES= http://www.thekelleys.org.uk/dnsmasq/
LICENSE= gnu-gpl-v3

View file

@ -1,5 +1,6 @@
$NetBSD: distinfo,v 1.17 2012/12/06 12:24:04 roy Exp $
$NetBSD: distinfo,v 1.18 2013/04/04 12:38:59 jperkin Exp $
SHA1 (dnsmasq-2.64.tar.gz) = 48368c2a4d75110d4b2d40d1ba6a821e7b3c1b0b
RMD160 (dnsmasq-2.64.tar.gz) = 84e5464259f7c697aec3adc199f9af462ef63fb9
Size (dnsmasq-2.64.tar.gz) = 536724 bytes
SHA1 (patch-src_bpf.c) = 4342823f90ad848d5cfef07ea6d82165676c1d64

View file

@ -0,0 +1,27 @@
$NetBSD: patch-src_bpf.c,v 1.1 2013/04/04 12:38:59 jperkin Exp $
Pull in upstream fixes for interface enumeration.
--- src/bpf.c.orig 2012-12-03 14:05:59.000000000 +0000
+++ src/bpf.c
@@ -111,7 +111,7 @@ int iface_enumerate(int family, void *pa
{
int iface_index = if_nametoindex(addrs->ifa_name);
- if (iface_index == 0)
+ if (iface_index == 0 || !addrs->ifa_addr || !addrs->ifa_netmask)
continue;
if (family == AF_INET)
@@ -119,7 +119,10 @@ int iface_enumerate(int family, void *pa
struct in_addr addr, netmask, broadcast;
addr = ((struct sockaddr_in *) addrs->ifa_addr)->sin_addr;
netmask = ((struct sockaddr_in *) addrs->ifa_netmask)->sin_addr;
- broadcast = ((struct sockaddr_in *) addrs->ifa_broadaddr)->sin_addr;
+ if (addrs->ifa_broadaddr)
+ broadcast = ((struct sockaddr_in *) addrs->ifa_broadaddr)->sin_addr;
+ else
+ broadcast.s_addr = 0;
if (!((*callback)(addr, iface_index, netmask, broadcast, parm)))
goto err;
}