From: Nicolas BESNARD Date: Fri, 11 Apr 2025 09:50:07 +0000 (+0000) Subject: dhcpv6: fix incorrect IA type being printed in syslog X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=1051cabb4da3283a58e1504513946130c007ebdf;p=project%2Fodhcp6c.git dhcpv6: fix incorrect IA type being printed in syslog Problem: If a status error code is received, "IA_NA" is always written to syslog. Cause: IA header type is not converted from network byte order to host byte order. Solution: Use ntohs() to convert to host byte order. Signed-off-by: Nicolas BESNARD Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcp6c/pull/106 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 2640b77..26276d5 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -1875,7 +1875,7 @@ static void dhcpv6_handle_ia_status_code(const enum dhcpv6_msg orig, const void *status_msg, const int len, bool handled_status_codes[_DHCPV6_Status_Max], int *ret) { - dhcpv6_log_status_code(code, ia_hdr->type == DHCPV6_OPT_IA_NA ? + dhcpv6_log_status_code(code, ntohs(ia_hdr->type) == DHCPV6_OPT_IA_NA ? "IA_NA" : "IA_PD", status_msg, len); switch (code) {