From 1b9c5edc6c7acbe894c4b2db3e3e4a1f1353ccc5 Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Mon, 3 Feb 2014 14:27:40 -0800 Subject: [PATCH] networkdriver: add ErrNoDefaultRoute Docker-DCO-1.1-Signed-off-by: Johan Euphrosine (github: google) --- networkdriver/utils.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/networkdriver/utils.go b/networkdriver/utils.go index 611ca75867..0a4ef70c95 100644 --- a/networkdriver/utils.go +++ b/networkdriver/utils.go @@ -2,6 +2,7 @@ package networkdriver import ( "encoding/binary" + "errors" "fmt" "net" @@ -10,6 +11,7 @@ import ( var ( networkGetRoutesFct = netlink.NetworkGetRoutes + ErrNoDefaultRoute = errors.New("no default route") ) func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error { @@ -103,7 +105,7 @@ func GetIfaceAddr(name string) (net.Addr, error) { } func GetDefaultRouteIface() (*net.Interface, error) { - rs, err := netlink.NetworkGetRoutes() + rs, err := networkGetRoutesFct() if err != nil { return nil, fmt.Errorf("unable to get routes: %v", err) } @@ -112,5 +114,5 @@ func GetDefaultRouteIface() (*net.Interface, error) { return r.Iface, nil } } - return nil, fmt.Errorf("no default route") + return nil, ErrNoDefaultRoute }