]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Send correct amount of used buffer for prefix exclude option (#250)
authorChristian Tomahogh <ctomahogh@insys-tec.de>
Thu, 28 Sep 2023 23:04:37 +0000 (01:04 +0200)
committerGitHub <noreply@github.com>
Thu, 28 Sep 2023 23:04:37 +0000 (00:04 +0100)
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

index e7767ca744c9304e9519ffddc0dd116abf82b274..c7fc385952732529f9299dfe9ee22420834941de 100644 (file)
@@ -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)