From: Roy Marples Date: Mon, 28 Jul 2008 13:39:57 +0000 (+0000) Subject: Check chaddr matches our hwaddr if it fits. X-Git-Tag: v4.0.2~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=945168dd6ce55a21071ddb5c93ad4f770e70a4e2;p=thirdparty%2Fdhcpcd.git Check chaddr matches our hwaddr if it fits. --- diff --git a/client.c b/client.c index 79a494e5..371170f7 100644 --- a/client.c +++ b/client.c @@ -1509,6 +1509,7 @@ handle_dhcp_packet(struct if_state *state, const struct options *options) logger(LOG_DEBUG, "bogus cookie, ignoring"); continue; } + /* Ensure it's the right transaction */ if (state->xid != dhcp->xid) { logger(LOG_DEBUG, "ignoring packet with xid 0x%x as" @@ -1516,6 +1517,15 @@ handle_dhcp_packet(struct if_state *state, const struct options *options) dhcp->xid, state->xid); continue; } + /* Ensure packet is for us */ + if (iface->hwlen <= sizeof(dhcp->chaddr) && + memcmp(dhcp->chaddr, iface->hwaddr, iface->hwlen)) + { + logger(LOG_DEBUG, "xid 0x%x is not for our hwaddr %s", + dhcp->xid, + hwaddr_ntoa(dhcp->chaddr, sizeof(dhcp->chaddr))); + continue; + } /* We should ensure that the packet is terminated correctly * if we have space for the terminator */ if ((size_t)bytes < sizeof(struct dhcp_message)) {