nil ㅂㅓ그 수정
This commit is contained in:
parent
b82ad12387
commit
514409abda
|
@ -180,7 +180,12 @@ func getSubnetIPInfo(ip net.IP, verbose bool) (gw net.IP, cidr uint64, linkname
|
||||||
if verbose {
|
if verbose {
|
||||||
fmt.Printf(" routing table %s\n", route.String())
|
fmt.Printf(" routing table %s\n", route.String())
|
||||||
}
|
}
|
||||||
if route.Dst.Contains(ip) {
|
|
||||||
|
if route.Dst == nil {
|
||||||
|
if verbose {
|
||||||
|
fmt.Printf(" - default gateway : no one!\n")
|
||||||
|
}
|
||||||
|
} else if route.Dst.Contains(ip) {
|
||||||
if verbose {
|
if verbose {
|
||||||
fmt.Printf(" - matched routing role : %s\n", route.String())
|
fmt.Printf(" - matched routing role : %s\n", route.String())
|
||||||
}
|
}
|
||||||
|
@ -191,13 +196,21 @@ func getSubnetIPInfo(ip net.IP, verbose bool) (gw net.IP, cidr uint64, linkname
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if matchedRoute == nil {
|
||||||
|
if verbose {
|
||||||
|
fmt.Println(" - cannot getting routing rule")
|
||||||
|
fmt.Println(" abandon this interface ")
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
if cidrData, err := getCidr(*matchedRoute.Dst); err == nil {
|
if cidrData, err := getCidr(*matchedRoute.Dst); err == nil {
|
||||||
cidr = cidrData
|
cidr = cidrData
|
||||||
if verbose {
|
if verbose {
|
||||||
fmt.Printf(" interface have a subnet routing rule. gateway: %s", matchedRoute)
|
fmt.Printf(" interface have a subnet routing rule. gateway: %s", matchedRoute)
|
||||||
fmt.Println(" ok! matched ")
|
fmt.Println(" ok! matched ")
|
||||||
}
|
}
|
||||||
gw, cidr, linkname = matchedRoute.Gw, cidrData, attrs.Name
|
gw, cidr, linkname = matchedRoute.Src, cidrData, attrs.Name
|
||||||
|
break
|
||||||
} else if verbose {
|
} else if verbose {
|
||||||
fmt.Printf(" - cannot getting netmask : %s", err)
|
fmt.Printf(" - cannot getting netmask : %s", err)
|
||||||
fmt.Println(" abandon this interface ")
|
fmt.Println(" abandon this interface ")
|
||||||
|
|
Loading…
Reference in New Issue