From 0e6add220ca125196d328a05e9857696433b068b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 17 Jun 2018 20:44:25 +0200 Subject: [PATCH] notify dyndns from netconfigd, i.e. _after_ applying addresses --- cmd/dhcp4/dhcp4.go | 3 --- cmd/dhcp6/dhcp6.go | 3 --- internal/netconfig/netconfig.go | 6 ++++++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/dhcp4/dhcp4.go b/cmd/dhcp4/dhcp4.go index e73c41e..050516e 100644 --- a/cmd/dhcp4/dhcp4.go +++ b/cmd/dhcp4/dhcp4.go @@ -61,9 +61,6 @@ func logic() error { if err := notify.Process("/user/netconfi", syscall.SIGUSR1); err != nil { log.Printf("notifying netconfig: %v", err) } - if err := notify.Process("/user/dyndns", syscall.SIGUSR1); err != nil { - log.Printf("notifying dyndns: %v", err) - } select { case <-time.After(time.Until(c.Config().RenewAfter)): // fallthrough and renew the DHCP lease diff --git a/cmd/dhcp6/dhcp6.go b/cmd/dhcp6/dhcp6.go index e831b67..7422217 100644 --- a/cmd/dhcp6/dhcp6.go +++ b/cmd/dhcp6/dhcp6.go @@ -57,9 +57,6 @@ func logic() error { if err := notify.Process("/user/radvd", syscall.SIGUSR1); err != nil { log.Printf("notifying radvd: %v", err) } - if err := notify.Process("/user/dyndns", syscall.SIGUSR1); err != nil { - log.Printf("notifying dyndns: %v", err) - } select { case <-time.After(time.Until(c.Config().RenewAfter)): // fallthrough and renew the DHCP lease diff --git a/internal/netconfig/netconfig.go b/internal/netconfig/netconfig.go index 9dffb47..14f19c2 100644 --- a/internal/netconfig/netconfig.go +++ b/internal/netconfig/netconfig.go @@ -10,6 +10,7 @@ import ( "regexp" "strconv" "strings" + "syscall" "github.com/google/nftables" "github.com/google/nftables/binaryutil" @@ -19,6 +20,7 @@ import ( "router7/internal/dhcp4" "router7/internal/dhcp6" + "router7/internal/notify" "router7/internal/teelogger" ) @@ -545,6 +547,10 @@ func Apply(dir, root string) error { } } + if err := notify.Process("/user/dyndns", syscall.SIGUSR1); err != nil { + log.Printf("notifying dyndns: %v", err) + } + if err := applySysctl(); err != nil { if firstErr == nil { firstErr = fmt.Errorf("sysctl: %v", err)