components/isc-dhcp/patches/ignore-client-uids.patch
changeset 5261 172253f94ecf
parent 5260 e336bbbceb4f
child 5262 86d81f5e0391
equal deleted inserted replaced
5260:e336bbbceb4f 5261:172253f94ecf
     1 The following patch is adopted from ISC DHCP version 4.3.0.
       
     2 http://ftp.isc.org/isc/dhcp/4.3.0/dhcp-4.3.0.tar.gz
       
     3 
       
     4 --- dhcp-4.1-ESV-R7/server/stables.c.orig	Thu Aug 23 19:23:54 2012
       
     5 +++ dhcp-4.1-ESV-R7/server/stables.c	Mon Apr 28 16:37:14 2014
       
     6 @@ -244,6 +244,7 @@
       
     7  	{ "delayed-ack", "S",			&server_universe,  58, 1 },
       
     8  	{ "max-ack-delay", "L",			&server_universe,  59, 1 },
       
     9  #endif
       
    10 +	{ "ignore-client-uids", "f",		&server_universe,  60, 1 },
       
    11  	{ NULL, NULL, NULL, 0, 0 }
       
    12  };
       
    13  
       
    14 --- dhcp-4.1-ESV-R7/server/dhcp.c.orig	Thu Aug 23 19:23:54 2012
       
    15 +++ dhcp-4.1-ESV-R7/server/dhcp.c	Mon Apr 28 16:36:18 2014
       
    16 @@ -2304,31 +2304,40 @@
       
    17  	/* Update Client Last Transaction Time. */
       
    18  	lt->cltt = cur_time;
       
    19  
       
    20 -	/* Record the uid, if given... */
       
    21 -	oc = lookup_option (&dhcp_universe, packet -> options,
       
    22 -			    DHO_DHCP_CLIENT_IDENTIFIER);
       
    23 -	if (oc &&
       
    24 -	    evaluate_option_cache (&d1, packet, lease,
       
    25 -				   (struct client_state *)0,
       
    26 -				   packet -> options, state -> options,
       
    27 -				   &lease -> scope, oc, MDL)) {
       
    28 -		if (d1.len <= sizeof lt -> uid_buf) {
       
    29 -			memcpy (lt -> uid_buf, d1.data, d1.len);
       
    30 -			lt -> uid = lt -> uid_buf;
       
    31 -			lt -> uid_max = sizeof lt -> uid_buf;
       
    32 -			lt -> uid_len = d1.len;
       
    33 -		} else {
       
    34 -			unsigned char *tuid;
       
    35 -			lt -> uid_max = d1.len;
       
    36 -			lt -> uid_len = d1.len;
       
    37 -			tuid = (unsigned char *)dmalloc (lt -> uid_max, MDL);
       
    38 -			/* XXX inelegant */
       
    39 -			if (!tuid)
       
    40 -				log_fatal ("no memory for large uid.");
       
    41 -			memcpy (tuid, d1.data, lt -> uid_len);
       
    42 -			lt -> uid = tuid;
       
    43 +	/* See if we want to record the uid for this client */
       
    44 +	oc = lookup_option(&server_universe, state->options,
       
    45 +	    SV_IGNORE_CLIENT_UIDS);
       
    46 +	if ((oc == NULL) ||
       
    47 +	    !evaluate_boolean_option_cache(&ignorep, packet, lease, NULL,
       
    48 +		packet->options, state->options,
       
    49 +		&lease->scope, oc, MDL)) {
       
    50 +
       
    51 +		/* Record the uid, if given... */
       
    52 +		oc = lookup_option (&dhcp_universe, packet -> options,
       
    53 +		    DHO_DHCP_CLIENT_IDENTIFIER);
       
    54 +		if (oc &&
       
    55 +		    evaluate_option_cache (&d1, packet, lease,
       
    56 +			(struct client_state *)0,
       
    57 +			packet -> options, state -> options,
       
    58 +			&lease -> scope, oc, MDL)) {
       
    59 +			if (d1.len <= sizeof lt -> uid_buf) {
       
    60 +				memcpy (lt -> uid_buf, d1.data, d1.len);
       
    61 +				lt -> uid = lt -> uid_buf;
       
    62 +				lt -> uid_max = sizeof lt -> uid_buf;
       
    63 +				lt -> uid_len = d1.len;
       
    64 +			} else {
       
    65 +				unsigned char *tuid;
       
    66 +				lt -> uid_max = d1.len;
       
    67 +				lt -> uid_len = d1.len;
       
    68 +				tuid = (unsigned char *)dmalloc (lt -> uid_max, MDL);
       
    69 +				/* XXX inelegant */
       
    70 +				if (!tuid)
       
    71 +					log_fatal ("no memory for large uid.");
       
    72 +				memcpy (tuid, d1.data, lt -> uid_len);
       
    73 +				lt -> uid = tuid;
       
    74 +			}
       
    75 +			data_string_forget (&d1, MDL);
       
    76  		}
       
    77 -		data_string_forget (&d1, MDL);
       
    78  	}
       
    79  
       
    80  	if (host) {
       
    81 --- dhcp-4.1-ESV-R7/server/dhcpd.conf.5.orig	Wed May  7 18:37:36 2014
       
    82 +++ dhcp-4.1-ESV-R7/server/dhcpd.conf.5	Wed May  7 18:38:46 2014
       
    83 @@ -2302,6 +2302,19 @@
       
    84  must be a constant value.
       
    85  .RE
       
    86  .PP
       
    87 +The
       
    88 +.I ignore-client-uids
       
    89 +statement
       
    90 +.RS 0.25i
       
    91 +.PP
       
    92 +.B ignore-client-uids \fIflag\fB;\fR
       
    93 +.PP
       
    94 +If the \fIignore-client-uids\fR statement is present and has a value of
       
    95 +\fItrue\fR or \fIon\fR, the UID for clients will not be recorded.
       
    96 +If this statement is not present or has a value of \fIfalse\fR or
       
    97 +\fIoff\fR, then client UIDs will be recorded.
       
    98 +.RE
       
    99 +.PP
       
   100  The
       
   101  .I infinite-is-reserved
       
   102  statement
       
   103 --- dhcp-4.1-ESV-R7/includes/dhcpd.h.orig	Thu Aug 23 19:23:53 2012
       
   104 +++ dhcp-4.1-ESV-R7/includes/dhcpd.h	Mon Apr 28 16:11:17 2014
       
   105 @@ -627,6 +627,7 @@
       
   106  #define SV_LIMIT_PREFS_PER_IA		57
       
   107  #define SV_DELAYED_ACK			58
       
   108  #define SV_MAX_ACK_DELAY		59
       
   109 +#define SV_IGNORE_CLIENT_UIDS		60
       
   110  
       
   111  #if !defined (DEFAULT_PING_TIMEOUT)
       
   112  # define DEFAULT_PING_TIMEOUT 1