]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile for prior on NetBSD
authorRoy Marples <roy@marples.name>
Tue, 19 May 2020 15:37:10 +0000 (16:37 +0100)
committerRoy Marples <roy@marples.name>
Tue, 19 May 2020 15:37:10 +0000 (16:37 +0100)
src/bpf.c
src/dhcp.c
src/if-bsd.c
src/if.c

index 0342c415386a4dc8571b41e5e0032c762cc7b15a..d81ecc53ed6cb398b71ceb9189d3b080095c1bca 100644 (file)
--- a/src/bpf.c
+++ b/src/bpf.c
@@ -162,8 +162,13 @@ bpf_open(const struct interface *ifp,
        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 @@ bpf_open(const struct interface *ifp,
        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
index e3f59726c8beb135bd5836d9e81b3e05f734ff77..43bd2f8d73df91ccf20844f519d10eb0f42efe76 100644 (file)
@@ -2072,7 +2072,14 @@ dhcp_addr_duplicated(struct interface *ifp, struct in_addr *ia)
 #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 @@ dhcp_arp_found(struct arp_state *astate, const struct arp_msg *amsg)
 }
 #endif
 
-#ifdef KERNEL_RFC5227
-static void
-dhcp_arp_announced(struct arp_state *state)
-{
-
-       arp_free(state);
-}
-#endif /* KERNEL_RFC5227 */
 #endif /* ARP */
 
 void
index 2d9bbb2a00b6176c5f57303e270d5fe1af689551..981f9b2a14443dd974bf4c415c536ba34ad9ca3c 100644 (file)
@@ -175,7 +175,7 @@ if_opensockets_os(struct dhcpcd_ctx *ctx)
 #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.
index 627be05a4398f3d688ce67925f6941b9708d956e..667819d2dd35e0c9482ab4026910332cd552d157 100644 (file)
--- a/src/if.c
+++ b/src/if.c
@@ -884,9 +884,6 @@ xsocket(int domain, int type, int protocol)
 #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)