net/dhcp: Allow receiving DHCP OFFER and ACK packets
In respone to a BOOTREQUEST packet a BOOTP server would answer with a BOOTREPLY packet, which ends the conversation for good. DHCP uses a 4-way handshake, where the initial server respone is an OFFER, which has to be answered with REQUEST by the client again, only to be completed by an ACKNOWLEDGE packet from the server. Teach the grub_net_process_dhcp() function to deal with OFFER packets, and treat ACK packets the same es BOOTREPLY packets. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
1157a45292
commit
ada2f6d40c
2 changed files with 71 additions and 14 deletions
|
@ -293,6 +293,9 @@ struct grub_net_network_level_interface
|
|||
struct grub_net_bootp_packet *dhcp_ack;
|
||||
grub_size_t dhcp_acklen;
|
||||
grub_uint16_t vlantag;
|
||||
grub_uint32_t xid; /* DHCPv4 transaction id */
|
||||
grub_uint32_t srv_id; /* DHCPv4 server_identifier */
|
||||
grub_uint32_t my_ip; /* DHCPv4 offered IP address */
|
||||
unsigned dhcp_tmo_left; /* DHCPv4 running retransmission timeout */
|
||||
unsigned dhcp_tmo; /* DHCPv4 current retransmission timeout */
|
||||
void *data;
|
||||
|
@ -461,6 +464,8 @@ enum
|
|||
GRUB_NET_BOOTP_ROOT_PATH = 0x11,
|
||||
GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
|
||||
GRUB_NET_DHCP_OVERLOAD = 52,
|
||||
GRUB_NET_DHCP_MESSAGE_TYPE = 53,
|
||||
GRUB_NET_DHCP_SERVER_IDENTIFIER = 54,
|
||||
GRUB_NET_DHCP_TFTP_SERVER_NAME = 66,
|
||||
GRUB_NET_DHCP_BOOTFILE_NAME = 67,
|
||||
GRUB_NET_BOOTP_END = 0xff
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue