Move DHCP parsing to net module and reintroduce most variables
This commit is contained in:
parent
0f37e49365
commit
308fad6dc8
4 changed files with 257 additions and 220 deletions
|
@ -152,9 +152,9 @@
|
|||
#define GRUB_PXE_BOOTP_BCAST 0x8000
|
||||
|
||||
#if 1
|
||||
#define GRUB_PXE_BOOTP_DHCPVEND 1024 /* DHCP extended vendor field size. */
|
||||
#define GRUB_PXE_BOOTP_SIZE (1024 + 236) /* DHCP extended vendor field size. */
|
||||
#else
|
||||
#define GRUB_PXE_BOOTP_DHCPVEND 312 /* DHCP standard vendor field size. */
|
||||
#define GRUB_PXE_BOOTP_SIZE (312 + 236) /* DHCP standard vendor field size. */
|
||||
#endif
|
||||
|
||||
#define GRUB_PXE_MIN_BLKSIZE 512
|
||||
|
@ -162,8 +162,6 @@
|
|||
|
||||
#define GRUB_PXE_TFTP_PORT 69
|
||||
|
||||
#define GRUB_PXE_VM_RFC1048 0x63825363L
|
||||
|
||||
#define GRUB_PXE_ERR_LEN 0xFFFFFFFF
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
@ -214,38 +212,6 @@ struct grub_pxenv_get_cached_info
|
|||
grub_uint16_t buffer_limit;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GRUB_PXE_MAC_ADDR_LEN 16
|
||||
|
||||
typedef grub_uint8_t grub_pxe_mac_addr_t[GRUB_PXE_MAC_ADDR_LEN];
|
||||
|
||||
struct grub_pxenv_boot_player
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t hw_type; /* hardware type. */
|
||||
grub_uint8_t hw_len; /* hardware addr len. */
|
||||
grub_uint8_t gate_hops; /* zero it. */
|
||||
grub_uint32_t ident; /* random number chosen by client. */
|
||||
grub_uint16_t seconds; /* seconds since did initial bootstrap. */
|
||||
grub_uint16_t flags;
|
||||
grub_uint32_t client_ip;
|
||||
grub_uint32_t your_ip;
|
||||
grub_uint32_t server_ip;
|
||||
grub_uint32_t gateway_ip;
|
||||
grub_pxe_mac_addr_t mac_addr;
|
||||
grub_uint8_t server_name[64];
|
||||
grub_uint8_t boot_file[128];
|
||||
union
|
||||
{
|
||||
grub_uint8_t d[GRUB_PXE_BOOTP_DHCPVEND]; /* raw array of vendor/dhcp options. */
|
||||
struct
|
||||
{
|
||||
grub_uint32_t magic; /* DHCP magic cookie. */
|
||||
grub_uint32_t flags; /* bootp flags/opcodes. */
|
||||
grub_uint8_t padding[56];
|
||||
} v;
|
||||
} vendor;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_tftp_open
|
||||
{
|
||||
grub_uint16_t status;
|
||||
|
|
|
@ -119,6 +119,8 @@ struct grub_net_network_level_interface
|
|||
grub_net_network_level_address_t address;
|
||||
grub_net_link_level_address_t hwaddress;
|
||||
grub_net_interface_flags_t flags;
|
||||
struct grub_net_bootp_ack *dhcp_ack;
|
||||
grub_size_t dhcp_acklen;
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
@ -234,4 +236,45 @@ grub_net_add_route_gw (const char *name,
|
|||
grub_net_network_level_address_t gw);
|
||||
|
||||
|
||||
#define GRUB_NET_BOOTP_MAC_ADDR_LEN 16
|
||||
|
||||
typedef grub_uint8_t grub_net_bootp_mac_addr_t[GRUB_NET_BOOTP_MAC_ADDR_LEN];
|
||||
|
||||
struct grub_net_bootp_ack
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t hw_type; /* hardware type. */
|
||||
grub_uint8_t hw_len; /* hardware addr len. */
|
||||
grub_uint8_t gate_hops; /* zero it. */
|
||||
grub_uint32_t ident; /* random number chosen by client. */
|
||||
grub_uint16_t seconds; /* seconds since did initial bootstrap. */
|
||||
grub_uint16_t flags;
|
||||
grub_uint32_t client_ip;
|
||||
grub_uint32_t your_ip;
|
||||
grub_uint32_t server_ip;
|
||||
grub_uint32_t gateway_ip;
|
||||
grub_net_bootp_mac_addr_t mac_addr;
|
||||
grub_uint8_t server_name[64];
|
||||
grub_uint8_t boot_file[128];
|
||||
grub_uint8_t vendor[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC 0x63825363L
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_configure_by_dhcp_ack (const char *name, struct grub_net_card *card,
|
||||
grub_net_interface_flags_t flags,
|
||||
struct grub_net_bootp_ack *bp,
|
||||
grub_size_t size);
|
||||
|
||||
/*
|
||||
Currently suppoerted adresses:
|
||||
IPv4: XXX.XXX.XXX.XXX
|
||||
*/
|
||||
#define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXX.XXX.XXX.XXX")
|
||||
|
||||
void
|
||||
grub_net_addr_to_str (const grub_net_network_level_address_t *target,
|
||||
char *buf);
|
||||
|
||||
#endif /* ! GRUB_NET_HEADER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue