]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Check chaddr matches our hwaddr if it fits.
authorRoy Marples <roy@marples.name>
Mon, 28 Jul 2008 13:39:57 +0000 (13:39 +0000)
committerRoy Marples <roy@marples.name>
Mon, 28 Jul 2008 13:39:57 +0000 (13:39 +0000)
client.c

index 79a494e5e0fdfd3523fcf6b41b581cc268793666..371170f7b651b4cd9b30c3df470932618674e9c2 100644 (file)
--- 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)) {