all: sync with master

This commit is contained in:
Ainar Garipov
2022-12-07 16:46:59 +03:00
parent 03d9803238
commit fde9ea5cb1
61 changed files with 1523 additions and 295 deletions

View File

@@ -137,14 +137,14 @@ func (c *V4ServerConf) Validate() (err error) {
gatewayIP, err := ensureV4(c.GatewayIP, "address")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// Don't wrap the error since it's informative enough as is and there is
// an annotation deferred already.
return err
}
subnetMask, err := ensureV4(c.SubnetMask, "subnet mask")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// Don't wrap the error since it's informative enough as is and there is
// an annotation deferred already.
return err
}
@@ -155,20 +155,21 @@ func (c *V4ServerConf) Validate() (err error) {
rangeStart, err := ensureV4(c.RangeStart, "address")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// Don't wrap the error since it's informative enough as is and there is
// an annotation deferred already.
return err
}
rangeEnd, err := ensureV4(c.RangeEnd, "address")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// Don't wrap the error since it's informative enough as is and there is
// an annotation deferred already.
return err
}
c.ipRange, err = newIPRange(rangeStart.AsSlice(), rangeEnd.AsSlice())
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// Don't wrap the error since it's informative enough as is and there is
// an annotation deferred already.
return err
}

View File

@@ -219,8 +219,6 @@ var _ Interface = (*server)(nil)
// Create initializes and returns the DHCP server handling both address
// families. It also registers the corresponding HTTP API endpoints.
//
// TODO(e.burkov): Don't register handlers, see TODO on [aghhttp.RegisterFunc].
func Create(conf *ServerConfig) (s *server, err error) {
s = &server{
conf: &ServerConfig{
@@ -237,6 +235,8 @@ func Create(conf *ServerConfig) (s *server, err error) {
},
}
// TODO(e.burkov): Don't register handlers, see TODO on
// [aghhttp.RegisterFunc].
s.registerHandlers()
v4conf := conf.Conf4
@@ -250,7 +250,7 @@ func Create(conf *ServerConfig) (s *server, err error) {
return nil, fmt.Errorf("creating dhcpv4 srv: %w", err)
}
log.Error("creating dhcpv4 srv: %s", err)
log.Debug("dhcpd: warning: creating dhcpv4 srv: %s", err)
}
v6conf := conf.Conf6