summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd-network/sd-ipv4ll.c8
-rw-r--r--src/libsystemd-network/test-ipv4ll.c2
-rw-r--r--src/network/networkd-ipv4ll.c4
-rw-r--r--src/systemd/sd-ipv4ll.h2
4 files changed, 6 insertions, 10 deletions
diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c
index 1f6da4bb16..0e6a9df9e5 100644
--- a/src/libsystemd-network/sd-ipv4ll.c
+++ b/src/libsystemd-network/sd-ipv4ll.c
@@ -144,9 +144,7 @@ int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr) {
/* If no random data is set, generate some from the MAC */
seed = siphash24(&addr->ether_addr_octet, ETH_ALEN, HASH_KEY.bytes);
- assert_cc(sizeof(unsigned) <= 8);
-
- r = sd_ipv4ll_set_address_seed(ll, (unsigned) htole64(seed));
+ r = sd_ipv4ll_set_address_seed(ll, htole64(seed));
if (r < 0)
return r;
}
@@ -187,7 +185,7 @@ int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address) {
return 0;
}
-int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, unsigned seed) {
+int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, uint64_t seed) {
_cleanup_free_ struct random_data *random_data = NULL;
_cleanup_free_ char *random_data_state = NULL;
int r;
@@ -202,7 +200,7 @@ int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, unsigned seed) {
if (!random_data_state)
return -ENOMEM;
- r = initstate_r(seed, random_data_state, 128, random_data);
+ r = initstate_r((unsigned) seed, random_data_state, 128, random_data);
if (r < 0)
return r;
diff --git a/src/libsystemd-network/test-ipv4ll.c b/src/libsystemd-network/test-ipv4ll.c
index aad3c476a0..fe70697075 100644
--- a/src/libsystemd-network/test-ipv4ll.c
+++ b/src/libsystemd-network/test-ipv4ll.c
@@ -101,7 +101,7 @@ int arp_network_bind_raw_socket(int index, be32_t address, const struct ether_ad
static void test_public_api_setters(sd_event *e) {
struct in_addr address = {};
- unsigned seed = 0;
+ uint64_t seed = 0;
sd_ipv4ll *ll;
struct ether_addr mac_addr = {
.ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'}};
diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c
index a41f231f8c..735c231a4c 100644
--- a/src/network/networkd-ipv4ll.c
+++ b/src/network/networkd-ipv4ll.c
@@ -215,9 +215,7 @@ int ipv4ll_configure(Link *link) {
if (link->udev_device) {
r = net_get_unique_predictable_data(link->udev_device, &seed);
if (r >= 0) {
- assert_cc(sizeof(unsigned) <= 8);
-
- r = sd_ipv4ll_set_address_seed(link->ipv4ll, (unsigned)seed);
+ r = sd_ipv4ll_set_address_seed(link->ipv4ll, seed);
if (r < 0)
return r;
}
diff --git a/src/systemd/sd-ipv4ll.h b/src/systemd/sd-ipv4ll.h
index 4682dd6605..1109ec52e0 100644
--- a/src/systemd/sd-ipv4ll.h
+++ b/src/systemd/sd-ipv4ll.h
@@ -45,7 +45,7 @@ int sd_ipv4ll_set_callback(sd_ipv4ll *ll, sd_ipv4ll_callback_t cb, void *userdat
int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr);
int sd_ipv4ll_set_ifindex(sd_ipv4ll *ll, int interface_index);
int sd_ipv4ll_set_address(sd_ipv4ll *ll, const struct in_addr *address);
-int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, unsigned seed);
+int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, uint64_t seed);
int sd_ipv4ll_is_running(sd_ipv4ll *ll);
int sd_ipv4ll_start(sd_ipv4ll *ll);
int sd_ipv4ll_stop(sd_ipv4ll *ll);