On Thu, 17 Apr 2025 18:51:24 +0200
Laurent Vivier
Use packet_data() and extract headers using IOV_REMOVE_HEADER() and IOV_PEEK_HEADER() rather than packet_get().
Signed-off-by: Laurent Vivier
--- dhcp.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/dhcp.c b/dhcp.c index b0de04be6f27..e8408ef04839 100644 --- a/dhcp.c +++ b/dhcp.c @@ -302,27 +302,33 @@ static void opt_set_dns_search(const struct ctx *c, size_t max_len) */ int dhcp(const struct ctx *c, const struct pool *p) { - size_t mlen, dlen, offset = 0, opt_len, opt_off = 0; + size_t mlen, dlen, opt_len; char macstr[ETH_ADDRSTRLEN]; struct in_addr mask, dst; const struct ethhdr *eh; const struct iphdr *iph; const struct udphdr *uh; + struct iov_tail data; struct msg const *m; + struct msg mc; + struct ethhdr ehc; + struct iphdr iphc; + struct udphdr uhc;
Nit: these should be ordered from longest to shortest. Usual observation about the 'c' in 'mc' etc. -- Stefano