1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-18 17:57:27 +03:00

tests: also fuzz packets sent in the DHCP6_STATE_SOLICITATION state

With aborts enabled the fuzzer can catch issues like
26a63b8132
Let's extend it a bit to let it cover issues like
https://github.com/systemd/systemd/pull/22406#discussion_r798932098
This commit is contained in:
Evgeny Vereshchagin 2022-02-04 15:17:25 +00:00 committed by Yu Watanabe
parent 58da18251f
commit be1eae4fad

View File

@ -44,14 +44,16 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
assert_se(sd_dhcp6_client_set_transaction_id(client, htobe32(0x00ffffff) & ((const DHCP6Message *) data)->transaction_id) == 0);
triple_timestamp_get(&t);
if (client_receive_advertise(client, (DHCP6Message *) data, size, &t, NULL) != DHCP6_STATE_REQUEST)
r = client_receive_advertise(client, (DHCP6Message *) data, size, &t, NULL);
if (r < 0)
goto cleanup;
r = sd_event_now(client->event, clock_boottime_or_monotonic(), &time_now);
if (r < 0)
goto cleanup;
client->state = DHCP6_STATE_REQUEST;
if (r == DHCP6_STATE_REQUEST)
client->state = DHCP6_STATE_REQUEST;
(void) client_send_message(client, time_now);
cleanup:
assert_se(sd_dhcp6_client_stop(client) >= 0);