all: do not depend on vyatta-dhcpd service on EdgeOS

The only reason that forces ctrld to depend on vyatta-dhcpd service on
EdgeOS is allowing ctrld to watch lease files properly, because those
files may not be created at the time client info table initialized.

However, on some EdgeOS version, vyatta-dhcpd could not start with an
empty config file, causing restart loop itself, flooding systemd log,
making the router run out of memory.

To fix this, instead of depending on vyatta-dhcpd, we should just watch
for lease files creation, then adding them to watch list.

While at it, also making ctrld starts after nss-lookup, ensuring we have
a working DNS before starting ctrld.
This commit is contained in:
Cuong Manh Le
2023-08-22 03:50:53 +00:00
committed by Cuong Manh Le
parent 13391fd469
commit 126477ef88
4 changed files with 30 additions and 18 deletions

View File

@@ -4,7 +4,6 @@ import (
"github.com/kardianos/service"
"github.com/Control-D-Inc/ctrld/internal/dns"
"github.com/Control-D-Inc/ctrld/internal/router"
)
func init() {
@@ -21,9 +20,8 @@ func setDependencies(svc *service.Config) {
"After=NetworkManager-wait-online.service",
"Wants=systemd-networkd-wait-online.service",
"After=systemd-networkd-wait-online.service",
}
if routerDeps := router.ServiceDependencies(); len(routerDeps) > 0 {
svc.Dependencies = append(svc.Dependencies, routerDeps...)
"Wants=nss-lookup.target",
"After=nss-lookup.target",
}
}