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