diff options
author | Susant Sahani <ssahani@vmware.com> | 2021-02-17 19:09:25 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-02-17 23:15:26 +0100 |
commit | 176321cb95785686c5dfe51dcc7d2a5918e89bc6 (patch) | |
tree | 660651a43d01f0e75ae0bd548e0af346dc21fb42 /src/network/networkd-dhcp-common.c | |
parent | Merge pull request #18656 from yuwata/network-nexthop-tiny-cleanups (diff) | |
download | systemd-176321cb95785686c5dfe51dcc7d2a5918e89bc6.tar.xz systemd-176321cb95785686c5dfe51dcc7d2a5918e89bc6.zip |
network: DHCP option- use correct byteorder
Diffstat (limited to 'src/network/networkd-dhcp-common.c')
-rw-r--r-- | src/network/networkd-dhcp-common.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 6bac720200..00d055cf8d 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); |