From f2bc729e555e753625e98a705ea2aac5f8dc3cb3 Mon Sep 17 00:00:00 2001 From: Christian Tomahogh Date: Fri, 29 Sep 2023 01:04:37 +0200 Subject: [PATCH] Send correct amount of used buffer for prefix exclude option (#250) The payload of the prefix exclude option was correctly created but the amount of bytes to send in the DHCPv6 request was always set to 0 which resulted in an invalid prefix exclude option This patch fixes this behavior by calculating the correct amount of bytes to send. --- src/dhcp6.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dhcp6.c b/src/dhcp6.c index e7767ca7..c7fc3859 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -1022,9 +1022,11 @@ dhcp6_makemessage(struct interface *ifp) n--; while (n-- > 0) *ep++ = *pp--; - if (u8) + n = ep - exb; + if (u8) { *ep = (uint8_t)(*pp << u8); - n++; + n++; + } COPYIN(D6_OPTION_PD_EXCLUDE, exb, (uint16_t)n); ia_na_len = (uint16_t) -- 2.47.2