2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-22 01:49:35 +00:00

[master] Patch to ignore UIDS

This patch adds an option to allow the administrator to tell the
server to ignore UIDS when choosing a lease.
This commit is contained in:
Shawn Routhier 2013-12-13 12:40:45 -08:00
parent 61ef216b8d
commit 38ee81bd80
5 changed files with 58 additions and 26 deletions

View File

@ -109,6 +109,7 @@ work on other platforms. Please report any problems and suggested fixes to
man page for a description.
[ISC-Bugs #19598]
<<<<<<< HEAD
- When doing DDNS if there isn't an appropriate zone statement attempt
to find a reasoanble nameserver via a DNS resolver. This restores
some functionality that was lost in the transition to asynchronous
@ -122,6 +123,15 @@ work on other platforms. Please report any problems and suggested fixes to
"ddns-local-address4" and "ddns-local-address6" that each take
one instance of their respective address types.
[ISC-Bugs #34779]
=======
- Add ignore-client-uids option in the server. This option causes
the server to not record a client's uid in its lease. This
violates the specification but may also be useful when a client
can dual boot using different client ids but the same mac address.
Thank you to Brian De Wolf for the patch.
[ISC-Bugs #32427]
[ISC-Bugs #35066]
>>>>>>> rt35066
Changes since 4.2.5

View File

@ -735,6 +735,7 @@ struct lease_state {
#define SV_DONT_USE_FSYNC 79
#define SV_DDNS_LOCAL_ADDRESS4 80
#define SV_DDNS_LOCAL_ADDRESS6 81
#define SV_IGNORE_CLIENT_UIDS 82
#if !defined (DEFAULT_PING_TIMEOUT)
# define DEFAULT_PING_TIMEOUT 1

View File

@ -2343,31 +2343,40 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
/* Update Client Last Transaction Time. */
lt->cltt = cur_time;
/* Record the uid, if given... */
oc = lookup_option (&dhcp_universe, packet -> options,
DHO_DHCP_CLIENT_IDENTIFIER);
if (oc &&
evaluate_option_cache (&d1, packet, lease,
(struct client_state *)0,
packet -> options, state -> options,
&lease -> scope, oc, MDL)) {
if (d1.len <= sizeof lt -> uid_buf) {
memcpy (lt -> uid_buf, d1.data, d1.len);
lt -> uid = lt -> uid_buf;
lt -> uid_max = sizeof lt -> uid_buf;
lt -> uid_len = d1.len;
} else {
unsigned char *tuid;
lt -> uid_max = d1.len;
lt -> uid_len = d1.len;
tuid = (unsigned char *)dmalloc (lt -> uid_max, MDL);
/* XXX inelegant */
if (!tuid)
log_fatal ("no memory for large uid.");
memcpy (tuid, d1.data, lt -> uid_len);
lt -> uid = tuid;
/* See if we want to record the uid for this client */
oc = lookup_option(&server_universe, state->options,
SV_IGNORE_CLIENT_UIDS);
if ((oc == NULL) ||
!evaluate_boolean_option_cache(&ignorep, packet, lease, NULL,
packet->options, state->options,
&lease->scope, oc, MDL)) {
/* Record the uid, if given... */
oc = lookup_option (&dhcp_universe, packet -> options,
DHO_DHCP_CLIENT_IDENTIFIER);
if (oc &&
evaluate_option_cache(&d1, packet, lease, NULL,
packet->options, state->options,
&lease->scope, oc, MDL)) {
if (d1.len <= sizeof(lt->uid_buf)) {
memcpy(lt->uid_buf, d1.data, d1.len);
lt->uid = lt->uid_buf;
lt->uid_max = sizeof(lt->uid_buf);
lt->uid_len = d1.len;
} else {
unsigned char *tuid;
lt->uid_max = d1.len;
lt->uid_len = d1.len;
tuid = (unsigned char *)dmalloc(lt->uid_max,
MDL);
/* XXX inelegant */
if (!tuid)
log_fatal ("no memory for large uid.");
memcpy(tuid, d1.data, lt->uid_len);
lt->uid = tuid;
}
data_string_forget (&d1, MDL);
}
data_string_forget (&d1, MDL);
}
if (host) {

View File

@ -2305,6 +2305,19 @@ are larger than the maximum number of relays (currently 32) indicate the
relay closest to the server independent of number.
.RE
.PP
The
.I ignore-client-uids
statement
.RS 0.25i
.PP
.B ignore-client-uids \fIflag\fB;\fR
.PP
If the \fIignore-client-uids\fR statement is present and has a value of
\fItrue\fR or \fIon\fR, the UID for clients will not be recorded.
If this statement is not present or has a value of \fIfalse\fR or
\fIoff\fR, then client UIDs will be recorded.
.RE
.PP
The
.I infinite-is-reserved
statement

View File

@ -268,10 +268,9 @@ static struct option server_options[] = {
#endif /* LDAP_CONFIGURATION */
{ "dhcp-cache-threshold", "B", &server_universe, 78, 1 },
{ "dont-use-fsync", "f", &server_universe, 79, 1 },
{ "ddns-local-address4", "I", &server_universe, 80, 1 },
{ "ddns-local-address6", "6", &server_universe, 81, 1 },
{ "ignore-client-uids", "f", &server_universe, 82, 1 },
{ NULL, NULL, NULL, 0, 0 }
};