diff -rNc2 dhcp-2.0b1pl12/README dhcp-2.0b1pl13/README *** dhcp-2.0b1pl12/README Sat Feb 13 11:25:08 1999 --- dhcp-2.0b1pl13/README Tue Feb 16 12:36:59 1999 *************** *** 1,6 **** Internet Software Consortium Dynamic Host Configuration Protocol Distribution ! Version 2, Beta 1, Patchlevel 12 ! February 13, 1998 This is the first Beta release of Version 2 of the Internet Software --- 1,6 ---- Internet Software Consortium Dynamic Host Configuration Protocol Distribution ! Version 2, Beta 1, Patchlevel 13 ! February 16, 1998 This is the first Beta release of Version 2 of the Internet Software *************** *** 48,54 **** the tar utility and the gzip command - type something like: ! zcat dhcp-2.0b1pl12.tar.gz |tar xvf - ! Now, cd to the dhcp-2.0b1pl12 subdirectory that you've just created and configure the source tree by typing: --- 48,54 ---- the tar utility and the gzip command - type something like: ! zcat dhcp-2.0b1pl13.tar.gz |tar xvf - ! Now, cd to the dhcp-2.0b1pl13 subdirectory that you've just created and configure the source tree by typing: diff -rNc2 dhcp-2.0b1pl12/RELNOTES dhcp-2.0b1pl13/RELNOTES *** dhcp-2.0b1pl12/RELNOTES Sat Feb 13 11:38:14 1999 --- dhcp-2.0b1pl13/RELNOTES Tue Feb 16 12:37:41 1999 *************** *** 1,6 **** Internet Software Consortium Dynamic Host Configuration Protocol Distribution ! Version 2, Beta 1, Patchlevel 12 ! February 13, 1998 Release Notes --- 1,6 ---- Internet Software Consortium Dynamic Host Configuration Protocol Distribution ! Version 2, Beta 1, Patchlevel 13 ! February 16, 1998 Release Notes *************** *** 53,56 **** --- 53,68 ---- the near future, and is intended for sites that are in a position to experiment, or for sites that desperately need the new features. + + CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 12 + + - Initialize the "quiet" variable in dhclient.c to zero (it was used + without first having been initialized). + + - Fix the parser code for the authoritative keyword. + + - Adjust lease discovery code to NAK more aggressively for addresses + the server knows it owns. + + - Add several new messages for DHCPNAK. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 11 diff -rNc2 dhcp-2.0b1pl12/client/dhclient.c dhcp-2.0b1pl13/client/dhclient.c *** dhcp-2.0b1pl12/client/dhclient.c Sat Feb 13 11:25:09 1999 --- dhcp-2.0b1pl13/client/dhclient.c Tue Feb 16 12:36:57 1999 *************** *** 57,61 **** #ifndef lint static char ocopyright[] = ! "$Id: dhclient.c,v 1.44.2.16 1999/02/13 19:25:09 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ --- 57,61 ---- #ifndef lint static char ocopyright[] = ! "$Id: dhclient.c,v 1.44.2.18 1999/02/16 20:36:57 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ *************** *** 93,97 **** "Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; static char arr [] = "All rights reserved."; ! static char message [] = "Internet Software Consortium DHCP Client V2.0b1pl12"; static char contrib [] = "\nPlease contribute if you find this software useful."; static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n"; --- 93,97 ---- "Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; static char arr [] = "All rights reserved."; ! static char message [] = "Internet Software Consortium DHCP Client V2.0b1pl13"; static char contrib [] = "\nPlease contribute if you find this software useful."; static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n"; *************** *** 107,111 **** struct interface_info *ip; int seed; ! int quiet; #ifdef SYSLOG_4_2 --- 107,111 ---- struct interface_info *ip; int seed; ! int quiet = 0; #ifdef SYSLOG_4_2 diff -rNc2 dhcp-2.0b1pl12/relay/dhcrelay.c dhcp-2.0b1pl13/relay/dhcrelay.c *** dhcp-2.0b1pl12/relay/dhcrelay.c Sat Feb 13 11:25:10 1999 --- dhcp-2.0b1pl13/relay/dhcrelay.c Tue Feb 16 12:36:58 1999 *************** *** 43,47 **** #ifndef lint static char ocopyright [] = ! "$Id: dhcrelay.c,v 1.9.2.12 1999/02/13 19:25:10 mellon Exp $ Copyright (c) 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ --- 43,47 ---- #ifndef lint static char ocopyright [] = ! "$Id: dhcrelay.c,v 1.9.2.13 1999/02/16 20:36:58 mellon Exp $ Copyright (c) 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ *************** *** 77,81 **** "Copyright 1997, 1998, 1999 The Internet Software Consortium."; static char arr [] = "All rights reserved."; ! static char message [] = "Internet Software Consortium DHCP Relay Agent V2.0b1pl12"; static char contrib [] = "\nPlease contribute if you find this software useful."; static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n"; --- 77,81 ---- "Copyright 1997, 1998, 1999 The Internet Software Consortium."; static char arr [] = "All rights reserved."; ! static char message [] = "Internet Software Consortium DHCP Relay Agent V2.0b1pl13"; static char contrib [] = "\nPlease contribute if you find this software useful."; static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n"; diff -rNc2 dhcp-2.0b1pl12/server/confpars.c dhcp-2.0b1pl13/server/confpars.c *** dhcp-2.0b1pl12/server/confpars.c Mon Feb 8 20:55:46 1999 --- dhcp-2.0b1pl13/server/confpars.c Tue Feb 16 10:57:33 1999 *************** *** 43,47 **** #ifndef lint static char copyright[] = ! "$Id: confpars.c,v 1.45.2.6 1999/02/09 04:55:46 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ --- 43,47 ---- #ifndef lint static char copyright[] = ! "$Id: confpars.c,v 1.45.2.7 1999/02/16 18:57:33 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ *************** *** 321,328 **** switch (token) { case AUTHORITATIVE: ! if (type == HOST_DECL || ! (type == SUBNET_DECL && share && ! share -> subnets && ! share -> subnets -> next_sibling)) parse_warn ("authority makes no sense here."); group -> authoritative = 0; --- 321,325 ---- switch (token) { case AUTHORITATIVE: ! if (type == HOST_DECL) parse_warn ("authority makes no sense here."); group -> authoritative = 0; *************** *** 337,343 **** case AUTHORITATIVE: ! if (type == HOST_DECL || ! (type == SUBNET_DECL && share && share -> subnets && ! share -> subnets -> next_sibling)) parse_warn ("authority makes no sense here."); group -> authoritative = 1; --- 334,338 ---- case AUTHORITATIVE: ! if (type == HOST_DECL) parse_warn ("authority makes no sense here."); group -> authoritative = 1; diff -rNc2 dhcp-2.0b1pl12/server/dhcp.c dhcp-2.0b1pl13/server/dhcp.c *** dhcp-2.0b1pl12/server/dhcp.c Mon Feb 8 20:57:29 1999 --- dhcp-2.0b1pl13/server/dhcp.c Tue Feb 16 11:18:35 1999 *************** *** 43,47 **** #ifndef lint static char copyright[] = ! "$Id: dhcp.c,v 1.57.2.15 1999/02/09 04:57:29 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ --- 43,47 ---- #ifndef lint static char copyright[] = ! "$Id: dhcp.c,v 1.57.2.16 1999/02/16 19:18:35 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ *************** *** 1250,1253 **** --- 1250,1266 ---- int i; + /* Figure out what IP address the client is requesting, if any. */ + if (packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len && + packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len == 4) { + cip.len = 4; + memcpy (cip.iabuf, + packet -> options [DHO_DHCP_REQUESTED_ADDRESS].data, + cip.len); + } else if (packet -> raw -> ciaddr.s_addr) { + cip.len = 4; + memcpy (cip.iabuf, &packet -> raw -> ciaddr, 4); + } else + cip.len = 0; + /* Try to find a host or lease that's been assigned to the specified unique client identifier. */ *************** *** 1296,1299 **** --- 1309,1325 ---- } + /* If fixed_lease is present but does not match the requested + IP address, and this is a DHCPREQUEST, then we can't return + any other lease, so we might as well return now. */ + if (packet -> packet_type == DHCPREQUEST && fixed_lease && + (fixed_lease -> ip_addr.len != cip.len || + memcmp (fixed_lease -> ip_addr.iabuf, + cip.iabuf, cip.len))) { + if (ours) + *ours = 1; + strcpy (dhcp_message, "requested address is incorrect"); + return (struct lease *)0; + } + /* Try to find a lease that's been attached to the client's hardware address... */ *************** *** 1316,1331 **** /* Try to find a lease that's been allocated to the client's IP address. */ ! if (packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len && ! packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len == 4) { ! cip.len = 4; ! memcpy (cip.iabuf, ! packet -> options [DHO_DHCP_REQUESTED_ADDRESS].data, ! cip.len); ! ip_lease = find_lease_by_ip_addr (cip); ! } else if (packet -> raw -> ciaddr.s_addr) { ! cip.len = 4; ! memcpy (cip.iabuf, &packet -> raw -> ciaddr, 4); ip_lease = find_lease_by_ip_addr (cip); ! } else ip_lease = (struct lease *)0; --- 1342,1348 ---- /* Try to find a lease that's been allocated to the client's IP address. */ ! if (cip.len) ip_lease = find_lease_by_ip_addr (cip); ! else ip_lease = (struct lease *)0; *************** *** 1343,1348 **** lease to be abandoned. If so, this request probably came from that client. */ ! if (ip_lease && (ip_lease -> shared_network != share)) ip_lease = (struct lease *)0; /* Toss ip_lease if it hasn't yet expired and the uid doesn't --- 1360,1368 ---- lease to be abandoned. If so, this request probably came from that client. */ ! if (ip_lease && (ip_lease -> shared_network != share)) { ! *ours = 1; ip_lease = (struct lease *)0; + strcpy (dhcp_message, "requested address on bad subnet"); + } /* Toss ip_lease if it hasn't yet expired and the uid doesn't *************** *** 1369,1375 **** --- 1389,1424 ---- uid_lease = ip_lease; } + strcpy (dhcp_message, "requested address is not available"); ip_lease = (struct lease *)0; + *ours = 1; + + /* If we get to here and fixed_lease is not null, that means + that there are both a dynamic lease and a fixed-address + declaration for the same IP address. */ + if (packet -> packet_type == DHCPREQUEST && fixed_lease) { + fixed_lease = (struct lease *)0; + db_conflict: + warn ("Both dynamic and static leases present for %s.", + piaddr (cip)); + warn ("Either remove host declaration %s or remove %s", + (fixed_lease && fixed_lease -> host + ? (fixed_lease -> host -> name + ? fixed_lease -> host -> name : piaddr (cip)) + : piaddr (cip)), + piaddr (cip)); + warn ("from the dynamic address pool for %s", + ip_lease -> subnet -> shared_network -> name); + if (fixed_lease) + ip_lease = (struct lease *)0; + strcpy (dhcp_message, + "database conflict - call for help!"); + } } + /* If we get to here with both fixed_lease and ip_lease not + null, then we have a configuration file bug. */ + if (packet -> packet_type == DHCPREQUEST && fixed_lease && ip_lease) + goto db_conflict; + /* Toss hw_lease if it hasn't yet expired and the uid doesn't match, except that if the hardware address matches and the *************** *** 1384,1410 **** /* Toss extra pointers to the same lease... */ - if (ip_lease == hw_lease) - ip_lease = (struct lease *)0; if (hw_lease == uid_lease) hw_lease = (struct lease *)0; if (ip_lease == uid_lease) ! ip_lease = (struct lease *)0; ! ! /* If we got an ip address lease, make sure it isn't assigned to ! some *other* client! If it was assigned to this client, we'd ! have zeroed it out above, so the only way we can take it at this ! point is if some other client had it but it's timed out, or if no ! other client has ever had it. */ ! if (ip_lease && ! ip_lease -> ends >= cur_time) ! ip_lease = (struct lease *)0; /* If we've already eliminated the lease, it wasn't there to begin with. If we have come up with a matching lease, set the message to bad network in case we have to throw it out. */ ! if (!ip_lease && !hw_lease && !uid_lease) { strcpy (dhcp_message, "requested address not available"); - } else { - strcpy (dhcp_message, "requested address on bad subnet"); } --- 1433,1448 ---- /* Toss extra pointers to the same lease... */ if (hw_lease == uid_lease) hw_lease = (struct lease *)0; + if (ip_lease == hw_lease) + hw_lease = (struct lease *)0; if (ip_lease == uid_lease) ! uid_lease = (struct lease *)0; /* If we've already eliminated the lease, it wasn't there to begin with. If we have come up with a matching lease, set the message to bad network in case we have to throw it out. */ ! if (!ip_lease) { strcpy (dhcp_message, "requested address not available"); } *************** *** 1425,1428 **** --- 1463,1472 ---- hw_lease = (struct lease *)0; } + + /* If this is a DHCPREQUEST, make sure the lease we're going to return + matches the requested IP address. If it doesn't, don't return a + lease at all. */ + if (packet -> packet_type == DHCPREQUEST && !ip_lease && !fixed_lease) + return (struct lease *)0; /* At this point, if fixed_lease is nonzero, we can assign it to diff -rNc2 dhcp-2.0b1pl12/server/dhcpd.c dhcp-2.0b1pl13/server/dhcpd.c *** dhcp-2.0b1pl12/server/dhcpd.c Sat Feb 13 11:25:08 1999 --- dhcp-2.0b1pl13/server/dhcpd.c Tue Feb 16 12:36:55 1999 *************** *** 43,47 **** #ifndef lint static char ocopyright[] = ! "$Id: dhcpd.c,v 1.45.2.11 1999/02/13 19:25:08 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; #endif --- 43,47 ---- #ifndef lint static char ocopyright[] = ! "$Id: dhcpd.c,v 1.45.2.12 1999/02/16 20:36:55 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; #endif *************** *** 49,53 **** "Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; static char arr [] = "All rights reserved."; ! static char message [] = "Internet Software Consortium DHCP Server V2.0b1pl12 "; static char contrib [] = "\nPlease contribute if you find this software useful."; static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n"; --- 49,53 ---- "Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; static char arr [] = "All rights reserved."; ! static char message [] = "Internet Software Consortium DHCP Server V2.0b1pl13 "; static char contrib [] = "\nPlease contribute if you find this software useful."; static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n";