public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] dhcp: support BOOTP clients
@ 2023-08-29  9:14 Stas Sergeev
  2023-09-07 15:45 ` Stefano Brivio
  0 siblings, 1 reply; 2+ messages in thread
From: Stas Sergeev @ 2023-08-29  9:14 UTC (permalink / raw)
  To: passt-dev; +Cc: Stas Sergeev

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

Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
---
 dhcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-07 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29  9:14 [PATCH] dhcp: support BOOTP clients Stas Sergeev
2023-09-07 15:45 ` Stefano Brivio

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).