From: David Hankins Date: Tue, 27 Mar 2007 03:48:06 +0000 (+0000) Subject: - In the case where an "L2" DHCP Relay Agent (one that does not set giaddr) X-Git-Tag: v4_0_0a1~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02428754a32d420a48dc265272f3478f075cfbae;p=thirdparty%2Fdhcp.git - In the case where an "L2" DHCP Relay Agent (one that does not set giaddr) was directly attached to the same broadcast domain as the DHCP server, the RFC3046 relay agent information option was not being returned to the relay in the server's replies. This was fixed; the dhcp server no longer requires the giaddr to reply with relay agent information. Note that this also improves compatibility with L2 devices that "intercept" DHCP packets and expect relay agent information even in unicast (renewal) replies. [ISC-Bugs #16762] --- diff --git a/RELNOTES b/RELNOTES index f44956cfb..ea27121f4 100644 --- a/RELNOTES +++ b/RELNOTES @@ -198,7 +198,16 @@ the README file. - A memory leak in the minires_nsendsigned() function call was repaired. Effectively, this leaked ~80 bytes per DDNS update. - Changes since 3.0.5rc1 +- In the case where an "L2" DHCP Relay Agent (one that does not set giaddr) + was directly attached to the same broadcast domain as the DHCP server, + the RFC3046 relay agent information option was not being returned to the + relay in the server's replies. This was fixed; the dhcp server no longer + requires the giaddr to reply with relay agent information. Note that + this also improves compatibility with L2 devices that "intercept" DHCP + packets and expect relay agent information even in unicast (renewal) + replies. + + Changes since 3.0.5rc1 - A bug was repaired in fixes to the dhclient, which sought to run the dhclient-script with the 'EXPIRE' state should it receive a NAK in diff --git a/server/dhcp.c b/server/dhcp.c index 288dc965d..b19e491eb 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -3,7 +3,7 @@ DHCP Protocol engine. */ /* - * Copyright (c) 2004-2006 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.213 2006/10/17 20:45:59 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.214 2007/03/27 03:48:06 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -1331,10 +1331,12 @@ void nak_lease (packet, cip) get_server_source_address(&from, options, packet); /* If there were agent options in the incoming packet, return - them. */ - if (packet -> raw -> giaddr.s_addr && - packet -> options -> universe_count > agent_universe.index && - packet -> options -> universes [agent_universe.index]) { + * them. We do not check giaddr to detect the presence of a + * relay, as this excludes "l2" relay agents which have no + * giaddr to set. + */ + if (packet->options->universe_count > agent_universe.index && + packet->options->universes [agent_universe.index]) { option_chain_head_reference ((struct option_chain_head **) &(options -> universes [agent_universe.index]), @@ -1492,11 +1494,13 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) state -> got_server_identifier = 1; /* If there were agent options in the incoming packet, return - them. Do not return the agent options if they were stashed - on the lease. */ - if (packet -> raw -> giaddr.s_addr && - packet -> options -> universe_count > agent_universe.index && - packet -> options -> universes [agent_universe.index] && + * them. Do not return the agent options if they were stashed + * on the lease. We do not check giaddr to detect the presence of + * a relay, as this excludes "l2" relay agents which have no giaddr + * to set. + */ + if (packet->options->universe_count > agent_universe.index && + packet->options->universes [agent_universe.index] && (state -> options -> universe_count <= agent_universe.index || !state -> options -> universes [agent_universe.index]) && lease -> agent_options != @@ -2244,13 +2248,15 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) lease -> agent_options, MDL); /* If we got relay agent information options, and the packet really - looks like it came through a relay agent, and if this feature is - not disabled, save the relay agent information options that came - in with the packet, so that we can use them at renewal time when - the packet won't have gone through a relay agent. */ - if (packet -> raw -> giaddr.s_addr && - packet -> options -> universe_count > agent_universe.index && - packet -> options -> universes [agent_universe.index] && + * looks like it came through a relay agent, and if this feature is + * not disabled, save the relay agent information options that came + * in with the packet, so that we can use them at renewal time when + * the packet won't have gone through a relay agent. We do not + * check giaddr to detect the presence of a relay, as this excludes + * "l2" relay agents which have no giaddr to set. + */ + if (packet->options->universe_count > agent_universe.index && + packet->options->universes [agent_universe.index] && (state -> options -> universe_count <= agent_universe.index || state -> options -> universes [agent_universe.index] == packet -> options -> universes [agent_universe.index])) {