|
|
c8bb8f |
diff -up dhcp-4.2.4b1/client/dhc6.c.PPP dhcp-4.2.4b1/client/dhc6.c
|
|
|
c8bb8f |
--- dhcp-4.2.4b1/client/dhc6.c.PPP 2012-04-16 17:37:23.243618764 +0200
|
|
|
c8bb8f |
+++ dhcp-4.2.4b1/client/dhc6.c 2012-04-16 17:37:23.252618638 +0200
|
|
|
c8bb8f |
@@ -133,7 +133,7 @@ extern int stateless;
|
|
|
c8bb8f |
* is not how it is intended. Upcoming rearchitecting the client should
|
|
|
c8bb8f |
* address this "one daemon model."
|
|
|
c8bb8f |
*/
|
|
|
c8bb8f |
-void
|
|
|
c8bb8f |
+isc_result_t
|
|
|
c8bb8f |
form_duid(struct data_string *duid, const char *file, int line)
|
|
|
c8bb8f |
{
|
|
|
c8bb8f |
struct interface_info *ip;
|
|
|
c8bb8f |
@@ -145,6 +145,15 @@ form_duid(struct data_string *duid, cons
|
|
|
c8bb8f |
if (ip == NULL)
|
|
|
c8bb8f |
log_fatal("Impossible condition at %s:%d.", MDL);
|
|
|
c8bb8f |
|
|
|
c8bb8f |
+ while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) {
|
|
|
c8bb8f |
+ /* Try the other interfaces */
|
|
|
c8bb8f |
+ log_debug("Cannot form default DUID from interface %s.", ip->name);
|
|
|
c8bb8f |
+ ip = ip->next;
|
|
|
c8bb8f |
+ }
|
|
|
c8bb8f |
+ if (ip == NULL) {
|
|
|
c8bb8f |
+ return ISC_R_UNEXPECTED;
|
|
|
c8bb8f |
+ }
|
|
|
c8bb8f |
+
|
|
|
c8bb8f |
if ((ip->hw_address.hlen == 0) ||
|
|
|
c8bb8f |
(ip->hw_address.hlen > sizeof(ip->hw_address.hbuf)))
|
|
|
c8bb8f |
log_fatal("Impossible hardware address length at %s:%d.", MDL);
|
|
|
c8bb8f |
@@ -180,6 +189,8 @@ form_duid(struct data_string *duid, cons
|
|
|
c8bb8f |
memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1,
|
|
|
c8bb8f |
ip->hw_address.hlen - 1);
|
|
|
c8bb8f |
}
|
|
|
c8bb8f |
+
|
|
|
c8bb8f |
+ return ISC_R_SUCCESS;
|
|
|
c8bb8f |
}
|
|
|
c8bb8f |
|
|
|
c8bb8f |
/*
|
|
|
c8bb8f |
@@ -5130,7 +5141,8 @@ make_client6_options(struct client_state
|
|
|
c8bb8f |
*/
|
|
|
c8bb8f |
if ((oc = lookup_option(&dhcpv6_universe, *op,
|
|
|
c8bb8f |
D6O_CLIENTID)) == NULL) {
|
|
|
c8bb8f |
- if (!option_cache(&oc, &default_duid, NULL, clientid_option,
|
|
|
c8bb8f |
+ if (default_duid.len == 0 ||
|
|
|
c8bb8f |
+ !option_cache(&oc, &default_duid, NULL, clientid_option,
|
|
|
c8bb8f |
MDL))
|
|
|
c8bb8f |
log_fatal("Failure assembling a DUID.");
|
|
|
c8bb8f |
|
|
|
c8bb8f |
diff -up dhcp-4.2.4b1/client/dhclient.c.PPP dhcp-4.2.4b1/client/dhclient.c
|
|
|
c8bb8f |
--- dhcp-4.2.4b1/client/dhclient.c.PPP 2012-04-16 17:37:23.214619170 +0200
|
|
|
c8bb8f |
+++ dhcp-4.2.4b1/client/dhclient.c 2012-04-16 17:37:23.254618610 +0200
|
|
|
c8bb8f |
@@ -919,8 +919,8 @@ main(int argc, char **argv) {
|
|
|
c8bb8f |
if (default_duid.buffer != NULL)
|
|
|
c8bb8f |
data_string_forget(&default_duid, MDL);
|
|
|
c8bb8f |
|
|
|
c8bb8f |
- form_duid(&default_duid, MDL);
|
|
|
c8bb8f |
- write_duid(&default_duid);
|
|
|
c8bb8f |
+ if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS)
|
|
|
c8bb8f |
+ write_duid(&default_duid);
|
|
|
c8bb8f |
}
|
|
|
c8bb8f |
|
|
|
c8bb8f |
for (ip = interfaces ; ip != NULL ; ip = ip->next) {
|
|
|
c8bb8f |
diff -up dhcp-4.2.4b1/common/bpf.c.PPP dhcp-4.2.4b1/common/bpf.c
|
|
|
c8bb8f |
--- dhcp-4.2.4b1/common/bpf.c.PPP 2012-04-16 17:37:23.175619716 +0200
|
|
|
c8bb8f |
+++ dhcp-4.2.4b1/common/bpf.c 2012-04-16 17:37:23.255618596 +0200
|
|
|
c8bb8f |
@@ -599,6 +599,22 @@ get_hw_addr(const char *name, struct har
|
|
|
c8bb8f |
memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen);
|
|
|
c8bb8f |
break;
|
|
|
c8bb8f |
#endif /* IFT_FDDI */
|
|
|
c8bb8f |
+#if defined(IFT_PPP)
|
|
|
c8bb8f |
+ case IFT_PPP:
|
|
|
c8bb8f |
+ if (local_family != AF_INET6)
|
|
|
c8bb8f |
+ log_fatal("Unsupported device type %d for \"%s\"",
|
|
|
c8bb8f |
+ sa->sdl_type, name);
|
|
|
c8bb8f |
+ hw->hlen = 0;
|
|
|
c8bb8f |
+ hw->hbuf[0] = HTYPE_RESERVED;
|
|
|
c8bb8f |
+ /* 0xdeadbeef should never occur on the wire,
|
|
|
c8bb8f |
+ * and is a signature that something went wrong.
|
|
|
c8bb8f |
+ */
|
|
|
c8bb8f |
+ hw->hbuf[1] = 0xde;
|
|
|
c8bb8f |
+ hw->hbuf[2] = 0xad;
|
|
|
c8bb8f |
+ hw->hbuf[3] = 0xbe;
|
|
|
c8bb8f |
+ hw->hbuf[4] = 0xef;
|
|
|
c8bb8f |
+ break;
|
|
|
c8bb8f |
+#endif
|
|
|
c8bb8f |
default:
|
|
|
c8bb8f |
log_fatal("Unsupported device type %d for \"%s\"",
|
|
|
c8bb8f |
sa->sdl_type, name);
|
|
|
c8bb8f |
diff -up dhcp-4.2.4b1/common/lpf.c.PPP dhcp-4.2.4b1/common/lpf.c
|
|
|
c8bb8f |
--- dhcp-4.2.4b1/common/lpf.c.PPP 2012-04-16 17:37:23.155619996 +0200
|
|
|
c8bb8f |
+++ dhcp-4.2.4b1/common/lpf.c 2012-04-16 17:37:23.256618582 +0200
|
|
|
c8bb8f |
@@ -503,6 +503,22 @@ get_hw_addr(const char *name, struct har
|
|
|
c8bb8f |
hw->hbuf[0] = HTYPE_FDDI;
|
|
|
c8bb8f |
memcpy(&hw->hbuf[1], sa->sa_data, 6);
|
|
|
c8bb8f |
break;
|
|
|
c8bb8f |
+#if defined(ARPHRD_PPP)
|
|
|
c8bb8f |
+ case ARPHRD_PPP:
|
|
|
c8bb8f |
+ if (local_family != AF_INET6)
|
|
|
c8bb8f |
+ log_fatal("Unsupported device type %d for \"%s\"",
|
|
|
c8bb8f |
+ sa->sa_family, name);
|
|
|
c8bb8f |
+ hw->hlen = 0;
|
|
|
c8bb8f |
+ hw->hbuf[0] = HTYPE_RESERVED;
|
|
|
c8bb8f |
+ /* 0xdeadbeef should never occur on the wire,
|
|
|
c8bb8f |
+ * and is a signature that something went wrong.
|
|
|
c8bb8f |
+ */
|
|
|
c8bb8f |
+ hw->hbuf[1] = 0xde;
|
|
|
c8bb8f |
+ hw->hbuf[2] = 0xad;
|
|
|
c8bb8f |
+ hw->hbuf[3] = 0xbe;
|
|
|
c8bb8f |
+ hw->hbuf[4] = 0xef;
|
|
|
c8bb8f |
+ break;
|
|
|
c8bb8f |
+#endif
|
|
|
c8bb8f |
default:
|
|
|
c8bb8f |
log_fatal("Unsupported device type %ld for \"%s\"",
|
|
|
c8bb8f |
(long int)sa->sa_family, name);
|
|
|
c8bb8f |
diff -up dhcp-4.2.4b1/includes/dhcpd.h.PPP dhcp-4.2.4b1/includes/dhcpd.h
|
|
|
c8bb8f |
--- dhcp-4.2.4b1/includes/dhcpd.h.PPP 2012-04-16 17:37:23.239618820 +0200
|
|
|
c8bb8f |
+++ dhcp-4.2.4b1/includes/dhcpd.h 2012-04-16 17:37:23.257618568 +0200
|
|
|
c8bb8f |
@@ -2760,7 +2760,7 @@ void dhcpv4_client_assignments(void);
|
|
|
c8bb8f |
void dhcpv6_client_assignments(void);
|
|
|
c8bb8f |
|
|
|
c8bb8f |
/* dhc6.c */
|
|
|
c8bb8f |
-void form_duid(struct data_string *duid, const char *file, int line);
|
|
|
c8bb8f |
+isc_result_t form_duid(struct data_string *duid, const char *file, int line);
|
|
|
c8bb8f |
void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line);
|
|
|
c8bb8f |
void start_init6(struct client_state *client);
|
|
|
c8bb8f |
void start_info_request6(struct client_state *client);
|
|
|
c8bb8f |
diff -up dhcp-4.2.4b1/includes/dhcp.h.PPP dhcp-4.2.4b1/includes/dhcp.h
|
|
|
c8bb8f |
--- dhcp-4.2.4b1/includes/dhcp.h.PPP 2012-04-16 17:37:23.000000000 +0200
|
|
|
c8bb8f |
+++ dhcp-4.2.4b1/includes/dhcp.h 2012-04-16 17:38:34.675618138 +0200
|
|
|
c8bb8f |
@@ -85,6 +85,8 @@ struct dhcp_packet {
|
|
|
c8bb8f |
* is no standard for this so we
|
|
|
c8bb8f |
* just steal a type */
|
|
|
c8bb8f |
|
|
|
c8bb8f |
+#define HTYPE_RESERVED 0 /* RFC 5494 */
|
|
|
c8bb8f |
+
|
|
|
c8bb8f |
/* Magic cookie validating dhcp options field (and bootp vendor
|
|
|
c8bb8f |
extensions field). */
|
|
|
c8bb8f |
#define DHCP_OPTIONS_COOKIE "\143\202\123\143"
|
|
|
c8bb8f |
diff -up dhcp-4.2.4b1/server/dhcpv6.c.PPP dhcp-4.2.4b1/server/dhcpv6.c
|
|
|
c8bb8f |
--- dhcp-4.2.4b1/server/dhcpv6.c.PPP 2012-04-16 17:37:23.218619114 +0200
|
|
|
c8bb8f |
+++ dhcp-4.2.4b1/server/dhcpv6.c 2012-04-16 17:37:23.260618526 +0200
|
|
|
c8bb8f |
@@ -300,6 +300,9 @@ generate_new_server_duid(void) {
|
|
|
c8bb8f |
if (p->hw_address.hlen > 0) {
|
|
|
c8bb8f |
break;
|
|
|
c8bb8f |
}
|
|
|
c8bb8f |
+ if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) {
|
|
|
c8bb8f |
+ log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!");
|
|
|
c8bb8f |
+ }
|
|
|
c8bb8f |
}
|
|
|
c8bb8f |
if (p == NULL) {
|
|
|
c8bb8f |
return ISC_R_UNEXPECTED;
|