From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id A3AD45A061B; Tue, 26 Nov 2024 07:34:10 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH v4 2/3] dhcp: Introduce support for Rapid Commit (option 80, RFC 4039) Date: Tue, 26 Nov 2024 07:34:09 +0100 Message-ID: <20241126063410.1950820-3-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241126063410.1950820-1-sbrivio@redhat.com> References: <20241126063410.1950820-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: QL3QGAUPLWHWYXQ4CYWGIJJIOUH266ET X-Message-ID-Hash: QL3QGAUPLWHWYXQ4CYWGIJJIOUH266ET X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: I'm trying to speed up and simplify IP address acquisition in muvm. Signed-off-by: Stefano Brivio --- dhcp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dhcp.c b/dhcp.c index 387aee3..732eb06 100644 --- a/dhcp.c +++ b/dhcp.c @@ -342,10 +342,17 @@ int dhcp(const struct ctx *c, const struct pool *p) opt_off += *olen + 2; } + opts[80].slen = -1; if (opts[53].clen > 0 && opts[53].c[0] == DHCPDISCOVER) { - info("DHCP: offer to discover"); - opts[53].s[0] = DHCPOFFER; - } else if (opts[53].clen <= 0 || opts[53].c[0] == DHCPREQUEST) { + if (opts[80].clen == -1) { + info("DHCP: offer to discover"); + opts[53].s[0] = DHCPOFFER; + } else { + info("DHCP: ack to discover (Rapid Commit)"); + opts[53].s[0] = DHCPACK; + opts[80].slen = 0; + } + } else if (opts[53].clen <= 0 && opts[53].c[0] == DHCPREQUEST) { info("%s: ack to request", /* DHCP needs a valid message type */ (opts[53].clen <= 0) ? "BOOTP" : "DHCP"); opts[53].s[0] = DHCPACK; -- 2.43.0