Support Solaris DHCP ACK parsing

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-15 00:44:57 +02:00
parent c042567715
commit 779e9dc480
3 changed files with 32 additions and 3 deletions

View file

@ -32,6 +32,7 @@
#include <grub/relocator.h>
#include <grub/video.h>
#include <grub/file.h>
#include <grub/net.h>
/* The bits in the required part of flags field we don't support. */
#define UNSUPPORTED_FLAGS 0x0000fff8
@ -189,12 +190,24 @@ grub_multiboot_load (grub_file_t file)
static grub_size_t
grub_multiboot_get_mbi_size (void)
{
return sizeof (struct multiboot_info) + ALIGN_UP (cmdline_size, 4)
grub_size_t ret;
struct grub_net_network_level_interface *net;
ret = sizeof (struct multiboot_info) + ALIGN_UP (cmdline_size, 4)
+ modcnt * sizeof (struct multiboot_mod_list) + total_modcmd
+ ALIGN_UP (sizeof(PACKAGE_STRING), 4)
+ grub_get_multiboot_mmap_count () * sizeof (struct multiboot_mmap_entry)
+ elf_sec_entsize * elf_sec_num
+ 256 * sizeof (struct multiboot_color);
FOR_NET_NETWORK_LEVEL_INTERFACES(net)
if (net->dhcp_ack)
{
ret += net->dhcp_acklen;
break;
}
return ret;
}
/* Fill previously allocated Multiboot mmap. */
@ -401,6 +414,20 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
mbi->flags |= MULTIBOOT_INFO_BOOTDEV;
}
{
struct grub_net_network_level_interface *net;
FOR_NET_NETWORK_LEVEL_INTERFACES(net)
if (net->dhcp_ack)
{
grub_memcpy (ptrorig, net->dhcp_ack, net->dhcp_acklen);
mbi->drives_addr = ptrdest;
mbi->drives_length = net->dhcp_acklen;
ptrorig += net->dhcp_acklen;
ptrdest += net->dhcp_acklen;
break;
}
}
if (elf_sec_num)
{
mbi->u.elf_sec.addr = ptrdest;

View file

@ -49,8 +49,6 @@ grub_net_network_level_interface_unregister (struct grub_net_network_level_inter
GRUB_AS_LIST (inter));
}
#define FOR_NET_NETWORK_LEVEL_INTERFACES(var) for (var = grub_net_network_level_interfaces; var; var = var->next)
static inline void
grub_net_route_register (struct grub_net_route *route)
{

View file

@ -277,4 +277,8 @@ void
grub_net_addr_to_str (const grub_net_network_level_address_t *target,
char *buf);
extern struct grub_net_network_level_interface *grub_net_network_level_interfaces;
#define FOR_NET_NETWORK_LEVEL_INTERFACES(var) for (var = grub_net_network_level_interfaces; var; var = var->next)
#endif /* ! GRUB_NET_HEADER */