# HG changeset patch # User Roy Marples # Date 1589902630 -3600 # Node ID d09c879cc4d5d9efa750c8ef13e4037d7933113a # Parent a2c342295221d88bfc80fb20d38d6bee7d994716 Fix compile for prior on NetBSD diff -r a2c342295221 -r d09c879cc4d5 src/bpf.c --- a/src/bpf.c Tue May 19 16:19:05 2020 +0100 +++ b/src/bpf.c Tue May 19 16:37:10 2020 +0100 @@ -162,8 +162,13 @@ int fd_opts; #endif + bpf = calloc(1, sizeof(*bpf)); + if (bpf == NULL) + return NULL; + bpf->bpf_ifp = ifp; + #ifdef _PATH_BPF - fd = open(_PATH_BPF, O_RDWR | O_NONBLOCK + bpf->bpf_fd = open(_PATH_BPF, O_RDWR | O_NONBLOCK #ifdef O_CLOEXEC | O_CLOEXEC #endif @@ -172,11 +177,6 @@ char device[32]; int n = 0; - bpf = calloc(1, sizeof(*bpf)); - if (bpf == NULL) - return NULL; - bpf->bpf_ifp = ifp; - do { snprintf(device, sizeof(device), "/dev/bpf%d", n++); bpf->bpf_fd = open(device, O_RDWR | O_NONBLOCK diff -r a2c342295221 -r d09c879cc4d5 src/dhcp.c --- a/src/dhcp.c Tue May 19 16:19:05 2020 +0100 +++ b/src/dhcp.c Tue May 19 16:37:10 2020 +0100 @@ -2072,7 +2072,14 @@ #endif #ifdef ARP -#ifndef KERNEL_RFC5227 +#ifdef KERNEL_RFC5227 +static void +dhcp_arp_announced(struct arp_state *state) +{ + + arp_free(state); +} +#else static void dhcp_arp_defend_failed(struct arp_state *astate) { @@ -2200,14 +2207,6 @@ } #endif -#ifdef KERNEL_RFC5227 -static void -dhcp_arp_announced(struct arp_state *state) -{ - - arp_free(state); -} -#endif /* KERNEL_RFC5227 */ #endif /* ARP */ void diff -r a2c342295221 -r d09c879cc4d5 src/if-bsd.c --- a/src/if-bsd.c Tue May 19 16:19:05 2020 +0100 +++ b/src/if-bsd.c Tue May 19 16:37:10 2020 +0100 @@ -175,7 +175,7 @@ #ifdef SO_RERROR n = 1; if (setsockopt(ctx->link_fd, SOL_SOCKET, SO_RERROR, &n,sizeof(n)) == -1) - goto errexit; + logerr("%s: SO_RERROR", __func__); #endif /* Ignore our own route(4) messages. diff -r a2c342295221 -r d09c879cc4d5 src/if.c --- a/src/if.c Tue May 19 16:19:05 2020 +0100 +++ b/src/if.c Tue May 19 16:37:10 2020 +0100 @@ -884,9 +884,6 @@ #if !defined(HAVE_SOCK_CLOEXEC) || !defined(HAVE_SOCK_NONBLOCK) int xflags, xtype = type; #endif -#ifdef SO_RERROR - int on; -#endif #ifndef HAVE_SOCK_CLOEXEC if (xtype & SOCK_CLOEXEC)