diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 81de2ef7fc..e2ea79f584 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -1202,6 +1202,10 @@ int sd_dhcp_server_start(sd_dhcp_server *server) { assert_return(server, -EINVAL); assert_return(server->event, -EINVAL); + + if (sd_dhcp_server_is_running(server)) + return 0; + assert_return(!server->receive_message, -EBUSY); assert_return(server->fd_raw < 0, -EBUSY); assert_return(server->fd < 0, -EBUSY); diff --git a/src/libsystemd-network/test-dhcp-server.c b/src/libsystemd-network/test-dhcp-server.c index f051420708..a5c9bfeafb 100644 --- a/src/libsystemd-network/test-dhcp-server.c +++ b/src/libsystemd-network/test-dhcp-server.c @@ -61,7 +61,7 @@ static int test_basic(sd_event *event, bool bind_to_interface) { return log_info_errno(r, "sd_dhcp_server_start failed: %m"); assert_se(r >= 0); - assert_se(sd_dhcp_server_start(server) == -EBUSY); + assert_se(sd_dhcp_server_start(server) >= 0); assert_se(sd_dhcp_server_stop(server) >= 0); assert_se(sd_dhcp_server_stop(server) >= 0); assert_se(sd_dhcp_server_start(server) >= 0);