Pull request: all: do not use dhcp clients when server is off

Closes #2934.

Squashed commit of the following:

commit 856ea4ec0c3ffb1da447b93260da90d37cd5d45d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 15 17:39:46 2021 +0300

    dnsforward: imp spacing

commit fa748e5a26cb6a38b5f87c5498287cb734ce7a59
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 15 17:33:44 2021 +0300

    dnsforward: imp code

commit 771ba0de449faffff1cea523e8bbcc1039c992db
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 15 17:06:03 2021 +0300

    all: do not use dhcp clients when server is off
This commit is contained in:
Ainar Garipov
2021-04-15 17:52:53 +03:00
parent b0013065a2
commit a1450c5595
8 changed files with 131 additions and 68 deletions

View File

@@ -801,6 +801,10 @@ func (s *v4Server) Start() error {
log.Debug("dhcpv4: srv.Serve: %s", err)
}()
// Signal to the clients containers in packages home and dnsforward that
// it should reload the DHCP clients.
s.conf.notify(LeaseChangedAdded)
return nil
}
@@ -815,7 +819,11 @@ func (s *v4Server) Stop() {
if err != nil {
log.Error("dhcpv4: srv.Close: %s", err)
}
// now s.srv.Serve() will return
// Signal to the clients containers in packages home and dnsforward that
// it should remove all DHCP clients.
s.conf.notify(LeaseChangedRemovedAll)
s.srv = nil
}