All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bug fix for bootp
@ 2012-04-29  4:17 Bean
  2012-04-29 16:33 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 7+ messages in thread
From: Bean @ 2012-04-29  4:17 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

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

[-- Attachment #2: bootp.txt --]
[-- Type: text/plain, Size: 939 bytes --]

=== 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;
 	    }


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-01 13:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-29  4:17 [PATCH] bug fix for bootp Bean
2012-04-29 16:33 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-04-29 18:26   ` Bean
2012-04-29 18:35     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-04-29 18:50       ` Bean
2012-04-29 18:59         ` Bean
2012-05-01 13:20           ` Vladimir 'φ-coder/phcoder' Serbinenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.