Module Name:    src
Committed By:   roy
Date:           Fri Nov 14 12:00:54 UTC 2014

Modified Files:
        src/external/bsd/dhcpcd/dist: arp.c auth.c auth.h common.c config.h
            defs.h dhcp.c dhcpcd.c dhcpcd.h eloop.c if-options.c ipv4.c
            ipv4ll.c ipv4ll.h ipv6.h ipv6nd.h

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/arp.c \
    src/external/bsd/dhcpcd/dist/auth.c src/external/bsd/dhcpcd/dist/auth.h \
    src/external/bsd/dhcpcd/dist/common.c \
    src/external/bsd/dhcpcd/dist/config.h src/external/bsd/dhcpcd/dist/defs.h \
    src/external/bsd/dhcpcd/dist/dhcpcd.h \
    src/external/bsd/dhcpcd/dist/eloop.c src/external/bsd/dhcpcd/dist/ipv4.c \
    src/external/bsd/dhcpcd/dist/ipv4ll.c \
    src/external/bsd/dhcpcd/dist/ipv4ll.h src/external/bsd/dhcpcd/dist/ipv6.h \
    src/external/bsd/dhcpcd/dist/ipv6nd.h
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/dhcpcd/dist/dhcp.c
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/dhcpcd.c
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/if-options.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/dhcpcd/dist/arp.c
diff -u src/external/bsd/dhcpcd/dist/arp.c:1.6 src/external/bsd/dhcpcd/dist/arp.c:1.7
--- src/external/bsd/dhcpcd/dist/arp.c:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/arp.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: arp.c,v 1.6 2014/11/07 20:51:02 roy Exp $");
+ __RCSID("$NetBSD: arp.c,v 1.7 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -320,8 +320,10 @@ arp_free(struct arp_state *astate)
 		eloop_timeout_delete(astate->iface->ctx->eloop, NULL, astate);
 		state = D_STATE(astate->iface);
 		TAILQ_REMOVE(&state->arp_states, astate, next);
-		if (state->arp_ipv4ll == astate)
+		if (state->arp_ipv4ll == astate) {
+			ipv4ll_stop(astate->iface);
 			state->arp_ipv4ll = NULL;
+		}
 		free(astate);
 	}
 }
@@ -355,6 +357,10 @@ arp_close(struct interface *ifp)
 	}
 
 	while ((astate = TAILQ_FIRST(&state->arp_states))) {
+#ifndef __clang_analyzer__
+		/* clang guard needed for a more compex variant on this bug:
+		 * http://llvm.org/bugs/show_bug.cgi?id=18222 */
 		arp_free(astate);
+#endif
 	}
 }
Index: src/external/bsd/dhcpcd/dist/auth.c
diff -u src/external/bsd/dhcpcd/dist/auth.c:1.6 src/external/bsd/dhcpcd/dist/auth.c:1.7
--- src/external/bsd/dhcpcd/dist/auth.c:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/auth.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: auth.c,v 1.6 2014/11/07 20:51:02 roy Exp $");
+ __RCSID("$NetBSD: auth.c,v 1.7 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -29,7 +29,6 @@
  */
 
 #include <sys/file.h>
-#include <sys/queue.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
Index: src/external/bsd/dhcpcd/dist/auth.h
diff -u src/external/bsd/dhcpcd/dist/auth.h:1.6 src/external/bsd/dhcpcd/dist/auth.h:1.7
--- src/external/bsd/dhcpcd/dist/auth.h:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/auth.h	Fri Nov 14 12:00:54 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: auth.h,v 1.6 2014/11/07 20:51:02 roy Exp $ */
+/* $NetBSD: auth.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #ifndef AUTH_H
 #define AUTH_H
 
-#include <sys/queue.h>
+#include "config.h"
 
 #define DHCPCD_AUTH_SEND	(1 << 0)
 #define DHCPCD_AUTH_REQUIRE	(1 << 1)
Index: src/external/bsd/dhcpcd/dist/common.c
diff -u src/external/bsd/dhcpcd/dist/common.c:1.6 src/external/bsd/dhcpcd/dist/common.c:1.7
--- src/external/bsd/dhcpcd/dist/common.c:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/common.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: common.c,v 1.6 2014/11/07 20:51:02 roy Exp $");
+ __RCSID("$NetBSD: common.c,v 1.7 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -33,10 +33,6 @@
 #  define _GNU_SOURCE
 #endif
 
-#ifndef __sun
-#  include <sys/cdefs.h>
-#endif
-
 #ifdef __APPLE__
 #  include <mach/mach_time.h>
 #  include <mach/kern_return.h>
Index: src/external/bsd/dhcpcd/dist/config.h
diff -u src/external/bsd/dhcpcd/dist/config.h:1.6 src/external/bsd/dhcpcd/dist/config.h:1.7
--- src/external/bsd/dhcpcd/dist/config.h:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/config.h	Fri Nov 14 12:00:54 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: config.h,v 1.6 2014/11/07 20:51:02 roy Exp $ */
+/* $NetBSD: config.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
 
 /* netbsd */
 #define SYSCONFDIR	"/etc"
@@ -7,6 +7,7 @@
 #define LIBEXECDIR	"/libexec"
 #define DBDIR		"/var/db"
 #define RUNDIR		"/var/run"
+#include		<sys/queue.h>
 #define HAVE_SPAWN_H
 #define HAVE_MD5_H
 #define SHA2_H		<sha2.h>
Index: src/external/bsd/dhcpcd/dist/defs.h
diff -u src/external/bsd/dhcpcd/dist/defs.h:1.6 src/external/bsd/dhcpcd/dist/defs.h:1.7
--- src/external/bsd/dhcpcd/dist/defs.h:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/defs.h	Fri Nov 14 12:00:54 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.6 2014/11/07 20:51:02 roy Exp $ */
+/* $NetBSD: defs.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"6.6.1"
+#define VERSION			"6.6.2"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"
Index: src/external/bsd/dhcpcd/dist/dhcpcd.h
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.h:1.6 src/external/bsd/dhcpcd/dist/dhcpcd.h:1.7
--- src/external/bsd/dhcpcd/dist/dhcpcd.h:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd.h	Fri Nov 14 12:00:54 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dhcpcd.h,v 1.6 2014/11/07 20:51:02 roy Exp $ */
+/* $NetBSD: dhcpcd.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,10 +30,10 @@
 #ifndef DHCPCD_H
 #define DHCPCD_H
 
-#include <sys/queue.h>
 #include <sys/socket.h>
 #include <net/if.h>
 
+#include "config.h"
 #include "defs.h"
 #include "control.h"
 #include "if-options.h"
Index: src/external/bsd/dhcpcd/dist/eloop.c
diff -u src/external/bsd/dhcpcd/dist/eloop.c:1.6 src/external/bsd/dhcpcd/dist/eloop.c:1.7
--- src/external/bsd/dhcpcd/dist/eloop.c:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/eloop.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: eloop.c,v 1.6 2014/11/07 20:51:02 roy Exp $");
+ __RCSID("$NetBSD: eloop.c,v 1.7 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -31,7 +31,6 @@
 /* Needed for ppoll(2) */
 #define _GNU_SOURCE
 
-#include <sys/queue.h>
 #include <sys/time.h>
 
 #include <errno.h>
@@ -41,6 +40,7 @@
 #include <stdlib.h>
 #include <syslog.h>
 
+#include "config.h"
 #include "common.h"
 #include "dhcpcd.h"
 #include "eloop.h"
@@ -242,7 +242,8 @@ eloop_q_timeout_delete(struct eloop_ctx 
 	struct eloop_timeout *t, *tt;
 
 	TAILQ_FOREACH_SAFE(t, &ctx->timeouts, next, tt) {
-		if (t->queue == queue && t->arg == arg &&
+		if ((queue == 0 || t->queue == queue) &&
+		    t->arg == arg &&
 		    (!callback || t->callback == callback))
 		{
 			TAILQ_REMOVE(&ctx->timeouts, t, next);
Index: src/external/bsd/dhcpcd/dist/ipv4.c
diff -u src/external/bsd/dhcpcd/dist/ipv4.c:1.6 src/external/bsd/dhcpcd/dist/ipv4.c:1.7
--- src/external/bsd/dhcpcd/dist/ipv4.c:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/ipv4.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv4.c,v 1.6 2014/11/07 20:51:02 roy Exp $");
+ __RCSID("$NetBSD: ipv4.c,v 1.7 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -28,7 +28,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/queue.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 
Index: src/external/bsd/dhcpcd/dist/ipv4ll.c
diff -u src/external/bsd/dhcpcd/dist/ipv4ll.c:1.6 src/external/bsd/dhcpcd/dist/ipv4ll.c:1.7
--- src/external/bsd/dhcpcd/dist/ipv4ll.c:1.6	Fri Nov  7 20:51:03 2014
+++ src/external/bsd/dhcpcd/dist/ipv4ll.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv4ll.c,v 1.6 2014/11/07 20:51:03 roy Exp $");
+ __RCSID("$NetBSD: ipv4ll.c,v 1.7 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -90,7 +90,6 @@ ipv4ll_pick_addr(const struct arp_state 
 		if (addr == astate->failed.s_addr)
 			continue;
 
-		state = D_CSTATE(astate->iface);
 		/* Ensure we don't have the address on another interface */
 		TAILQ_FOREACH(ifp, astate->iface->ctx->ifaces, next) {
 			state = D_CSTATE(ifp);
@@ -109,14 +108,19 @@ static void
 ipv4ll_probed(struct arp_state *astate)
 {
 	struct dhcp_state *state = D_STATE(astate->iface);
+	struct dhcp_message *offer;
 
-	free(state->offer);
-	state->offer = ipv4ll_make_lease(astate->addr.s_addr);
-	if (state->offer == NULL) {
-		syslog(LOG_ERR, "%s: %m", __func__);
-		return;
+	if (state->state != DHS_BOUND) {
+		/* A DHCP lease could have already been offered.
+		 * Backup and replace once the IPv4LL addres is bound */
+		offer = state->offer;
+		state->offer = ipv4ll_make_lease(astate->addr.s_addr);
+		if (state->offer == NULL)
+			syslog(LOG_ERR, "%s: %m", __func__);
+		else
+			dhcp_bind(astate->iface, astate);
+		state->offer = offer;
 	}
-	dhcp_bind(astate->iface, astate);
 }
 
 static void
@@ -253,3 +257,11 @@ ipv4ll_start(void *arg)
 		astate->addr.s_addr = ipv4ll_pick_addr(astate);
 	arp_probe(astate);
 }
+
+void
+ipv4ll_stop(struct interface *ifp)
+{
+	struct dhcp_state *state = D_STATE(ifp);
+
+	eloop_timeout_delete(ifp->ctx->eloop, NULL, state->arp_ipv4ll);
+}
Index: src/external/bsd/dhcpcd/dist/ipv4ll.h
diff -u src/external/bsd/dhcpcd/dist/ipv4ll.h:1.6 src/external/bsd/dhcpcd/dist/ipv4ll.h:1.7
--- src/external/bsd/dhcpcd/dist/ipv4ll.h:1.6	Fri Nov  7 20:51:03 2014
+++ src/external/bsd/dhcpcd/dist/ipv4ll.h	Fri Nov 14 12:00:54 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ipv4ll.h,v 1.6 2014/11/07 20:51:03 roy Exp $ */
+/* $NetBSD: ipv4ll.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -33,5 +33,6 @@
 void ipv4ll_start(void *);
 void ipv4ll_claimed(void *);
 void ipv4ll_handle_failure(void *);
+void ipv4ll_stop(struct interface *);
 
 #endif
Index: src/external/bsd/dhcpcd/dist/ipv6.h
diff -u src/external/bsd/dhcpcd/dist/ipv6.h:1.6 src/external/bsd/dhcpcd/dist/ipv6.h:1.7
--- src/external/bsd/dhcpcd/dist/ipv6.h:1.6	Fri Nov  7 20:51:03 2014
+++ src/external/bsd/dhcpcd/dist/ipv6.h	Fri Nov 14 12:00:54 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ipv6.h,v 1.6 2014/11/07 20:51:03 roy Exp $ */
+/* $NetBSD: ipv6.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,6 @@
 #ifndef IPV6_H
 #define IPV6_H
 
-#include <sys/queue.h>
 #include <sys/uio.h>
 
 #include <netinet/in.h>
@@ -40,6 +39,7 @@
 #  include <linux/ipv6.h>
 #endif
 
+#include "config.h"
 #include "dhcpcd.h"
 
 #define ALLROUTERS "ff02::2"
Index: src/external/bsd/dhcpcd/dist/ipv6nd.h
diff -u src/external/bsd/dhcpcd/dist/ipv6nd.h:1.6 src/external/bsd/dhcpcd/dist/ipv6nd.h:1.7
--- src/external/bsd/dhcpcd/dist/ipv6nd.h:1.6	Fri Nov  7 20:51:03 2014
+++ src/external/bsd/dhcpcd/dist/ipv6nd.h	Fri Nov 14 12:00:54 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ipv6nd.h,v 1.6 2014/11/07 20:51:03 roy Exp $ */
+/* $NetBSD: ipv6nd.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,10 +30,9 @@
 #ifndef IPV6ND_H
 #define IPV6ND_H
 
-#include <sys/queue.h>
-
 #include <time.h>
 
+#include "config.h"
 #include "dhcpcd.h"
 #include "ipv6.h"
 

Index: src/external/bsd/dhcpcd/dist/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/dhcp.c:1.22 src/external/bsd/dhcpcd/dist/dhcp.c:1.23
--- src/external/bsd/dhcpcd/dist/dhcp.c:1.22	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/dhcp.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.22 2014/11/07 20:51:02 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.23 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -2175,8 +2175,12 @@ dhcp_drop(struct interface *ifp, const c
 		eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
 		return;
 	}
-	/* Don't reset DHCP state if we have an IPv4LL address and link is up */
-	if (state->state != DHS_IPV4LL_BOUND || ifp->carrier != LINK_UP) {
+	/* Don't reset DHCP state if we have an IPv4LL address and link is up,
+	 * unless the interface is departing. */
+	if (state->state != DHS_IPV4LL_BOUND ||
+	    ifp->carrier != LINK_UP ||
+	    ifp->options->options & DHCPCD_DEPARTED)
+	{
 		eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
 		dhcp_auth_reset(&state->auth);
 		dhcp_close(ifp);

Index: src/external/bsd/dhcpcd/dist/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.c:1.16 src/external/bsd/dhcpcd/dist/dhcpcd.c:1.17
--- src/external/bsd/dhcpcd/dist/dhcpcd.c:1.16	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.16 2014/11/07 20:51:02 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.17 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -33,7 +33,6 @@ const char dhcpcd_copyright[] = "Copyrig
 #define _WITH_DPRINTF /* Stop FreeBSD bitching */
 
 #include <sys/file.h>
-#include <sys/queue.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -317,13 +316,15 @@ stop_interface(struct interface *ifp)
 	ipv6nd_drop(ifp);
 	dhcp_drop(ifp, "STOP");
 	arp_close(ifp);
-	eloop_timeout_delete(ctx->eloop, NULL, ifp);
 	if (ifp->options->options & DHCPCD_DEPARTED)
 		script_runreason(ifp, "DEPARTED");
 	else
 		script_runreason(ifp, "STOPPED");
 
-	// Remove the interface from our list
+	/* Delete all timeouts for the interfaces */
+	eloop_q_timeout_delete(ctx->eloop, 0, NULL, ifp);
+
+	/* Remove the interface from our list */
 	TAILQ_REMOVE(ifp->ctx->ifaces, ifp, next);
 	if_free(ifp);
 

Index: src/external/bsd/dhcpcd/dist/if-options.c
diff -u src/external/bsd/dhcpcd/dist/if-options.c:1.17 src/external/bsd/dhcpcd/dist/if-options.c:1.18
--- src/external/bsd/dhcpcd/dist/if-options.c:1.17	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/if-options.c	Fri Nov 14 12:00:54 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if-options.c,v 1.17 2014/11/07 20:51:02 roy Exp $");
+ __RCSID("$NetBSD: if-options.c,v 1.18 2014/11/14 12:00:54 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -32,7 +32,6 @@
 
 #include <sys/param.h>
 #include <sys/types.h>
-#include <sys/queue.h>
 
 #include <arpa/inet.h>
 

Reply via email to