mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-29 17:55:48 +00:00
net: bootp: Fall back to BOOTP from DHCP when unit testing
If we sent a DHCP packet and get a BOOTP response from the server, we shouldn't try to send a DHCPREQUEST packet, since it won't be DHCPACKed. Transition straight to BIND. This is only enabled for UNIT_TEST to avoid bloat, since I suspect the number of BOOTP servers in the wild is vanishingly small. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
7ccc6044e9
commit
acb96c170d
1 changed files with 6 additions and 0 deletions
|
@ -1073,6 +1073,11 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
|
||||||
CONFIG_SYS_BOOTFILE_PREFIX,
|
CONFIG_SYS_BOOTFILE_PREFIX,
|
||||||
strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0) {
|
strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0) {
|
||||||
#endif /* CONFIG_SYS_BOOTFILE_PREFIX */
|
#endif /* CONFIG_SYS_BOOTFILE_PREFIX */
|
||||||
|
if (CONFIG_IS_ENABLED(UNIT_TEST) &&
|
||||||
|
dhcp_message_type((u8 *)bp->bp_vend) == -1) {
|
||||||
|
debug("got BOOTP response; transitioning to BOUND\n");
|
||||||
|
goto dhcp_got_bootp;
|
||||||
|
}
|
||||||
dhcp_packet_process_options(bp);
|
dhcp_packet_process_options(bp);
|
||||||
if (CONFIG_IS_ENABLED(EFI_LOADER) &&
|
if (CONFIG_IS_ENABLED(EFI_LOADER) &&
|
||||||
IS_ENABLED(CONFIG_NETDEVICES))
|
IS_ENABLED(CONFIG_NETDEVICES))
|
||||||
|
@ -1099,6 +1104,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
|
||||||
debug("DHCP State: REQUESTING\n");
|
debug("DHCP State: REQUESTING\n");
|
||||||
|
|
||||||
if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
|
if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
|
||||||
|
dhcp_got_bootp:
|
||||||
dhcp_packet_process_options(bp);
|
dhcp_packet_process_options(bp);
|
||||||
/* Store net params from reply */
|
/* Store net params from reply */
|
||||||
store_net_params(bp);
|
store_net_params(bp);
|
||||||
|
|
Loading…
Add table
Reference in a new issue