mirror of
https://passt.top/passt
synced 2024-12-22 05:35:23 +00:00
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>
This commit is contained in:
parent
d6e9e2486f
commit
9da2038485
11
dhcp.c
11
dhcp.c
@ -342,9 +342,16 @@ int dhcp(const struct ctx *c, const struct pool *p)
|
|||||||
opt_off += *olen + 2;
|
opt_off += *olen + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts[80].slen = -1;
|
||||||
if (opts[53].clen > 0 && opts[53].c[0] == DHCPDISCOVER) {
|
if (opts[53].clen > 0 && opts[53].c[0] == DHCPDISCOVER) {
|
||||||
info("DHCP: offer to discover");
|
if (opts[80].clen == -1) {
|
||||||
opts[53].s[0] = DHCPOFFER;
|
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) {
|
} else if (opts[53].clen <= 0 || opts[53].c[0] == DHCPREQUEST) {
|
||||||
info("%s: ack to request", /* DHCP needs a valid message type */
|
info("%s: ack to request", /* DHCP needs a valid message type */
|
||||||
(opts[53].clen <= 0) ? "BOOTP" : "DHCP");
|
(opts[53].clen <= 0) ? "BOOTP" : "DHCP");
|
||||||
|
Loading…
Reference in New Issue
Block a user