]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[master] Patch to ignore UIDS
authorShawn Routhier <sar@isc.org>
Fri, 13 Dec 2013 20:40:45 +0000 (12:40 -0800)
committerShawn Routhier <sar@isc.org>
Fri, 13 Dec 2013 20:40:45 +0000 (12:40 -0800)
This patch adds an option to allow the administrator to tell the
server to ignore UIDS when choosing a lease.

RELNOTES
includes/dhcpd.h
server/dhcp.c
server/dhcpd.conf.5
server/stables.c

index 42f8c809a18058daa5572b1de15db41a882cbd31..00aa4aad15b8585edadc900781c162270171df26 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -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
 
index 32c2a89a974bfc64f3a625d5fecadeee2b9812c0..ed86ed440896b126fd5a348b5e9d3d388d8db0be 100644 (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
index 29ab510946dd772a4b7f85e56f898aa46a7a1764..9d77530dc21fe321b163fc36120bfe947d7384c0 100644 (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) {
index 5906c11340550af256bc0b0d775fa81d3ec9d8ce..ed699cf48d4b6d1818d3ad5566443bb6d9f34c1e 100644 (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
index bac6f8dcb566c28347d0dff4345331d438a45b38..398f2e1c42c7e2b27fdef5accf5ced47503d0c0c 100644 (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 }
 };