1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-07 17:17:44 +03:00

test-dhcp-server: Gracefully handle the network being down

(cherry picked from commit 4cf7a676af9a79ff418227d8ff488dfca6f243ab)
(cherry picked from commit 2e52cf1df7f4a874331dcf607e0f4329ffb20bcd)
(cherry picked from commit db1d9bf996)
(cherry picked from commit 244ca2d63e)
This commit is contained in:
Daan De Meyer 2024-08-19 00:13:47 +02:00 committed by Luca Boccassi
parent ff09fe5b27
commit 8bc9741422

View File

@ -119,6 +119,7 @@ static void test_message_handler(void) {
.s_addr = htobe32(INADDR_LOOPBACK + 42),
};
static uint8_t static_lease_client_id[7] = {0x01, 'A', 'B', 'C', 'D', 'E', 'G' };
int r;
log_debug("/* %s */", __func__);
@ -129,7 +130,10 @@ static void test_message_handler(void) {
assert_se(sd_dhcp_server_attach_event(server, NULL, 0) >= 0);
assert_se(sd_dhcp_server_start(server) >= 0);
assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_OFFER);
r = dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test));
if (r == -ENETDOWN)
return (void) log_tests_skipped("Network is not available");
assert_se(r == DHCP_OFFER);
test.end = 0;
/* TODO, shouldn't this fail? */