dns: log error when adding an invalid record

This commit is contained in:
nadoo committed 2022-02-20 01:07:51 +08:00
1 parent 813c5fef94
commit cb698713ee
8 files changed
+34 -35

No files matched your search

+3 -4
View File
@@ -66,10 +66,9 @@ func (*dpcpd) Run(args ...string) {
// static ips
for _, host := range args[4:] {
pair := strings.Split(host, "=")
if len(pair) == 2 {
if mac, err := net.ParseMAC(pair[0]); err == nil {
if ip, err := netip.ParseAddr(pair[1]); err == nil {
if mac, ip, ok := strings.Cut(host, "="); ok {
if mac, err := net.ParseMAC(mac); err == nil {
if ip, err := netip.ParseAddr(ip); err == nil {
pool.LeaseStaticIP(mac, ip)
}
}