Improved check of interface IPs
parent
1991b9183b
commit
f1c46ed9f1
13
interface.go
13
interface.go
|
@ -190,17 +190,18 @@ func (b *AbstractBridge) IsAssigned() bool {
|
||||||
log.Printf("Error is: %s\n", err.Error())
|
log.Printf("Error is: %s\n", err.Error())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(addrs) < 1 {
|
||||||
|
log.Printf("Interface has NO ip addresses")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for _, addr := range addrs { // get ipv4 address
|
for _, addr := range addrs { // get ipv4 address
|
||||||
if ipv4Addr = addr.(*net.IPNet).IP.To4(); ipv4Addr != nil {
|
if ipv4Addr = addr.(*net.IPNet).IP.To4(); ipv4Addr != nil {
|
||||||
log.Printf("Error reading IPs for interface %s\n", interfaceName)
|
log.Printf("Error reading IPs for interface %s\n", interfaceName)
|
||||||
log.Printf("Error is: %s\n", err.Error())
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ipv4Addr == nil {
|
|
||||||
log.Printf("interface %s don't have an ipv4 address\n", interfaceName)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
if addr.String() == bridgeip {
|
if addr.String() == bridgeip {
|
||||||
|
|
Loading…
Reference in New Issue