Fix the return code check for ParseIP.
Signed-off-by: Mrunal Patel <mrunalp@gmail.com> (github: mrunalp)
This commit is contained in:
parent
4ae31b6ceb
commit
6f7adc79c8
|
@ -1004,7 +1004,7 @@ func AddRoute(destination, source, gateway, device string) error {
|
||||||
|
|
||||||
if source != "" {
|
if source != "" {
|
||||||
srcIP := net.ParseIP(source)
|
srcIP := net.ParseIP(source)
|
||||||
if err != nil {
|
if srcIP == nil {
|
||||||
return fmt.Errorf("source IP %s couldn't be parsed", source)
|
return fmt.Errorf("source IP %s couldn't be parsed", source)
|
||||||
}
|
}
|
||||||
srcFamily := getIpFamily(srcIP)
|
srcFamily := getIpFamily(srcIP)
|
||||||
|
|
Loading…
Reference in New Issue