1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

sd-dhcp6-client: fix overflow in calculating timeout value

This commit is contained in:
Yu Watanabe 2022-02-06 23:25:07 +09:00
parent d0875a07dd
commit cc5184823f

View File

@ -808,6 +808,10 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
return 0;
}
static usec_t client_timeout_compute_random(usec_t val) {
return usec_sub_unsigned(val, random_u64_range(val / 10));
}
static int client_timeout_t2(sd_event_source *s, uint64_t usec, void *userdata) {
sd_dhcp6_client *client = userdata;
@ -861,10 +865,6 @@ static int client_timeout_resend_expire(sd_event_source *s, uint64_t usec, void
return 0;
}
static usec_t client_timeout_compute_random(usec_t val) {
return val - (random_u32() % USEC_PER_SEC) * val / 10 / USEC_PER_SEC;
}
static int client_timeout_resend(sd_event_source *s, uint64_t usec, void *userdata) {
int r = 0;
sd_dhcp6_client *client = userdata;