Example #1
0
func extraneousAddresses(cfg *conf.Config) []string {
	added := cfg.SourceAddresses()
	addedMap := make(map[string]bool)
	for _, ip := range added {
		addedMap[ip] = true
	}

	cur := currentAddresses()
	var extra []string
	for _, ip := range cur {
		if addedMap[ip] && !keepAddressRe.MatchString(ip) {
			extra = append(extra, ip)
		}
	}

	debugf("extraneous interface addresses: %v", extra)
	return extra
}
Example #2
0
func missingAddresses(cfg *conf.Config) []string {
	current := currentAddresses()
	wanted := cfg.SourceAddresses()

	curMap := make(map[string]bool)
	for _, ip := range current {
		curMap[ip] = true
	}

	var missing []string
	for _, ip := range wanted {
		if !curMap[ip] {
			missing = append(missing, ip)
		}
	}

	debugf("missing local addresses: %v", missing)
	return missing
}