dhcp: support BOOTP clients

BOOTP clients do not use tagged messages for requests.
As such, any message without the DHCP option 53, should be
considered a BOOTP request.

Link: https://bugs.passt.top/show_bug.cgi?id=72
Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stas Sergeev 2023-08-29 14:14:06 +05:00 committed by Stefano Brivio
parent d8c4f23ecd
commit 1f24d3efb4

4
dhcp.c
View file

@ -323,8 +323,8 @@ int dhcp(const struct ctx *c, const struct pool *p)
if (opts[53].c[0] == DHCPDISCOVER) { if (opts[53].c[0] == DHCPDISCOVER) {
info("DHCP: offer to discover"); info("DHCP: offer to discover");
opts[53].s[0] = DHCPOFFER; opts[53].s[0] = DHCPOFFER;
} else if (opts[53].c[0] == DHCPREQUEST) { } else if (opts[53].c[0] == DHCPREQUEST || !opts[53].clen) {
info("DHCP: ack to request"); info("%s: ack to request", opts[53].clen ? "DHCP" : "BOOTP");
opts[53].s[0] = DHCPACK; opts[53].s[0] = DHCPACK;
} else { } else {
return -1; return -1;