2016-09-12 15:24:05 +00:00
|
|
|
diff -up dhcp-4.3.5b1/common/options.c.option97 dhcp-4.3.5b1/common/options.c
|
|
|
|
--- dhcp-4.3.5b1/common/options.c.option97 2016-09-12 17:17:13.972691041 +0200
|
|
|
|
+++ dhcp-4.3.5b1/common/options.c 2016-09-12 17:19:17.706790276 +0200
|
|
|
|
@@ -4434,13 +4434,26 @@ int validate_packet(struct packet *packe
|
2014-12-17 09:57:39 +00:00
|
|
|
"a future version of ISC DHCP will reject this");
|
|
|
|
}
|
|
|
|
} else {
|
2016-09-12 15:24:05 +00:00
|
|
|
- /*
|
2014-12-17 09:57:39 +00:00
|
|
|
- * If hlen is 0 we don't have any identifier, we warn the user
|
|
|
|
- * but continue processing the packet as we can.
|
|
|
|
- */
|
|
|
|
- if (packet->raw->hlen == 0) {
|
|
|
|
- log_debug("Received DHCPv4 packet without client-id"
|
|
|
|
- " option and empty hlen field.");
|
|
|
|
+ oc = lookup_option (&dhcp_universe, packet->options,
|
|
|
|
+ DHO_PXE_CLIENT_ID);
|
|
|
|
+ if (oc) {
|
|
|
|
+ /* Let's check if pxe-client-id is sane */
|
|
|
|
+ if ((oc->data.len < 2) ||
|
|
|
|
+ (oc->data.data[0] == '\0' &&
|
|
|
|
+ oc->data.len != 17)) {
|
|
|
|
+ log_debug("Dropped DHCPv4 packet with wrong "
|
|
|
|
+ "(len == %d) pxe-client-id", oc->data.len);
|
|
|
|
+ return (0);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ /*
|
|
|
|
+ * If hlen is 0 we don't have any identifier, we warn the user
|
|
|
|
+ * but continue processing the packet as we can.
|
|
|
|
+ */
|
|
|
|
+ if (packet->raw->hlen == 0) {
|
|
|
|
+ log_debug("Received DHCPv4 packet without client-id"
|
|
|
|
+ " option and empty hlen field.");
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-12 15:24:05 +00:00
|
|
|
diff -up dhcp-4.3.5b1/common/tables.c.option97 dhcp-4.3.5b1/common/tables.c
|
|
|
|
--- dhcp-4.3.5b1/common/tables.c.option97 2016-09-12 17:17:13.927691005 +0200
|
|
|
|
+++ dhcp-4.3.5b1/common/tables.c 2016-09-12 17:17:13.972691041 +0200
|
|
|
|
@@ -196,8 +196,9 @@ static struct option dhcp_options[] = {
|
2014-12-17 09:57:39 +00:00
|
|
|
/* Defined by RFC 4578 */
|
|
|
|
{ "pxe-system-type", "S", &dhcp_universe, 93, 1 },
|
|
|
|
{ "pxe-interface-id", "BBB", &dhcp_universe, 94, 1 },
|
|
|
|
- { "pxe-client-id", "BX", &dhcp_universe, 97, 1 },
|
|
|
|
#endif
|
|
|
|
+ { "pxe-client-id", "BX", &dhcp_universe, 97, 1 },
|
|
|
|
+
|
|
|
|
{ "uap-servers", "t", &dhcp_universe, 98, 1 },
|
|
|
|
#if defined(RFC4776_OPTIONS)
|
|
|
|
{ "geoconf-civic", "X", &dhcp_universe, 99, 1 },
|
2016-09-12 15:24:05 +00:00
|
|
|
diff -up dhcp-4.3.5b1/includes/dhcp.h.option97 dhcp-4.3.5b1/includes/dhcp.h
|
|
|
|
--- dhcp-4.3.5b1/includes/dhcp.h.option97 2016-09-12 17:17:13.936691013 +0200
|
|
|
|
+++ dhcp-4.3.5b1/includes/dhcp.h 2016-09-12 17:17:13.972691041 +0200
|
2014-12-17 09:57:39 +00:00
|
|
|
@@ -159,6 +159,7 @@ struct dhcp_packet {
|
|
|
|
#define DHO_AUTHENTICATE 90 /* RFC3118, was 210 */
|
|
|
|
#define DHO_CLIENT_LAST_TRANSACTION_TIME 91
|
|
|
|
#define DHO_ASSOCIATED_IP 92
|
|
|
|
+#define DHO_PXE_CLIENT_ID 97 /* RFC4578 */
|
|
|
|
#define DHO_SUBNET_SELECTION 118 /* RFC3011! */
|
|
|
|
#define DHO_DOMAIN_SEARCH 119 /* RFC3397 */
|
|
|
|
#define DHO_CLASSLESS_STATIC_ROUTES 121 /* RFC3442 */
|
2016-09-12 15:24:05 +00:00
|
|
|
diff -up dhcp-4.3.5b1/server/dhcp.c.option97 dhcp-4.3.5b1/server/dhcp.c
|
|
|
|
--- dhcp-4.3.5b1/server/dhcp.c.option97 2016-09-12 17:17:13.947691021 +0200
|
|
|
|
+++ dhcp-4.3.5b1/server/dhcp.c 2016-09-12 17:17:13.973691042 +0200
|
|
|
|
@@ -221,6 +221,10 @@ dhcp (struct packet *packet) {
|
2014-12-17 09:57:39 +00:00
|
|
|
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
|
if (!oc)
|
|
|
|
+ oc = lookup_option (&dhcp_universe,
|
|
|
|
+ packet -> options,
|
|
|
|
+ DHO_PXE_CLIENT_ID);
|
|
|
|
+ if (!oc)
|
|
|
|
goto nolease;
|
|
|
|
|
|
|
|
memset (&data, 0, sizeof data);
|
2016-09-12 15:24:05 +00:00
|
|
|
@@ -818,6 +822,9 @@ void dhcprelease (packet, ms_nulltp)
|
2014-12-17 09:57:39 +00:00
|
|
|
|
|
|
|
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
|
+ if (!oc)
|
|
|
|
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
+ DHO_PXE_CLIENT_ID);
|
|
|
|
memset (&data, 0, sizeof data);
|
|
|
|
if (oc &&
|
|
|
|
evaluate_option_cache (&data, packet, (struct lease *)0,
|
2016-09-12 15:24:05 +00:00
|
|
|
@@ -1286,6 +1293,9 @@ void dhcpinform (packet, ms_nulltp)
|
2014-12-17 09:57:39 +00:00
|
|
|
*/
|
|
|
|
oc = lookup_option(&dhcp_universe, packet->options,
|
|
|
|
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
|
+ if (!oc)
|
|
|
|
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
+ DHO_PXE_CLIENT_ID);
|
|
|
|
memset(&d1, 0, sizeof(d1));
|
|
|
|
if (oc &&
|
|
|
|
evaluate_option_cache(&d1, packet, NULL, NULL,
|
2016-09-12 15:24:05 +00:00
|
|
|
@@ -2381,6 +2391,9 @@ void ack_lease (packet, lease, offer, wh
|
2014-12-17 09:57:39 +00:00
|
|
|
can be used. */
|
|
|
|
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
|
+ if (!oc)
|
|
|
|
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
+ DHO_PXE_CLIENT_ID);
|
|
|
|
if (oc &&
|
|
|
|
evaluate_option_cache (&d1, packet, lease,
|
|
|
|
(struct client_state *)0,
|
2016-09-12 15:24:05 +00:00
|
|
|
@@ -2962,6 +2975,9 @@ void ack_lease (packet, lease, offer, wh
|
2014-12-17 09:57:39 +00:00
|
|
|
/* Record the uid, if given... */
|
|
|
|
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
|
+ if (!oc)
|
|
|
|
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
+ DHO_PXE_CLIENT_ID);
|
|
|
|
if (oc &&
|
|
|
|
evaluate_option_cache(&d1, packet, lease, NULL,
|
|
|
|
packet->options, state->options,
|
2016-09-12 15:24:05 +00:00
|
|
|
@@ -4068,6 +4084,9 @@ int find_lease (struct lease **lp,
|
2014-12-17 09:57:39 +00:00
|
|
|
specified unique client identifier. */
|
|
|
|
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
|
+ if (!oc)
|
|
|
|
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
|
+ DHO_PXE_CLIENT_ID);
|
|
|
|
memset (&client_identifier, 0, sizeof client_identifier);
|
|
|
|
if (oc &&
|
|
|
|
evaluate_option_cache (&client_identifier,
|
2016-09-12 15:24:05 +00:00
|
|
|
diff -up dhcp-4.3.5b1/server/dhcpd.conf.5.option97 dhcp-4.3.5b1/server/dhcpd.conf.5
|
|
|
|
--- dhcp-4.3.5b1/server/dhcpd.conf.5.option97 2016-09-12 17:17:13.885690972 +0200
|
|
|
|
+++ dhcp-4.3.5b1/server/dhcpd.conf.5 2016-09-12 17:17:13.974691043 +0200
|
|
|
|
@@ -1587,10 +1587,12 @@ should be a name identifying the host.
|
2014-12-17 09:57:39 +00:00
|
|
|
not specified for the host, \fIhostname\fR is used.
|
|
|
|
.PP
|
|
|
|
\fIHost\fR declarations are matched to actual DHCP or BOOTP clients
|
|
|
|
-by matching the \fRdhcp-client-identifier\fR option specified in the
|
|
|
|
+by matching the \fIdhcp-client-identifier\fR or \fIpxe-client-id\fR
|
|
|
|
+options specified in the
|
|
|
|
\fIhost\fR declaration to the one supplied by the client, or, if the
|
|
|
|
\fIhost\fR declaration or the client does not provide a
|
|
|
|
-\fRdhcp-client-identifier\fR option, by matching the \fIhardware\fR
|
|
|
|
+\fIdhcp-client-identifier\fR or \fIpxe-client-id\fR options,
|
|
|
|
+by matching the \fIhardware\fR
|
|
|
|
parameter in the \fIhost\fR declaration to the network hardware
|
|
|
|
address supplied by the client. BOOTP clients do not normally
|
|
|
|
provide a \fIdhcp-client-identifier\fR, so the hardware address must
|
2016-09-12 15:24:05 +00:00
|
|
|
@@ -1602,7 +1604,8 @@ to identify hosts.
|
2014-12-17 09:57:39 +00:00
|
|
|
.PP
|
|
|
|
Please be aware that
|
|
|
|
.B only
|
|
|
|
-the \fIdhcp-client-identifier\fR option and the hardware address can be
|
|
|
|
+the \fIdhcp-client-identifier\fR and \fIpxe-client-id\fR
|
|
|
|
+options and the hardware address can be
|
|
|
|
used to match a host declaration, or the \fIhost-identifier option\fR
|
|
|
|
parameter for DHCPv6 servers. For example, it is not possible to
|
|
|
|
match a host declaration to a \fIhost-name\fR option. This is
|
2016-09-12 15:24:05 +00:00
|
|
|
diff -up dhcp-4.3.5b1/server/dhcpleasequery.c.option97 dhcp-4.3.5b1/server/dhcpleasequery.c
|
|
|
|
--- dhcp-4.3.5b1/server/dhcpleasequery.c.option97 2016-08-26 20:19:53.000000000 +0200
|
|
|
|
+++ dhcp-4.3.5b1/server/dhcpleasequery.c 2016-09-12 17:17:13.974691043 +0200
|
|
|
|
@@ -273,7 +273,7 @@ dhcpleasequery(struct packet *packet, in
|
2014-12-17 09:57:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
memset(&uid, 0, sizeof(uid));
|
|
|
|
- if (get_option(&uid,
|
|
|
|
+ i = get_option(&uid,
|
|
|
|
&dhcp_universe,
|
|
|
|
packet,
|
|
|
|
NULL,
|
2016-09-12 15:24:05 +00:00
|
|
|
@@ -283,8 +283,20 @@ dhcpleasequery(struct packet *packet, in
|
2014-12-17 09:57:39 +00:00
|
|
|
packet->options,
|
|
|
|
&global_scope,
|
|
|
|
DHO_DHCP_CLIENT_IDENTIFIER,
|
|
|
|
- MDL)) {
|
|
|
|
-
|
|
|
|
+ MDL);
|
|
|
|
+ if (!i)
|
|
|
|
+ i = get_option(&uid,
|
|
|
|
+ &dhcp_universe,
|
|
|
|
+ packet,
|
|
|
|
+ NULL,
|
|
|
|
+ NULL,
|
|
|
|
+ packet->options,
|
|
|
|
+ NULL,
|
|
|
|
+ packet->options,
|
|
|
|
+ &global_scope,
|
|
|
|
+ DHO_PXE_CLIENT_ID,
|
|
|
|
+ MDL);
|
|
|
|
+ if (i) {
|
|
|
|
snprintf(dbg_info,
|
|
|
|
sizeof(dbg_info),
|
|
|
|
"client-id %s",
|
2016-09-12 15:24:05 +00:00
|
|
|
diff -up dhcp-4.3.5b1/server/failover.c.option97 dhcp-4.3.5b1/server/failover.c
|
|
|
|
--- dhcp-4.3.5b1/server/failover.c.option97 2016-08-26 20:19:53.000000000 +0200
|
|
|
|
+++ dhcp-4.3.5b1/server/failover.c 2016-09-12 17:17:13.975691044 +0200
|
|
|
|
@@ -5957,6 +5957,9 @@ int load_balance_mine (struct packet *pa
|
2014-12-17 09:57:39 +00:00
|
|
|
|
|
|
|
oc = lookup_option(&dhcp_universe, packet->options,
|
|
|
|
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
|
+ if (!oc)
|
|
|
|
+ oc = lookup_option(&dhcp_universe, packet -> options,
|
|
|
|
+ DHO_PXE_CLIENT_ID);
|
|
|
|
memset(&ds, 0, sizeof ds);
|
|
|
|
if (oc &&
|
|
|
|
evaluate_option_cache(&ds, packet, NULL, NULL,
|
2016-09-12 15:24:05 +00:00
|
|
|
diff -up dhcp-4.3.5b1/server/mdb.c.option97 dhcp-4.3.5b1/server/mdb.c
|
|
|
|
--- dhcp-4.3.5b1/server/mdb.c.option97 2016-08-26 20:19:53.000000000 +0200
|
|
|
|
+++ dhcp-4.3.5b1/server/mdb.c 2016-09-12 17:17:13.975691044 +0200
|
|
|
|
@@ -129,8 +129,9 @@ static int find_uid_statement (struct ex
|
2014-12-17 09:57:39 +00:00
|
|
|
esp -> data.option &&
|
|
|
|
(esp -> data.option -> option -> universe ==
|
|
|
|
&dhcp_universe) &&
|
|
|
|
- (esp -> data.option -> option -> code ==
|
|
|
|
- DHO_DHCP_CLIENT_IDENTIFIER)) {
|
|
|
|
+ ((esp -> data.option -> option -> code ==
|
|
|
|
+ DHO_DHCP_CLIENT_IDENTIFIER) ||
|
|
|
|
+ (esp -> data.option -> option -> code == DHO_PXE_CLIENT_ID))) {
|
|
|
|
if (condp) {
|
|
|
|
log_error ("dhcp client identifier may not be %s",
|
|
|
|
"specified conditionally.");
|