From 7b2084e270298a5664e783d675780a12b247dab9 Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Tue, 3 May 2016 14:13:11 +0200 Subject: [PATCH] Fixed endianess of EoE parameters. --- master/fsm_eoe.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/master/fsm_eoe.c b/master/fsm_eoe.c index 285cbd05..4788ab67 100644 --- a/master/fsm_eoe.c +++ b/master/fsm_eoe.c @@ -212,22 +212,26 @@ int ec_fsm_eoe_prepare_set( } if (req->ip_address_included) { - memcpy(cur, &req->ip_address, 4); + uint32_t swapped = htonl(req->ip_address); + memcpy(cur, &swapped, 4); cur += 4; } if (req->subnet_mask_included) { - memcpy(cur, &req->subnet_mask, 4); + uint32_t swapped = htonl(req->subnet_mask); + memcpy(cur, &swapped, 4); cur += 4; } if (req->gateway_included) { - memcpy(cur, &req->gateway, 4); + uint32_t swapped = htonl(req->gateway); + memcpy(cur, &swapped, 4); cur += 4; } if (req->dns_included) { - memcpy(cur, &req->dns, 4); + uint32_t swapped = htonl(req->dns); + memcpy(cur, &swapped, 4); cur += 4; }