summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2024-03-31 15:56:21 +0000
committerFelix Fietkau2024-03-31 15:56:23 +0000
commita29d45c71bca9babb24a477ff7f801daa9b3326c (patch)
tree334b822cc035dea38ea46b02aa3a9322ad554fb1
parent203c88857354e09dc2c9f5b57f0f66ac1f76a16d (diff)
downloadunetd-a29d45c71bca9babb24a477ff7f801daa9b3326c.tar.gz
network: fix endian issue in converting port to network id
Use little endian to remain compatible with most systems Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--network.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/network.c b/network.c
index 0578ad0..e1ea869 100644
--- a/network.c
+++ b/network.c
@@ -93,8 +93,8 @@ static void network_load_config_data(struct network *net, struct blob_attr *data
const char *id = blobmsg_get_string(cur);
siphash_to_le64(&net->net_config.addr.network_id, id, strlen(id), &key);
} else {
- siphash_to_le64(&net->net_config.addr.network_id, &net->net_config.port,
- sizeof(net->net_config.port), &key);
+ uint32_t port = cpu_to_le32(net->net_config.port);
+ siphash_to_le64(&net->net_config.addr.network_id, &port, sizeof(port), &key);
}
net->net_config.addr.network_id[0] = 0xfd;