|
|
54343e |
diff -up dhcp-4.2.5/common/options.c.option97 dhcp-4.2.5/common/options.c
|
|
|
54343e |
--- dhcp-4.2.5/common/options.c.option97 2015-05-20 16:44:34.958765179 +0200
|
|
|
54343e |
+++ dhcp-4.2.5/common/options.c 2015-05-20 16:44:35.078763436 +0200
|
|
|
54343e |
@@ -4222,13 +4222,26 @@ int validate_packet(struct packet *packe
|
|
|
54343e |
"a future version of ISC DHCP will reject this");
|
|
|
54343e |
}
|
|
|
54343e |
} else {
|
|
|
54343e |
- /*
|
|
|
54343e |
- * If hlen is 0 we don't have any identifier, we warn the user
|
|
|
54343e |
- * but continue processing the packet as we can.
|
|
|
54343e |
- */
|
|
|
54343e |
- if (packet->raw->hlen == 0) {
|
|
|
54343e |
- log_debug("Received DHCPv4 packet without client-id"
|
|
|
54343e |
- " option and empty hlen field.");
|
|
|
54343e |
+ oc = lookup_option (&dhcp_universe, packet->options,
|
|
|
54343e |
+ DHO_PXE_CLIENT_ID);
|
|
|
54343e |
+ if (oc) {
|
|
|
54343e |
+ /* Let's check if pxe-client-id is sane */
|
|
|
54343e |
+ if ((oc->data.len < 2) ||
|
|
|
54343e |
+ (oc->data.data[0] == '\0' &&
|
|
|
54343e |
+ oc->data.len != 17)) {
|
|
|
54343e |
+ log_debug("Dropped DHCPv4 packet with wrong "
|
|
|
54343e |
+ "(len == %d) pxe-client-id", oc->data.len);
|
|
|
54343e |
+ return (0);
|
|
|
54343e |
+ }
|
|
|
54343e |
+ } else {
|
|
|
54343e |
+ /*
|
|
|
54343e |
+ * If hlen is 0 we don't have any identifier, we warn the user
|
|
|
54343e |
+ * but continue processing the packet as we can.
|
|
|
54343e |
+ */
|
|
|
54343e |
+ if (packet->raw->hlen == 0) {
|
|
|
54343e |
+ log_debug("Received DHCPv4 packet without client-id"
|
|
|
54343e |
+ " option and empty hlen field.");
|
|
|
54343e |
+ }
|
|
|
54343e |
}
|
|
|
54343e |
}
|
|
|
54343e |
|
|
|
54343e |
diff -up dhcp-4.2.5/common/tables.c.option97 dhcp-4.2.5/common/tables.c
|
|
|
54343e |
--- dhcp-4.2.5/common/tables.c.option97 2015-05-20 16:44:35.079763422 +0200
|
|
|
54343e |
+++ dhcp-4.2.5/common/tables.c 2015-05-20 16:47:50.172931400 +0200
|
|
|
54343e |
@@ -203,8 +203,9 @@ static struct option dhcp_options[] = {
|
|
|
54343e |
/* Defined by RFC 4578 */
|
|
|
54343e |
{ "pxe-system-type", "S", &dhcp_universe, 93, 1 },
|
|
|
54343e |
{ "pxe-interface-id", "BBB", &dhcp_universe, 94, 1 },
|
|
|
54343e |
- { "pxe-client-id", "BX", &dhcp_universe, 97, 1 },
|
|
|
54343e |
#endif
|
|
|
54343e |
+ { "pxe-client-id", "BX", &dhcp_universe, 97, 1 },
|
|
|
54343e |
+
|
|
|
54343e |
{ "uap-servers", "t", &dhcp_universe, 98, 1 },
|
|
|
54343e |
{ "netinfo-server-address", "Ia", &dhcp_universe, 112, 1 },
|
|
|
54343e |
{ "netinfo-server-tag", "t", &dhcp_universe, 113, 1 },
|
|
|
54343e |
diff -up dhcp-4.2.5/includes/dhcp.h.option97 dhcp-4.2.5/includes/dhcp.h
|
|
|
54343e |
--- dhcp-4.2.5/includes/dhcp.h.option97 2015-05-20 16:44:34.975764932 +0200
|
|
|
54343e |
+++ dhcp-4.2.5/includes/dhcp.h 2015-05-20 16:44:35.079763422 +0200
|
|
|
54343e |
@@ -163,6 +163,7 @@ struct dhcp_packet {
|
|
|
54343e |
#define DHO_AUTHENTICATE 90 /* RFC3118, was 210 */
|
|
|
54343e |
#define DHO_CLIENT_LAST_TRANSACTION_TIME 91
|
|
|
54343e |
#define DHO_ASSOCIATED_IP 92
|
|
|
54343e |
+#define DHO_PXE_CLIENT_ID 97 /* RFC4578 */
|
|
|
54343e |
#define DHO_SUBNET_SELECTION 118 /* RFC3011! */
|
|
|
54343e |
#define DHO_DOMAIN_SEARCH 119 /* RFC3397 */
|
|
|
54343e |
#define DHO_CLASSLESS_STATIC_ROUTES 121 /* RFC3442 */
|
|
|
54343e |
diff -up dhcp-4.2.5/server/dhcp.c.option97 dhcp-4.2.5/server/dhcp.c
|
|
|
54343e |
--- dhcp-4.2.5/server/dhcp.c.option97 2015-05-20 16:44:35.060763698 +0200
|
|
|
54343e |
+++ dhcp-4.2.5/server/dhcp.c 2015-05-20 16:51:26.718798033 +0200
|
|
|
54343e |
@@ -202,6 +205,10 @@ dhcp (struct packet *packet) {
|
|
|
54343e |
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
54343e |
if (!oc)
|
|
|
54343e |
+ oc = lookup_option (&dhcp_universe,
|
|
|
54343e |
+ packet -> options,
|
|
|
54343e |
+ DHO_PXE_CLIENT_ID);
|
|
|
54343e |
+ if (!oc)
|
|
|
54343e |
goto nolease;
|
|
|
54343e |
|
|
|
54343e |
memset (&data, 0, sizeof data);
|
|
|
54343e |
@@ -770,6 +777,9 @@ void dhcprelease (packet, ms_nulltp)
|
|
|
54343e |
|
|
|
54343e |
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
54343e |
+ if (!oc)
|
|
|
54343e |
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
+ DHO_PXE_CLIENT_ID);
|
|
|
54343e |
memset (&data, 0, sizeof data);
|
|
|
54343e |
if (oc &&
|
|
|
54343e |
evaluate_option_cache (&data, packet, (struct lease *)0,
|
|
|
54343e |
@@ -1841,6 +1851,9 @@ void ack_lease (packet, lease, offer, wh
|
|
|
54343e |
can be used. */
|
|
|
54343e |
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
54343e |
+ if (!oc)
|
|
|
54343e |
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
+ DHO_PXE_CLIENT_ID);
|
|
|
54343e |
if (oc &&
|
|
|
54343e |
evaluate_option_cache (&d1, packet, lease,
|
|
|
54343e |
(struct client_state *)0,
|
|
|
54343e |
@@ -2386,6 +2399,9 @@ void ack_lease (packet, lease, offer, wh
|
|
|
54343e |
/* Record the uid, if given... */
|
|
|
54343e |
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
54343e |
+ if (!oc)
|
|
|
54343e |
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
+ DHO_PXE_CLIENT_ID);
|
|
|
54343e |
if (oc &&
|
|
|
54343e |
evaluate_option_cache (&d1, packet, lease,
|
|
|
54343e |
(struct client_state *)0,
|
|
|
54343e |
@@ -3429,6 +3445,9 @@ int find_lease (struct lease **lp,
|
|
|
54343e |
specified unique client identifier. */
|
|
|
54343e |
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
54343e |
+ if (!oc)
|
|
|
54343e |
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
54343e |
+ DHO_PXE_CLIENT_ID);
|
|
|
54343e |
memset (&client_identifier, 0, sizeof client_identifier);
|
|
|
54343e |
if (oc &&
|
|
|
54343e |
evaluate_option_cache (&client_identifier,
|
|
|
54343e |
diff -up dhcp-4.2.5/server/dhcpd.conf.5.option97 dhcp-4.2.5/server/dhcpd.conf.5
|
|
|
54343e |
--- dhcp-4.2.5/server/dhcpd.conf.5.option97 2015-05-20 16:44:34.908765906 +0200
|
|
|
54343e |
+++ dhcp-4.2.5/server/dhcpd.conf.5 2015-05-20 16:44:35.081763393 +0200
|
|
|
54343e |
@@ -1657,10 +1657,12 @@ should be a name identifying the host.
|
|
|
54343e |
not specified for the host, \fIhostname\fR is used.
|
|
|
54343e |
.PP
|
|
|
54343e |
\fIHost\fR declarations are matched to actual DHCP or BOOTP clients
|
|
|
54343e |
-by matching the \fRdhcp-client-identifier\fR option specified in the
|
|
|
54343e |
+by matching the \fIdhcp-client-identifier\fR or \fIpxe-client-id\fR
|
|
|
54343e |
+options specified in the
|
|
|
54343e |
\fIhost\fR declaration to the one supplied by the client, or, if the
|
|
|
54343e |
\fIhost\fR declaration or the client does not provide a
|
|
|
54343e |
-\fRdhcp-client-identifier\fR option, by matching the \fIhardware\fR
|
|
|
54343e |
+\fIdhcp-client-identifier\fR or \fIpxe-client-id\fR options,
|
|
|
54343e |
+by matching the \fIhardware\fR
|
|
|
54343e |
parameter in the \fIhost\fR declaration to the network hardware
|
|
|
54343e |
address supplied by the client. BOOTP clients do not normally
|
|
|
54343e |
provide a \fIdhcp-client-identifier\fR, so the hardware address must
|
|
|
54343e |
@@ -1672,7 +1674,8 @@ to identify hosts.
|
|
|
54343e |
.PP
|
|
|
54343e |
Please be aware that
|
|
|
54343e |
.B only
|
|
|
54343e |
-the \fIdhcp-client-identifier\fR option and the hardware address can be
|
|
|
54343e |
+the \fIdhcp-client-identifier\fR and \fIpxe-client-id\fR
|
|
|
54343e |
+options and the hardware address can be
|
|
|
54343e |
used to match a host declaration, or the \fIhost-identifier option\fR
|
|
|
54343e |
parameter for DHCPv6 servers. For example, it is not possible to
|
|
|
54343e |
match a host declaration to a \fIhost-name\fR option. This is
|
|
|
54343e |
diff -up dhcp-4.2.5/server/dhcpleasequery.c.option97 dhcp-4.2.5/server/dhcpleasequery.c
|
|
|
54343e |
--- dhcp-4.2.5/server/dhcpleasequery.c.option97 2013-01-03 01:02:25.000000000 +0100
|
|
|
54343e |
+++ dhcp-4.2.5/server/dhcpleasequery.c 2015-05-20 16:44:35.082763378 +0200
|
|
|
54343e |
@@ -279,7 +279,7 @@ dhcpleasequery(struct packet *packet, in
|
|
|
54343e |
*/
|
|
|
54343e |
|
|
|
54343e |
memset(&uid, 0, sizeof(uid));
|
|
|
54343e |
- if (get_option(&uid,
|
|
|
54343e |
+ i = get_option(&uid,
|
|
|
54343e |
&dhcp_universe,
|
|
|
54343e |
packet,
|
|
|
54343e |
NULL,
|
|
|
54343e |
@@ -289,8 +289,20 @@ dhcpleasequery(struct packet *packet, in
|
|
|
54343e |
packet->options,
|
|
|
54343e |
&global_scope,
|
|
|
54343e |
DHO_DHCP_CLIENT_IDENTIFIER,
|
|
|
54343e |
- MDL)) {
|
|
|
54343e |
-
|
|
|
54343e |
+ MDL);
|
|
|
54343e |
+ if (!i)
|
|
|
54343e |
+ i = get_option(&uid,
|
|
|
54343e |
+ &dhcp_universe,
|
|
|
54343e |
+ packet,
|
|
|
54343e |
+ NULL,
|
|
|
54343e |
+ NULL,
|
|
|
54343e |
+ packet->options,
|
|
|
54343e |
+ NULL,
|
|
|
54343e |
+ packet->options,
|
|
|
54343e |
+ &global_scope,
|
|
|
54343e |
+ DHO_PXE_CLIENT_ID,
|
|
|
54343e |
+ MDL);
|
|
|
54343e |
+ if (i) {
|
|
|
54343e |
snprintf(dbg_info,
|
|
|
54343e |
sizeof(dbg_info),
|
|
|
54343e |
"client-id %s",
|
|
|
54343e |
diff -up dhcp-4.2.5/server/failover.c.option97 dhcp-4.2.5/server/failover.c
|
|
|
54343e |
--- dhcp-4.2.5/server/failover.c.option97 2015-05-20 16:44:35.001764555 +0200
|
|
|
54343e |
+++ dhcp-4.2.5/server/failover.c 2015-05-20 16:44:35.083763364 +0200
|
|
|
54343e |
@@ -5875,6 +5875,9 @@ int load_balance_mine (struct packet *pa
|
|
|
54343e |
|
|
|
54343e |
oc = lookup_option(&dhcp_universe, packet->options,
|
|
|
54343e |
DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
54343e |
+ if (!oc)
|
|
|
54343e |
+ oc = lookup_option(&dhcp_universe, packet -> options,
|
|
|
54343e |
+ DHO_PXE_CLIENT_ID);
|
|
|
54343e |
memset(&ds, 0, sizeof ds);
|
|
|
54343e |
if (oc &&
|
|
|
54343e |
evaluate_option_cache(&ds, packet, NULL, NULL,
|
|
|
54343e |
diff -up dhcp-4.2.5/server/mdb.c.option97 dhcp-4.2.5/server/mdb.c
|
|
|
54343e |
--- dhcp-4.2.5/server/mdb.c.option97 2013-01-03 01:02:25.000000000 +0100
|
|
|
54343e |
+++ dhcp-4.2.5/server/mdb.c 2015-05-20 16:44:35.084763349 +0200
|
|
|
54343e |
@@ -127,8 +127,9 @@ static int find_uid_statement (struct ex
|
|
|
54343e |
esp -> data.option &&
|
|
|
54343e |
(esp -> data.option -> option -> universe ==
|
|
|
54343e |
&dhcp_universe) &&
|
|
|
54343e |
- (esp -> data.option -> option -> code ==
|
|
|
54343e |
- DHO_DHCP_CLIENT_IDENTIFIER)) {
|
|
|
54343e |
+ ((esp -> data.option -> option -> code ==
|
|
|
54343e |
+ DHO_DHCP_CLIENT_IDENTIFIER) ||
|
|
|
54343e |
+ (esp -> data.option -> option -> code == DHO_PXE_CLIENT_ID))) {
|
|
|
54343e |
if (condp) {
|
|
|
54343e |
log_error ("dhcp client identifier may not be %s",
|
|
|
54343e |
"specified conditionally.");
|