Hi,

DHCP offer can use multicast address, so instead of comparing the
target address, we should compare the mac field in the dhcp packet.

-- 
Best wishes
Bean
=== modified file 'grub-core/net/ip.c'
--- grub-core/net/ip.c  2012-02-09 22:43:43 +0000
+++ grub-core/net/ip.c  2012-04-29 04:13:32 +0000
@@ -240,7 +240,7 @@
        FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
          if (inf->card == card
              && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV
-             && grub_net_hwaddr_cmp (&inf->hwaddress, hwaddress) == 0)
+             && inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET)
            {
              if (udph->chksum)
                {
@@ -266,7 +266,11 @@
              err = grub_netbuff_pull (nb, sizeof (*udph));
              if (err)
                return err;
-             grub_net_process_dhcp (nb, inf->card);
+             struct grub_net_bootp_packet *dhcp =
+               (struct grub_net_bootp_packet *) nb->data;
+             if (grub_memcmp(inf->hwaddress.mac, &dhcp->mac_addr,
+                             sizeof(inf->hwaddress.mac)) == 0)
+               grub_net_process_dhcp (nb, inf->card);
              grub_netbuff_free (nb);
              return GRUB_ERR_NONE;
            }

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to