From: Christian Tomahogh Date: Thu, 28 Sep 2023 23:04:37 +0000 (+0200) Subject: Send correct amount of used buffer for prefix exclude option (#250) X-Git-Tag: v10.0.3~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2bc729e555e753625e98a705ea2aac5f8dc3cb3;p=thirdparty%2Fdhcpcd.git 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. --- 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)