2012/4/30 Bean <[email protected]>:
> 2012/4/30 Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]>:
>> On 29.04.2012 20:26, Bean wrote:
>>> Hi,
>>>
>>> It should be ok, since it's inside FOR_NET_NETWORK_LEVEL_INTERFACES
>>> (inf) loop and compare inf->hwaddress.mac to the current dhcp response
>>> packet.
>> It's not. You return even if packet didn't match.
>
> Hi,
>
> Oh i see, i forget about the return a few lines beyond.
Hi,
oh, there seems to be a missing grub_netbuff_free here as well, pls
check if this is ok.
--
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 18:56:57 +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)
{
@@ -257,18 +257,25 @@
"Expected %x, got %x\n",
grub_be_to_cpu16 (expected),
grub_be_to_cpu16 (chk));
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
+ break;
}
udph->chksum = chk;
}
err = grub_netbuff_pull (nb, sizeof (*udph));
if (err)
- return err;
- grub_net_process_dhcp (nb, inf->card);
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
+ {
+ grub_netbuff_free (nb);
+ return err;
+ }
+ 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);
+ break;
+ }
}
grub_netbuff_free (nb);
return GRUB_ERR_NONE;
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel