8173a6
diff -up dhcp-4.3.4/client/dhc6.c.PPP dhcp-4.3.4/client/dhc6.c
8173a6
--- dhcp-4.3.4/client/dhc6.c.PPP	2016-04-29 12:46:29.824988665 +0200
8173a6
+++ dhcp-4.3.4/client/dhc6.c	2016-04-29 12:46:29.828988666 +0200
8173a6
@@ -5641,7 +5641,8 @@ make_client6_options(struct client_state
e83fb1
 	 */
e83fb1
 	if ((oc = lookup_option(&dhcpv6_universe, *op,
e83fb1
 				D6O_CLIENTID)) == NULL) {
e83fb1
-		if (!option_cache(&oc, &default_duid, NULL, clientid_option,
e83fb1
+		if (default_duid.len == 0 ||
e83fb1
+		    !option_cache(&oc, &default_duid, NULL, clientid_option,
e83fb1
 				  MDL))
e83fb1
 			log_fatal("Failure assembling a DUID.");
e83fb1
 
8173a6
diff -up dhcp-4.3.4/client/dhclient.c.PPP dhcp-4.3.4/client/dhclient.c
8173a6
--- dhcp-4.3.4/client/dhclient.c.PPP	2016-04-29 12:46:29.815988664 +0200
8173a6
+++ dhcp-4.3.4/client/dhclient.c	2016-04-29 12:46:29.830988666 +0200
8173a6
@@ -1077,8 +1077,8 @@ main(int argc, char **argv) {
e83fb1
 			if (default_duid.buffer != NULL)
e83fb1
 				data_string_forget(&default_duid, MDL);
e83fb1
 
e83fb1
-			form_duid(&default_duid, MDL);
e83fb1
-			write_duid(&default_duid);
e83fb1
+			if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS)
e83fb1
+				write_duid(&default_duid);
e83fb1
 		}
e83fb1
 	}
e83fb1
 
8173a6
@@ -3808,7 +3808,7 @@ write_options(struct client_state *clien
76c2a1
  * is not how it is intended.  Upcoming rearchitecting the client should
76c2a1
  * address this "one daemon model."
76c2a1
  */
76c2a1
-void
76c2a1
+isc_result_t
76c2a1
 form_duid(struct data_string *duid, const char *file, int line)
76c2a1
 {
76c2a1
 	struct interface_info *ip;
8173a6
@@ -3821,6 +3821,15 @@ form_duid(struct data_string *duid, cons
76c2a1
 	if (ip == NULL)
76c2a1
 		log_fatal("Impossible condition at %s:%d.", MDL);
76c2a1
 
76c2a1
+	while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) {
76c2a1
+		/* Try the other interfaces */
76c2a1
+		log_debug("Cannot form default DUID from interface %s.", ip->name);
76c2a1
+		ip = ip->next;
76c2a1
+	}
76c2a1
+	if (ip == NULL) {
76c2a1
+		return ISC_R_UNEXPECTED;
76c2a1
+	}
76c2a1
+
76c2a1
 	if ((ip->hw_address.hlen == 0) ||
76c2a1
 	    (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf)))
76c2a1
 		log_fatal("Impossible hardware address length at %s:%d.", MDL);
8173a6
@@ -3866,6 +3875,8 @@ form_duid(struct data_string *duid, cons
7b69e5
 		log_info("Created duid %s.", str);
7b69e5
 		dfree(str, MDL);
76c2a1
 	}
e83fb1
+	
76c2a1
+	return ISC_R_SUCCESS;
76c2a1
 }
76c2a1
 
e83fb1
 /* Write the default DUID to the lease store. */
8173a6
diff -up dhcp-4.3.4/common/bpf.c.PPP dhcp-4.3.4/common/bpf.c
8173a6
--- dhcp-4.3.4/common/bpf.c.PPP	2016-04-29 12:46:29.794988660 +0200
8173a6
+++ dhcp-4.3.4/common/bpf.c	2016-04-29 12:46:29.830988666 +0200
8173a6
@@ -599,6 +599,22 @@ get_hw_addr(const char *name, struct har
76c2a1
                         memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen);
76c2a1
                         break;
76c2a1
 #endif /* IFT_FDDI */
76c2a1
+#if defined(IFT_PPP)
76c2a1
+                case IFT_PPP:
76c2a1
+                        if (local_family != AF_INET6)
76c2a1
+                             log_fatal("Unsupported device type %d for \"%s\"",
76c2a1
+                                        sa->sdl_type, name);
76c2a1
+                        hw->hlen = 0;
76c2a1
+                        hw->hbuf[0] = HTYPE_RESERVED;
76c2a1
+                        /* 0xdeadbeef should never occur on the wire,
76c2a1
+                         *  and is a signature that something went wrong.
76c2a1
+                         */
76c2a1
+                        hw->hbuf[1] = 0xde;
76c2a1
+                        hw->hbuf[2] = 0xad;
76c2a1
+                        hw->hbuf[3] = 0xbe;
76c2a1
+                        hw->hbuf[4] = 0xef;
76c2a1
+                        break;
76c2a1
+#endif
76c2a1
                 default:
76c2a1
                         log_fatal("Unsupported device type %d for \"%s\"",
76c2a1
                                   sa->sdl_type, name);
8173a6
diff -up dhcp-4.3.4/common/lpf.c.PPP dhcp-4.3.4/common/lpf.c
8173a6
--- dhcp-4.3.4/common/lpf.c.PPP	2016-03-22 14:16:51.000000000 +0100
8173a6
+++ dhcp-4.3.4/common/lpf.c	2016-04-29 12:46:29.830988666 +0200
8173a6
@@ -548,6 +548,22 @@ get_hw_addr(const char *name, struct har
76c2a1
 			hw->hbuf[0] = HTYPE_FDDI;
c72a79
 			memcpy(&hw->hbuf[1], sa->sa_data, 6);
76c2a1
 			break;
76c2a1
+#if defined(ARPHRD_PPP)
76c2a1
+		case ARPHRD_PPP:
76c2a1
+			if (local_family != AF_INET6)
76c2a1
+				log_fatal("Unsupported device type %d for \"%s\"",
76c2a1
+				           sa->sa_family, name);
76c2a1
+			hw->hlen = 0;
76c2a1
+			hw->hbuf[0] = HTYPE_RESERVED;
76c2a1
+			/* 0xdeadbeef should never occur on the wire,
76c2a1
+			 * and is a signature that something went wrong.
76c2a1
+			 */
76c2a1
+			hw->hbuf[1] = 0xde;
76c2a1
+			hw->hbuf[2] = 0xad;
76c2a1
+			hw->hbuf[3] = 0xbe;
76c2a1
+			hw->hbuf[4] = 0xef;
76c2a1
+			break;
76c2a1
+#endif
76c2a1
 		default:
76c2a1
 			log_fatal("Unsupported device type %ld for \"%s\"",
76c2a1
 				  (long int)sa->sa_family, name);
8173a6
diff -up dhcp-4.3.4/includes/dhcpd.h.PPP dhcp-4.3.4/includes/dhcpd.h
8173a6
--- dhcp-4.3.4/includes/dhcpd.h.PPP	2016-04-29 12:46:29.831988667 +0200
8173a6
+++ dhcp-4.3.4/includes/dhcpd.h	2016-04-29 12:47:13.167995959 +0200
8173a6
@@ -2990,7 +2990,7 @@ void client_dns_remove(struct client_sta
e83fb1
 
e83fb1
 void dhcpv4_client_assignments(void);
e83fb1
 void dhcpv6_client_assignments(void);
e83fb1
-void form_duid(struct data_string *duid, const char *file, int line);
e83fb1
+isc_result_t form_duid(struct data_string *duid, const char *file, int line);
e83fb1
 
8173a6
 void dhcp4o6_start(void);
8173a6
 
8173a6
diff -up dhcp-4.3.4/includes/dhcp.h.PPP dhcp-4.3.4/includes/dhcp.h
8173a6
--- dhcp-4.3.4/includes/dhcp.h.PPP	2016-04-29 12:46:29.822988665 +0200
8173a6
+++ dhcp-4.3.4/includes/dhcp.h	2016-04-29 12:46:29.832988667 +0200
7b69e5
@@ -81,6 +81,8 @@ struct dhcp_packet {
7b69e5
 					 * is no standard for this so we
7b69e5
 					 * just steal a type            */
7b69e5
 
7b69e5
+#define HTYPE_RESERVED	0		/* RFC 5494 */
7b69e5
+
7b69e5
 /* Magic cookie validating dhcp options field (and bootp vendor
7b69e5
    extensions field). */
7b69e5
 #define DHCP_OPTIONS_COOKIE	"\143\202\123\143"
8173a6
diff -up dhcp-4.3.4/server/dhcpv6.c.PPP dhcp-4.3.4/server/dhcpv6.c
8173a6
--- dhcp-4.3.4/server/dhcpv6.c.PPP	2016-03-22 14:16:51.000000000 +0100
8173a6
+++ dhcp-4.3.4/server/dhcpv6.c	2016-04-29 12:46:29.833988667 +0200
8173a6
@@ -454,6 +454,9 @@ generate_new_server_duid(void) {
76c2a1
 		if (p->hw_address.hlen > 0) {
76c2a1
 			break;
76c2a1
 		}
76c2a1
+		if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) {
76c2a1
+			log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!");
76c2a1
+		}
76c2a1
 	}
76c2a1
 	if (p == NULL) {
76c2a1
 		return ISC_R_UNEXPECTED;