Module Name:    src
Committed By:   roy
Date:           Tue Dec  9 20:21:05 UTC 2014

Modified Files:
        src/external/bsd/dhcpcd/dist: defs.h dhcp.c dhcpcd-run-hooks.in
            dhcpcd.8.in dhcpcd.c if.c script.c
        src/external/bsd/dhcpcd/dist/dhcpcd-hooks: 29-lookup-hostname

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/defs.h
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/dhcpcd/dist/dhcp.c
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
cvs rdiff -u -r1.37 -r1.38 src/external/bsd/dhcpcd/dist/dhcpcd.8.in
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/dhcpcd/dist/dhcpcd.c
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/dhcpcd/dist/if.c
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/script.c
cvs rdiff -u -r1.6 -r1.7 \
    src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname

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/defs.h
diff -u src/external/bsd/dhcpcd/dist/defs.h:1.9 src/external/bsd/dhcpcd/dist/defs.h:1.10
--- src/external/bsd/dhcpcd/dist/defs.h:1.9	Wed Nov 26 16:05:14 2014
+++ src/external/bsd/dhcpcd/dist/defs.h	Tue Dec  9 20:21:05 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.9 2014/11/26 16:05:14 roy Exp $ */
+/* $NetBSD: defs.h,v 1.10 2014/12/09 20:21:05 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"6.6.4"
+#define VERSION			"6.6.5"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"

Index: src/external/bsd/dhcpcd/dist/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/dhcp.c:1.24 src/external/bsd/dhcpcd/dist/dhcp.c:1.25
--- src/external/bsd/dhcpcd/dist/dhcp.c:1.24	Wed Nov 26 13:43:06 2014
+++ src/external/bsd/dhcpcd/dist/dhcp.c	Tue Dec  9 20:21:05 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.24 2014/11/26 13:43:06 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.25 2014/12/09 20:21:05 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -3077,11 +3077,14 @@ dhcp_start1(void *arg)
 	if (ifp->ctx->udp_fd == -1) {
 		ifp->ctx->udp_fd = dhcp_openudp(NULL);
 		if (ifp->ctx->udp_fd == -1) {
-			syslog(LOG_ERR, "dhcp_openudp: %m");
-			return;
-		}
-		eloop_event_add(ifp->ctx->eloop,
-		    ifp->ctx->udp_fd, dhcp_handleudp, ifp->ctx, NULL, NULL);
+			/* Don't log an error if some other process
+			 * is handling this. */
+			if (errno != EADDRINUSE)
+				syslog(LOG_ERR, "dhcp_openudp: %m");
+		} else
+			eloop_event_add(ifp->ctx->eloop,
+			    ifp->ctx->udp_fd, dhcp_handleudp,
+			    ifp->ctx, NULL, NULL);
 	}
 
 	if (dhcp_init(ifp) == -1) {

Index: src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in:1.7 src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in:1.8
--- src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in:1.7	Wed Nov 26 16:05:14 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in	Tue Dec  9 20:21:05 2014
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: dhcpcd-run-hooks.in,v 1.7 2014/11/26 16:05:14 roy Exp $
+# $NetBSD: dhcpcd-run-hooks.in,v 1.8 2014/12/09 20:21:05 roy Exp $
 
 # dhcpcd client configuration script 
 
@@ -9,8 +9,6 @@ case "$reason" in
 		ifsuffix=":ra";;
 	INFORM6|BOUND6|RENEW6|REBIND6|REBOOT6|EXPIRE6|RELEASE6|STOP6)
 		ifsuffix=":dhcp6";;
-	STOPPED) # This reason should never be processed
-		exit 0;;
 	*)
 		ifsuffix=;;
 esac

Index: src/external/bsd/dhcpcd/dist/dhcpcd.8.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.37 src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.38
--- src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.37	Wed Nov 26 13:43:06 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd.8.in	Tue Dec  9 20:21:05 2014
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.8.in,v 1.37 2014/11/26 13:43:06 roy Exp $
+.\"     $NetBSD: dhcpcd.8.in,v 1.38 2014/12/09 20:21:05 roy Exp $
 .\" Copyright (c) 2006-2014 Roy Marples
 .\" All rights reserved
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 18, 2014
+.Dd November 26, 2014
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -557,6 +557,9 @@ with the reason of TEST which echos the 
 to the console.
 The interface configuration isn't touched and neither are any configuration
 files.
+The
+.Ar rapid_commit
+option is not sent in TEST mode so that the server does not lease an address.
 To test INFORM the interface needs to be configured with the desired address
 before starting
 .Nm .

Index: src/external/bsd/dhcpcd/dist/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.c:1.18 src/external/bsd/dhcpcd/dist/dhcpcd.c:1.19
--- src/external/bsd/dhcpcd/dist/dhcpcd.c:1.18	Wed Nov 26 13:43:06 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd.c	Tue Dec  9 20:21:05 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.18 2014/11/26 13:43:06 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.19 2014/12/09 20:21:05 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -452,12 +452,13 @@ configure_interface1(struct interface *i
 			    sizeof(ifo->iaid));
 		else {
 			uint32_t len;
-			
+
 			len = (uint32_t)strlen(ifp->name);
 			if (len <= sizeof(ifo->iaid)) {
 				memcpy(ifo->iaid, ifp->name, len);
-				memset(ifo->iaid + len, 0,
-				    sizeof(ifo->iaid) - len);
+				if (len < sizeof(ifo->iaid))
+					memset(ifo->iaid + len, 0,
+					    sizeof(ifo->iaid) - len);
 			} else {
 				/* IAID is the same size as a uint32_t */
 				len = htonl(ifp->index);
@@ -540,6 +541,25 @@ configure_interface(struct interface *if
 	configure_interface1(ifp);
 }
 
+static void
+dhcpcd_pollup(void *arg)
+{
+	struct interface *ifp = arg;
+	int carrier;
+
+	carrier = if_carrier(ifp); /* will set ifp->flags */
+	if (carrier == LINK_UP && !(ifp->flags & IFF_UP)) {
+		struct timeval tv;
+
+		tv.tv_sec = 0;
+		tv.tv_usec = IF_POLL_UP * 1000;
+		eloop_timeout_add_tv(ifp->ctx->eloop, &tv, dhcpcd_pollup, ifp);
+		return;
+	}
+
+	dhcpcd_handlecarrier(ifp->ctx, carrier, ifp->flags, ifp->name);
+}
+
 void
 dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
     const char *ifname)
@@ -555,19 +575,24 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *
 		carrier = if_carrier(ifp); /* will set ifp->flags */
 		break;
 	case LINK_UP:
-		/* we have a carrier! however, we need to ignore the flags
-		 * set in the kernel message as sometimes this message is
-		 * reported before IFF_UP is set by the kernel even though
-		 * dhcpcd has already set it.
-		 *
-		 * So we check the flags now. If IFF_UP is still not set
-		 * then we should expect an accompanying link_down message */
-		if_setflag(ifp, 0); /* will set ifp->flags */
+		/* we have a carrier! Still need to check for IFF_UP */
+		if (flags & IFF_UP)
+			ifp->flags = flags;
+		else {
+			/* So we need to poll for IFF_UP as there is no
+			 * kernel notification when it's set. */
+			dhcpcd_pollup(ifp);
+			return;
+		}
 		break;
 	default:
 		ifp->flags = flags;
 	}
 
+	/* If we here, we don't need to poll for IFF_UP any longer
+	 * if generated by a kernel event. */
+	eloop_timeout_delete(ifp->ctx->eloop, dhcpcd_pollup, ifp);
+
 	if (carrier == LINK_UNKNOWN) {
 		if (errno != ENOTTY) /* For example a PPP link on BSD */
 			syslog(LOG_ERR, "%s: carrier_status: %m", ifname);

Index: src/external/bsd/dhcpcd/dist/if.c
diff -u src/external/bsd/dhcpcd/dist/if.c:1.8 src/external/bsd/dhcpcd/dist/if.c:1.9
--- src/external/bsd/dhcpcd/dist/if.c:1.8	Tue Dec  2 22:13:13 2014
+++ src/external/bsd/dhcpcd/dist/if.c	Tue Dec  9 20:21:05 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if.c,v 1.8 2014/12/02 22:13:13 christos Exp $");
+ __RCSID("$NetBSD: if.c,v 1.9 2014/12/09 20:21:05 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -187,7 +187,6 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 	struct ifaddrs *ifaddrs, *ifa;
 	char *p;
 	int i;
-	sa_family_t sdltype;
 	struct if_head *ifs;
 	struct interface *ifp;
 #ifdef __linux__
@@ -321,7 +320,6 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 		ifp->flags = ifa->ifa_flags;
 		ifp->carrier = if_carrier(ifp);
 
-		sdltype = 0;
 		if (ifa->ifa_addr != NULL) {
 #ifdef AF_LINK
 			sdl = (const struct sockaddr_dl *)(void *)ifa->ifa_addr;
@@ -346,7 +344,6 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 			memcpy(&ifp->linkaddr, sdl, sdl->sdl_len);
 #endif
 			ifp->index = sdl->sdl_index;
-			sdltype = sdl->sdl_type;
 			switch(sdl->sdl_type) {
 #ifdef IFT_BRIDGE
 			case IFT_BRIDGE:
@@ -379,6 +376,21 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 				ifp->family = ARPHRD_INFINIBAND;
 				break;
 #endif
+			default:
+				/* Don't allow unless explicit */
+				if ((argc == 0 || argc == -1) &&
+				    ctx->ifac == 0 &&
+				    !if_hasconf(ctx, ifp->name))
+				{
+					if_free(ifp);
+					continue;
+				}
+				syslog(LOG_WARNING,
+				    "%s: unsupported interface type %.2x",
+				    ifp->name, ifp->family);
+				/* Pretend it's ethernet */
+				ifp->family = ARPHRD_ETHER;
+				break;
 			}
 			ifp->hwlen = sdl->sdl_alen;
 #ifndef CLLADDR
@@ -388,7 +400,7 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 #elif AF_PACKET
 			sll = (const struct sockaddr_ll *)(void *)ifa->ifa_addr;
 			ifp->index = (unsigned int)sll->sll_ifindex;
-			ifp->family = sdltype = sll->sll_hatype;
+			ifp->family = sll->sll_hatype;
 			ifp->hwlen = sll->sll_halen;
 			if (ifp->hwlen != 0)
 				memcpy(ifp->hwaddr, sll->sll_addr, ifp->hwlen);
@@ -409,7 +421,7 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 				continue;
 			}
 			switch (ifp->family) {
-			case ARPHRD_IEEE1394: /* FALLTHROUGH */
+			case ARPHRD_IEEE1394:
 			case ARPHRD_INFINIBAND:
 #ifdef ARPHRD_LOOPBACK
 			case ARPHRD_LOOPBACK:
@@ -419,12 +431,15 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 #endif
 				/* We don't warn for supported families */
 				break;
+
+/* IFT already checked */
+#ifndef AF_LINK
 			default:
 				syslog(LOG_WARNING,
-				    "%s: unsupported interface type %.2x, "
-				    "family %.2x",
-				    ifp->name, sdltype, ifp->family);
+				    "%s: unsupported interface family %.2x",
+				    ifp->name, ifp->family);
 				break;
+#endif
 			}
 		}
 

Index: src/external/bsd/dhcpcd/dist/script.c
diff -u src/external/bsd/dhcpcd/dist/script.c:1.15 src/external/bsd/dhcpcd/dist/script.c:1.16
--- src/external/bsd/dhcpcd/dist/script.c:1.15	Wed Nov 26 16:05:14 2014
+++ src/external/bsd/dhcpcd/dist/script.c	Tue Dec  9 20:21:05 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: script.c,v 1.15 2014/11/26 16:05:14 roy Exp $");
+ __RCSID("$NetBSD: script.c,v 1.16 2014/12/09 20:21:05 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -338,7 +338,13 @@ make_env(const struct interface *ifp, co
 		}
 	}
 	*--p = '\0';
-	if (strcmp(reason, "TEST") == 0 ||
+	if (strcmp(reason, "STOPPED") == 0) {
+		env[9] = strdup("if_up=false");
+		if (ifo->options & DHCPCD_RELEASE)
+			env[10] = strdup("if_down=true");
+		else
+			env[10] = strdup("if_down=false");
+	} else if (strcmp(reason, "TEST") == 0 ||
 	    strcmp(reason, "PREINIT") == 0 ||
 	    strcmp(reason, "CARRIER") == 0 ||
 	    strcmp(reason, "UNKNOWN") == 0)

Index: src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname
diff -u src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname:1.6 src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname:1.7
--- src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname:1.6	Fri Nov  7 20:51:03 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname	Tue Dec  9 20:21:05 2014
@@ -1,4 +1,4 @@
-# $NetBSD: 29-lookup-hostname,v 1.6 2014/11/07 20:51:03 roy Exp $
+# $NetBSD: 29-lookup-hostname,v 1.7 2014/12/09 20:21:05 roy Exp $
 
 # Lookup the hostname in DNS if not set
 
@@ -20,6 +20,12 @@ lookup_hostname()
 			| sed 's/.* domain name pointer \(.*\)./\1/'
 			return 0
 		fi
+	elif type getent >/dev/null 2>&1; then
+		h=$(getent hosts $new_ip_address)
+		if [ $? = 0 ]; then
+			echo "$h" | sed 's/[^ ]* *\([^ ]*\).*/\1/'
+			return 0
+		 fi
 	fi
 	return 1
 }

Reply via email to