mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 00:04:15 -04:00
Fix IPv6 case for CIDR format reverse zones (#4652)
* fix ipv6 case for cidr.Class Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add check and test case for invalid ipv6 cidr Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * net package is bad at detecting ipv6/ipv4 Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * rename Class -> Split Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
@@ -163,8 +163,12 @@ func SplitHostPort(s string) (hosts []string, port string, err error) {
|
||||
return []string{s}, port, nil
|
||||
}
|
||||
|
||||
if s[0] == ':' || (s[0] == '0' && strings.Contains(s, ":")) {
|
||||
return nil, "", fmt.Errorf("invalid CIDR %s", s)
|
||||
}
|
||||
|
||||
// now check if multiple hosts must be returned.
|
||||
nets := cidr.Class(n)
|
||||
nets := cidr.Split(n)
|
||||
hosts = cidr.Reverse(nets)
|
||||
return hosts, port, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user