diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2024-11-15 18:18:22 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-11-27 05:37:28 +0100 |
commit | 9da2038485c9334d28df34d2ebd5ba04a3c7662d (patch) | |
tree | f2437b82542ccc99a64745d0b1b751289a3abf99 | |
parent | d6e9e2486f092901207e6565f5eee3817cf4e11a (diff) | |
download | passt-9da2038485c9334d28df34d2ebd5ba04a3c7662d.tar passt-9da2038485c9334d28df34d2ebd5ba04a3c7662d.tar.gz passt-9da2038485c9334d28df34d2ebd5ba04a3c7662d.tar.bz2 passt-9da2038485c9334d28df34d2ebd5ba04a3c7662d.tar.lz passt-9da2038485c9334d28df34d2ebd5ba04a3c7662d.tar.xz passt-9da2038485c9334d28df34d2ebd5ba04a3c7662d.tar.zst passt-9da2038485c9334d28df34d2ebd5ba04a3c7662d.zip |
dhcp: Introduce support for Rapid Commit (option 80, RFC 4039)
I'm trying to speed up and simplify IP address acquisition in muvm.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r-- | dhcp.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -342,9 +342,16 @@ 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; + 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"); |