confd: add netlink condition to dhcp-client, <net/IFNAME/running>

This patch ensures that the DHCP client is not started until the
interface is up and running (link).  If the interface goes down,
or loses link, the client is stopped and everything learned from
the server (address, routes, DNS/NTP servers, etc.) is remvoed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-12-14 16:40:41 +01:00
committed by Mattias Walström
parent e2e36d6439
commit eb89f14ea3
+2 -2
View File
@@ -244,12 +244,12 @@ static void add(const char *ifname, struct lyd_node *cfg)
fprintf(fp, "# Generated by Infix confd\n");
fprintf(fp, "metric=%s\n", metric);
fprintf(fp, "service <!> name:dhcp :%s \\\n"
fprintf(fp, "service <!> name:dhcp :%s <net/%s/running> \\\n"
" [2345] udhcpc -f -p /run/dhcp-%s.pid -t 10 -T 3 -A 10 %s -S -R \\\n"
" -o %s \\\n"
" -i %s %s %s %s \\\n"
" -- DHCP client @%s\n",
ifname, ifname, do_arp,
ifname, ifname, ifname, do_arp,
options,
ifname, args ?: "", ipcache ?: "", vendor, ifname);
fclose(fp);