func()

in pkg/initalizer/iproute/link.go [109:126]


func (l *agentLink) isIpAttachedToLink(ctx context.Context, ipFamily int, linkLocalIp *netlink.Addr) (bool, error) {
	log := logger.FromContext(ctx)

	addrList, err := l.netlinkHandle.AddrList(l.link, ipFamily)
	if err != nil {
		log.Errorf("Unable to read address list: %v", err)
		return false, err
	}

	for _, al := range addrList {
		log.Tracef("Discovered addr %v attached to link %s", al, l.link.Attrs().Name)
		if al.Contains(linkLocalIp.IP) {
			return true, nil
		}
	}

	return false, nil
}