3 Commits

Author SHA1 Message Date
55ac682d36 Fix flag.parse 2020-08-17 23:13:26 -07:00
5f01503df6 Use the correct NTP dhcp4 option 2020-08-16 18:19:34 -07:00
ce29a6f436 fix ip length 2020-08-10 22:05:40 -07:00
2 changed files with 8 additions and 6 deletions

View File

@ -68,6 +68,7 @@ func logic() error {
} }
func main() { func main() {
flag.Parse()
if err := logic(); err != nil { if err := logic(); err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -266,18 +266,19 @@ func newSrv(permDir string) (*srv, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
serverIP = serverIP.To4()
var domainSearch []byte var domainSearch []byte
domainSearch, err = dhcp4d.CompressNames("lan.", *domain) domainSearch, err = dhcp4d.CompressNames("lan.", *domain)
if err != nil { if err != nil {
return nil, err return nil, err
} }
options := dhcp4.Options{ options := dhcp4.Options{
dhcp4.OptionSubnetMask: []byte{255, 255, 255, 0}, dhcp4.OptionSubnetMask: []byte{255, 255, 255, 0},
dhcp4.OptionRouter: []byte(serverIP), dhcp4.OptionRouter: []byte(serverIP),
dhcp4.OptionDomainNameServer: []byte(serverIP), dhcp4.OptionDomainNameServer: []byte(serverIP),
dhcp4.OptionTimeServer: []byte(serverIP), dhcp4.OptionNetworkTimeProtocolServers: []byte(serverIP),
dhcp4.OptionDomainName: []byte(*domain), dhcp4.OptionDomainName: []byte(*domain),
dhcp4.OptionDomainSearch: domainSearch, dhcp4.OptionDomainSearch: domainSearch,
} }
handler, err := dhcp4d.NewHandler(permDir, ifc, *iface, nil, options) handler, err := dhcp4d.NewHandler(permDir, ifc, *iface, nil, options)