dhcp: Actually note down the length of options received by the client

It turns out we never used 'clen' until commit 1f24d3efb4 ("dhcp:
support BOOTP clients"), and we always ignored option 55 (Parameter
Request List), while, according to RFC 2132, we MUST try to insert
the requested options in the order requested by the client.

The commit mentioned above made this visible because now every client
is reported as sending a DHCPREQUEST as an old BOOTP client, based on
the lack of option 53 (that is, zero length).

Fixes: b439984641 ("merd: ARP and DHCP handlers, connection tracking fixes")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio 2023-09-21 18:42:45 +02:00
parent 8b8537d301
commit c09069211a

1
dhcp.c
View file

@ -317,6 +317,7 @@ int dhcp(const struct ctx *c, const struct pool *p)
return -1; return -1;
memcpy(&opts[*type].c, val, *olen); memcpy(&opts[*type].c, val, *olen);
opts[*type].clen = *olen;
opt_off += *olen + 2; opt_off += *olen + 2;
} }