From 176321cb95785686c5dfe51dcc7d2a5918e89bc6 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Wed, 17 Feb 2021 19:09:25 +0100 Subject: [PATCH] network: DHCP option- use correct byteorder --- src/network/networkd-dhcp-common.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 6bac7202001..00d055cf8db 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -683,25 +683,31 @@ int config_parse_dhcp_send_option( break; } case DHCP_OPTION_DATA_UINT16:{ - r = safe_atou16(p, &uint16_data); + uint16_t k; + + r = safe_atou16(p, &k); if (r < 0) { log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP uint16 data, ignoring assignment: %s", p); return 0; } + uint16_data = htobe16(k); udata = &uint16_data; sz = sizeof(uint16_t); break; } case DHCP_OPTION_DATA_UINT32: { - r = safe_atou32(p, &uint32_data); + uint32_t k; + + r = safe_atou32(p, &k); if (r < 0) { log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP uint32 data, ignoring assignment: %s", p); return 0; } + uint32_data = htobe32(k); udata = &uint32_data; sz = sizeof(uint32_t);