+ dhcpv6 server; support static leases

This commit is contained in:
Simon Zolin
2020-04-27 10:46:11 +03:00
parent 08b033dd04
commit 8aa30a8e83
6 changed files with 193 additions and 4 deletions

View File

@@ -47,6 +47,8 @@ type ServerConfig struct {
// 0: disable
ICMPTimeout uint32 `json:"icmp_timeout_msec" yaml:"icmp_timeout_msec"`
EnableV6 bool `yaml:"enable_v6"`
WorkDir string `json:"-" yaml:"-"`
DBFilePath string `json:"-" yaml:"-"` // path to DB file
@@ -89,6 +91,9 @@ type Server struct {
// IP address pool -- if entry is in the pool, then it's attached to a lease
IPpool map[[4]byte]net.HardwareAddr
v6Leases []*Lease
v6LeasesLock sync.RWMutex
conf ServerConfig
// Called when the leases DB is modified
@@ -255,6 +260,13 @@ func (s *Server) Start() error {
s.cond.Signal()
}()
if s.conf.EnableV6 {
err := s.v6Start()
if err != nil {
return err
}
}
return nil
}