summaryrefslogtreecommitdiffhomepage
path: root/config/default_linux.go
diff options
context:
space:
mode:
authorJeff Bean <bean@uber.com>2018-06-22 19:41:59 -0700
committerJeff Bean <bean@uber.com>2018-06-22 19:41:59 -0700
commitfb034c3aba46e318fcbd748cef02796a05305aa2 (patch)
tree5fb3b56a723dac39a28589d941caad123a1f4f7e /config/default_linux.go
parent154650594c5b40b2905eb73b90f52de72f6ced16 (diff)
fixing some typos and found one conversion bug
Diffstat (limited to 'config/default_linux.go')
-rw-r--r--config/default_linux.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/config/default_linux.go b/config/default_linux.go
index f83b76fe..8cfcc501 100644
--- a/config/default_linux.go
+++ b/config/default_linux.go
@@ -53,3 +53,20 @@ func GetIPv6LinkLocalNeighborAddress(ifname string) (string, error) {
return fmt.Sprintf("%s%%%s", addr, ifname), nil
}
+
+func isLocalLinkLocalAddress(ifindex int, addr net.IP) (bool, error) {
+ ifi, err := net.InterfaceByIndex(ifindex)
+ if err != nil {
+ return false, err
+ }
+ addrs, err := ifi.Addrs()
+ if err != nil {
+ return false, err
+ }
+ for _, a := range addrs {
+ if ip, _, _ := net.ParseCIDR(a.String()); addr.Equal(ip) {
+ return true, nil
+ }
+ }
+ return false, nil
+}