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