e83fb19
diff -up dhcp-4.3.0a1/client/dhc6.c.PPP dhcp-4.3.0a1/client/dhc6.c
e83fb19
--- dhcp-4.3.0a1/client/dhc6.c.PPP	2013-12-19 16:16:45.925550229 +0100
e83fb19
+++ dhcp-4.3.0a1/client/dhc6.c	2013-12-19 16:16:45.930550159 +0100
e83fb19
@@ -5080,7 +5080,8 @@ make_client6_options(struct client_state
e83fb19
 	 */
e83fb19
 	if ((oc = lookup_option(&dhcpv6_universe, *op,
e83fb19
 				D6O_CLIENTID)) == NULL) {
e83fb19
-		if (!option_cache(&oc, &default_duid, NULL, clientid_option,
e83fb19
+		if (default_duid.len == 0 ||
e83fb19
+		    !option_cache(&oc, &default_duid, NULL, clientid_option,
e83fb19
 				  MDL))
e83fb19
 			log_fatal("Failure assembling a DUID.");
e83fb19
 
e83fb19
diff -up dhcp-4.3.0a1/client/dhclient.c.PPP dhcp-4.3.0a1/client/dhclient.c
e83fb19
--- dhcp-4.3.0a1/client/dhclient.c.PPP	2013-12-19 16:16:45.932550131 +0100
e83fb19
+++ dhcp-4.3.0a1/client/dhclient.c	2013-12-19 16:27:38.334473958 +0100
e83fb19
@@ -926,8 +926,8 @@ main(int argc, char **argv) {
e83fb19
 			if (default_duid.buffer != NULL)
e83fb19
 				data_string_forget(&default_duid, MDL);
e83fb19
 
e83fb19
-			form_duid(&default_duid, MDL);
e83fb19
-			write_duid(&default_duid);
e83fb19
+			if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS)
e83fb19
+				write_duid(&default_duid);
e83fb19
 		}
e83fb19
 	}
e83fb19
 
e83fb19
@@ -3225,7 +3225,7 @@ write_options(struct client_state *clien
76c2a1e
  * is not how it is intended.  Upcoming rearchitecting the client should
76c2a1e
  * address this "one daemon model."
76c2a1e
  */
76c2a1e
-void
76c2a1e
+isc_result_t
76c2a1e
 form_duid(struct data_string *duid, const char *file, int line)
76c2a1e
 {
76c2a1e
 	struct interface_info *ip;
e83fb19
@@ -3237,6 +3237,15 @@ form_duid(struct data_string *duid, cons
76c2a1e
 	if (ip == NULL)
76c2a1e
 		log_fatal("Impossible condition at %s:%d.", MDL);
76c2a1e
 
76c2a1e
+	while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) {
76c2a1e
+		/* Try the other interfaces */
76c2a1e
+		log_debug("Cannot form default DUID from interface %s.", ip->name);
76c2a1e
+		ip = ip->next;
76c2a1e
+	}
76c2a1e
+	if (ip == NULL) {
76c2a1e
+		return ISC_R_UNEXPECTED;
76c2a1e
+	}
76c2a1e
+
76c2a1e
 	if ((ip->hw_address.hlen == 0) ||
76c2a1e
 	    (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf)))
76c2a1e
 		log_fatal("Impossible hardware address length at %s:%d.", MDL);
e83fb19
@@ -3272,6 +3281,8 @@ form_duid(struct data_string *duid, cons
76c2a1e
 		memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1,
76c2a1e
 		       ip->hw_address.hlen - 1);
76c2a1e
 	}
e83fb19
+	
76c2a1e
+	return ISC_R_SUCCESS;
76c2a1e
 }
76c2a1e
 
e83fb19
 /* Write the default DUID to the lease store. */
e83fb19
diff -up dhcp-4.3.0a1/common/bpf.c.PPP dhcp-4.3.0a1/common/bpf.c
e83fb19
--- dhcp-4.3.0a1/common/bpf.c.PPP	2013-12-19 16:16:45.868551024 +0100
e83fb19
+++ dhcp-4.3.0a1/common/bpf.c	2013-12-19 16:16:45.934550103 +0100
e83fb19
@@ -602,6 +602,22 @@ get_hw_addr(const char *name, struct har
76c2a1e
                         memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen);
76c2a1e
                         break;
76c2a1e
 #endif /* IFT_FDDI */
76c2a1e
+#if defined(IFT_PPP)
76c2a1e
+                case IFT_PPP:
76c2a1e
+                        if (local_family != AF_INET6)
76c2a1e
+                             log_fatal("Unsupported device type %d for \"%s\"",
76c2a1e
+                                        sa->sdl_type, name);
76c2a1e
+                        hw->hlen = 0;
76c2a1e
+                        hw->hbuf[0] = HTYPE_RESERVED;
76c2a1e
+                        /* 0xdeadbeef should never occur on the wire,
76c2a1e
+                         *  and is a signature that something went wrong.
76c2a1e
+                         */
76c2a1e
+                        hw->hbuf[1] = 0xde;
76c2a1e
+                        hw->hbuf[2] = 0xad;
76c2a1e
+                        hw->hbuf[3] = 0xbe;
76c2a1e
+                        hw->hbuf[4] = 0xef;
76c2a1e
+                        break;
76c2a1e
+#endif
76c2a1e
                 default:
76c2a1e
                         log_fatal("Unsupported device type %d for \"%s\"",
76c2a1e
                                   sa->sdl_type, name);
e83fb19
diff -up dhcp-4.3.0a1/common/lpf.c.PPP dhcp-4.3.0a1/common/lpf.c
e83fb19
--- dhcp-4.3.0a1/common/lpf.c.PPP	2013-12-19 16:16:45.848551303 +0100
e83fb19
+++ dhcp-4.3.0a1/common/lpf.c	2013-12-19 16:16:45.934550103 +0100
e83fb19
@@ -511,6 +511,22 @@ get_hw_addr(const char *name, struct har
76c2a1e
 			hw->hbuf[0] = HTYPE_FDDI;
c72a792
 			memcpy(&hw->hbuf[1], sa->sa_data, 6);
76c2a1e
 			break;
76c2a1e
+#if defined(ARPHRD_PPP)
76c2a1e
+		case ARPHRD_PPP:
76c2a1e
+			if (local_family != AF_INET6)
76c2a1e
+				log_fatal("Unsupported device type %d for \"%s\"",
76c2a1e
+				           sa->sa_family, name);
76c2a1e
+			hw->hlen = 0;
76c2a1e
+			hw->hbuf[0] = HTYPE_RESERVED;
76c2a1e
+			/* 0xdeadbeef should never occur on the wire,
76c2a1e
+			 * and is a signature that something went wrong.
76c2a1e
+			 */
76c2a1e
+			hw->hbuf[1] = 0xde;
76c2a1e
+			hw->hbuf[2] = 0xad;
76c2a1e
+			hw->hbuf[3] = 0xbe;
76c2a1e
+			hw->hbuf[4] = 0xef;
76c2a1e
+			break;
76c2a1e
+#endif
76c2a1e
 		default:
76c2a1e
 			log_fatal("Unsupported device type %ld for \"%s\"",
76c2a1e
 				  (long int)sa->sa_family, name);
e83fb19
diff -up dhcp-4.3.0a1/includes/dhcp.h.PPP dhcp-4.3.0a1/includes/dhcp.h
e83fb19
--- dhcp-4.3.0a1/includes/dhcp.h.PPP	2013-12-19 16:16:45.919550313 +0100
e83fb19
+++ dhcp-4.3.0a1/includes/dhcp.h	2013-12-19 16:16:45.936550076 +0100
d5d042f
@@ -85,6 +85,8 @@ struct dhcp_packet {
d5d042f
 					 * is no standard for this so we
d5d042f
 					 * just steal a type            */
76c2a1e
 
d5d042f
+#define HTYPE_RESERVED	0		/* RFC 5494 */
76c2a1e
+
76c2a1e
 /* Magic cookie validating dhcp options field (and bootp vendor
76c2a1e
    extensions field). */
76c2a1e
 #define DHCP_OPTIONS_COOKIE	"\143\202\123\143"
e83fb19
diff -up dhcp-4.3.0a1/includes/dhcpd.h.PPP dhcp-4.3.0a1/includes/dhcpd.h
e83fb19
--- dhcp-4.3.0a1/includes/dhcpd.h.PPP	2013-12-19 16:16:45.935550090 +0100
e83fb19
+++ dhcp-4.3.0a1/includes/dhcpd.h	2013-12-19 16:28:33.468709007 +0100
e83fb19
@@ -2824,7 +2824,7 @@ void client_dns_remove(struct client_sta
e83fb19
 
e83fb19
 void dhcpv4_client_assignments(void);
e83fb19
 void dhcpv6_client_assignments(void);
e83fb19
-void form_duid(struct data_string *duid, const char *file, int line);
e83fb19
+isc_result_t form_duid(struct data_string *duid, const char *file, int line);
e83fb19
 
e83fb19
 /* dhc6.c */
e83fb19
 void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line);
e83fb19
diff -up dhcp-4.3.0a1/server/dhcpv6.c.PPP dhcp-4.3.0a1/server/dhcpv6.c
e83fb19
--- dhcp-4.3.0a1/server/dhcpv6.c.PPP	2013-12-19 16:16:45.901550564 +0100
e83fb19
+++ dhcp-4.3.0a1/server/dhcpv6.c	2013-12-19 16:16:45.937550062 +0100
e83fb19
@@ -307,6 +307,9 @@ generate_new_server_duid(void) {
76c2a1e
 		if (p->hw_address.hlen > 0) {
76c2a1e
 			break;
76c2a1e
 		}
76c2a1e
+		if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) {
76c2a1e
+			log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!");
76c2a1e
+		}
76c2a1e
 	}
76c2a1e
 	if (p == NULL) {
76c2a1e
 		return ISC_R_UNEXPECTED;