summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c6
-rw-r--r--src/network/networkd-link.c3
-rw-r--r--src/systemd/sd-dhcp-server.h3
3 files changed, 11 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index c932377d88..5c32fdfffa 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -62,6 +62,12 @@ int sd_dhcp_server_set_address(sd_dhcp_server *server, struct in_addr *address)
return 0;
}
+bool sd_dhcp_server_is_running(sd_dhcp_server *server) {
+ assert_return(server, -EINVAL);
+
+ return !!server->receive_message;
+}
+
sd_dhcp_server *sd_dhcp_server_ref(sd_dhcp_server *server) {
if (server)
assert_se(REFCNT_INC(server->n_ref) >= 2);
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 9296a594db..5527489364 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -307,7 +307,8 @@ static int link_enter_configured(Link *link) {
assert(link->network);
assert(link->state == LINK_STATE_SETTING_ROUTES);
- if (link->network->dhcp_server) {
+ if (link->network->dhcp_server &&
+ !sd_dhcp_server_is_running(link->dhcp_server)) {
struct in_addr pool_start;
Address *address;
diff --git a/src/systemd/sd-dhcp-server.h b/src/systemd/sd-dhcp-server.h
index cd0ff72af2..01595d39d1 100644
--- a/src/systemd/sd-dhcp-server.h
+++ b/src/systemd/sd-dhcp-server.h
@@ -23,6 +23,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <stdbool.h>
#include <netinet/in.h>
#include "sd-event.h"
@@ -38,6 +39,8 @@ int sd_dhcp_server_attach_event(sd_dhcp_server *client, sd_event *event, int pri
int sd_dhcp_server_detach_event(sd_dhcp_server *client);
sd_event *sd_dhcp_server_get_event(sd_dhcp_server *client);
+bool sd_dhcp_server_is_running(sd_dhcp_server *server);
+
int sd_dhcp_server_start(sd_dhcp_server *server);
int sd_dhcp_server_stop(sd_dhcp_server *server);