diff options
Diffstat (limited to 'community/networkmanager/musl-no-drand.patch')
-rw-r--r-- | community/networkmanager/musl-no-drand.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/community/networkmanager/musl-no-drand.patch b/community/networkmanager/musl-no-drand.patch new file mode 100644 index 0000000000..46e3a7950c --- /dev/null +++ b/community/networkmanager/musl-no-drand.patch @@ -0,0 +1,58 @@ +From ec471e66ee14d7da06d4d0a22bc3cdb5f615fd6f Mon Sep 17 00:00:00 2001 +From: Enno Boland <g@s01.de> +Date: Wed, 7 Aug 2019 16:51:16 +0200 +Subject: [PATCH] use jrand48 instead of mrand48_r on non glibc platforms + +--- + shared/n-dhcp4/src/n-dhcp4-c-probe.c | 8 ++++++++ + shared/n-dhcp4/src/n-dhcp4-private.h | 4 ++++ + 2 files changed, 12 insertions(+) + +diff --git a/shared/n-dhcp4/src/n-dhcp4-c-probe.c b/shared/n-dhcp4/src/n-dhcp4-c-probe.c +index 308cff8307..9463528b1f 100644 +--- a/shared/n-dhcp4/src/n-dhcp4-c-probe.c ++++ b/shared/n-dhcp4/src/n-dhcp4-c-probe.c +@@ -362,8 +362,12 @@ static void n_dhcp4_client_probe_config_initialize_random_seed(NDhcp4ClientProbe + seed16v[1] = (u64 >> 16) ^ (u64 >> 0); + seed16v[2] = (u64 >> 32) ^ (u64 >> 16); + ++#ifdef __GLIBC__ + r = seed48_r(seed16v, &config->entropy); + c_assert(!r); ++#else ++ memcpy(config->entropy, seed16v, sizeof seed16v); ++#endif + } + + /** +@@ -377,10 +381,14 @@ static void n_dhcp4_client_probe_config_initialize_random_seed(NDhcp4ClientProbe + */ + uint32_t n_dhcp4_client_probe_config_get_random(NDhcp4ClientProbeConfig *config) { + long int result; ++#ifdef __GLIBC__ + int r; + + r = mrand48_r(&config->entropy, &result); + c_assert(!r); ++#else ++ result = jrand48(config->entropy); ++#endif + + return result; + }; +diff --git a/shared/n-dhcp4/src/n-dhcp4-private.h b/shared/n-dhcp4/src/n-dhcp4-private.h +index c38ddbfc80..fb48807712 100644 +--- a/shared/n-dhcp4/src/n-dhcp4-private.h ++++ b/shared/n-dhcp4/src/n-dhcp4-private.h +@@ -259,7 +259,11 @@ struct NDhcp4ClientProbeConfig { + bool inform_only; + bool init_reboot; + struct in_addr requested_ip; ++#ifdef __GLIBC__ + struct drand48_data entropy; /* entropy pool */ ++#else ++ unsigned short entropy[3]; /* entropy pool */ ++#endif + uint64_t ms_start_delay; /* max ms to wait before starting probe */ + NDhcp4ClientProbeOption *options[UINT8_MAX + 1]; + int8_t request_parameters[UINT8_MAX + 1]; |