
On 10/12/23 03:16, Heinrich Schuchardt wrote:
On 10/12/23 03:56, Sean Anderson wrote:
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
net/bootp.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/net/bootp.c b/net/bootp.c index 2053cce88c6..7b0f45e18a9 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -1073,6 +1073,11 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip, CONFIG_SYS_BOOTFILE_PREFIX, strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0) { #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;
This may result in unexpected behavior when running tests against an actual network. Please, avoid this.
What is unexpected behavior? If you get a BOOTP (not DHCP) packet, you should behave according to the BOOTP protocol, not the DHCP protocol.
--Sean