* grub-core/net/ip.c (handle_dgram): Fix DHCP mac comparison.

Also-By: Vladimir Serbinenko <phcoder@gmail.com>
This commit is contained in:
Bean 2012-05-01 15:20:20 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent a188012e6c
commit ba15b2afa0
2 changed files with 36 additions and 25 deletions

View file

@ -1,3 +1,8 @@
2012-05-01 Vladimir Serbinenko <phcoder@gmail.com>
2012-05-01 Bean <bean123ch@gmail.com>
* grub-core/net/ip.c (handle_dgram): Fix DHCP mac comparison.
2012-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/file.c (grub_file_read): Read nothing if len = 0.

View file

@ -236,11 +236,6 @@ handle_dgram (struct grub_net_buff *nb,
struct udphdr *udph;
udph = (struct udphdr *) nb->data;
if (proto == GRUB_NET_IP_UDP && grub_be_to_cpu16 (udph->dst) == 68)
{
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)
{
if (udph->chksum)
{
@ -265,7 +260,18 @@ handle_dgram (struct grub_net_buff *nb,
err = grub_netbuff_pull (nb, sizeof (*udph));
if (err)
{
grub_netbuff_free (nb);
return err;
}
FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
if (inf->card == card
&& inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV
&& inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
&& 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;