Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert /128 addresses to /64 again #42

Merged
merged 1 commit into from
Jan 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/config/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
import (
"fmt"
"net"
"strings"
)

func getInterfaceAndNonVIPAddr(vips []net.IP) (vipIface net.Interface, nonVipAddr *net.IPNet, err error) {
Expand All @@ -27,7 +28,12 @@ func getInterfaceAndNonVIPAddr(vips []net.IP) (vipIface net.Interface, nonVipAdd
if _, ok := vipMap[n.IP.String()]; ok {
continue // This is a VIP, let's skip
}
if n.Contains(vips[0]) {
// FIXME: Breaks if more then one interface on the host has the same prefix
// DHCPv6 assigns addresses with a /128 if encountered assume /64
// so that the n.Contains returns true if the VIP has the same prefix
_, nn, _ := net.ParseCIDR(strings.Replace(addr.String(), "/128", "/64", 1))

if nn.Contains(vips[0]) {
return iface, n, err
}
default:
Expand Down