From 1051cabb4da3283a58e1504513946130c007ebdf Mon Sep 17 00:00:00 2001 From: Nicolas BESNARD Date: Fri, 11 Apr 2025 09:50:07 +0000 Subject: [PATCH] dhcpv6: fix incorrect IA type being printed in syslog MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/dhcpv6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.30.2