From: Roy Marples Date: Thu, 11 Oct 2007 08:56:46 +0000 (+0000) Subject: If we're on a different subnet from the one we get DHCP for, don't use our current... X-Git-Tag: v3.2.3~196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b67eaba15ceefc46412b6ea2bf50a0dbc384d3a;p=thirdparty%2Fdhcpcd.git If we're on a different subnet from the one we get DHCP for, don't use our current address in messages. Thanks to Wilson Callan. --- diff --git a/ChangeLog b/ChangeLog index 3c76ccc9..2857757c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +If we're on a different subnet from the one we get DHCP for, don't +use our current address in messages. Thanks to Wilson Callan. Skip over bogus EINTR error on select when arp checking for a different address from what we already have. This should not happen, so a better fix is probably needed. diff --git a/dhcp.c b/dhcp.c index c180ed6b..2328c836 100644 --- a/dhcp.c +++ b/dhcp.c @@ -93,6 +93,11 @@ size_t send_message (const interface_t *iface, const dhcp_t *dhcp, /* Just incase we haven't actually configured the address yet */ if (type == DHCP_INFORM && iface->previous_address.s_addr == 0) message.ciaddr = dhcp->address.s_addr; + + /* Zero the address if we're currently on a different subnet */ + if (type == DHCP_REQUEST && + iface->previous_netmask.s_addr != dhcp->netmask.s_addr) + message->ciaddr = from.s_addr = 0; } message.op = DHCP_BOOTREQUEST;