1
1
Fork 0

nil ㅂㅓ그 수정

This commit is contained in:
Sangbum Kim 2018-05-15 03:07:05 +09:00
parent b82ad12387
commit 514409abda
1 changed files with 15 additions and 2 deletions

View File

@ -180,7 +180,12 @@ func getSubnetIPInfo(ip net.IP, verbose bool) (gw net.IP, cidr uint64, linkname
if verbose {
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 {
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 {
cidr = cidrData
if verbose {
fmt.Printf(" interface have a subnet routing rule. gateway: %s", matchedRoute)
fmt.Println(" ok! matched ")
}
gw, cidr, linkname = matchedRoute.Gw, cidrData, attrs.Name
gw, cidr, linkname = matchedRoute.Src, cidrData, attrs.Name
break
} else if verbose {
fmt.Printf(" - cannot getting netmask : %s", err)
fmt.Println(" abandon this interface ")