1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #1623 from aboch/ns

Fix GetNameServerAsCIDR
This commit is contained in:
Madhu Venugopal 2017-01-26 04:17:34 -08:00 committed by GitHub
commit 58744967be

View file

@ -178,7 +178,14 @@ func GetNameservers(resolvConf []byte, kind int) []string {
func GetNameserversAsCIDR(resolvConf []byte) []string {
nameservers := []string{}
for _, nameserver := range GetNameservers(resolvConf, types.IP) {
nameservers = append(nameservers, nameserver+"/32")
var address string
// If IPv6, strip zone if present
if strings.Contains(nameserver, ":") {
address = strings.Split(nameserver, "%")[0] + "/128"
} else {
address = nameserver + "/32"
}
nameservers = append(nameservers, address)
}
return nameservers
}