diff options
Diffstat (limited to 'runsc/sandbox/network.go')
-rw-r--r-- | runsc/sandbox/network.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/runsc/sandbox/network.go b/runsc/sandbox/network.go index 52fe8fc0f..8ec320d09 100644 --- a/runsc/sandbox/network.go +++ b/runsc/sandbox/network.go @@ -61,19 +61,19 @@ func setupNetwork(conn *urpc.Client, pid int, spec *specs.Spec, conf *boot.Confi case boot.NetworkNone: log.Infof("Network is disabled, create loopback interface only") if err := createDefaultLoopbackInterface(conn); err != nil { - return fmt.Errorf("error creating default loopback interface: %v", err) + return fmt.Errorf("creating default loopback interface: %v", err) } case boot.NetworkSandbox: // Build the path to the net namespace of the sandbox process. // This is what we will copy. nsPath := filepath.Join("/proc", strconv.Itoa(pid), "ns/net") if err := createInterfacesAndRoutesFromNS(conn, nsPath); err != nil { - return fmt.Errorf("error creating interfaces from net namespace %q: %v", nsPath, err) + return fmt.Errorf("creating interfaces from net namespace %q: %v", nsPath, err) } case boot.NetworkHost: // Nothing to do here. default: - return fmt.Errorf("Invalid network type: %d", conf.Network) + return fmt.Errorf("invalid network type: %d", conf.Network) } return nil } @@ -99,7 +99,7 @@ func createDefaultLoopbackInterface(conn *urpc.Client) error { if err := conn.Call(boot.NetworkCreateLinksAndRoutes, &boot.CreateLinksAndRoutesArgs{ LoopbackLinks: []boot.LoopbackLink{link}, }, nil); err != nil { - return fmt.Errorf("error creating loopback link and routes: %v", err) + return fmt.Errorf("creating loopback link and routes: %v", err) } return nil } @@ -112,7 +112,7 @@ func joinNetNS(nsPath string) (func(), error) { }) if err != nil { runtime.UnlockOSThread() - return nil, fmt.Errorf("error joining net namespace %q: %v", nsPath, err) + return nil, fmt.Errorf("joining net namespace %q: %v", nsPath, err) } return func() { restoreNS() @@ -147,7 +147,7 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string) error { // Get all interfaces in the namespace. ifaces, err := net.Interfaces() if err != nil { - return fmt.Errorf("error querying interfaces: %v", err) + return fmt.Errorf("querying interfaces: %v", err) } if isRootNS(ifaces) { @@ -164,14 +164,14 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string) error { allAddrs, err := iface.Addrs() if err != nil { - return fmt.Errorf("error fetching interface addresses for %q: %v", iface.Name, err) + return fmt.Errorf("fetching interface addresses for %q: %v", iface.Name, err) } // We build our own loopback devices. if iface.Flags&net.FlagLoopback != 0 { links, err := loopbackLinks(iface, allAddrs) if err != nil { - return fmt.Errorf("error getting loopback routes and links for iface %q: %v", iface.Name, err) + return fmt.Errorf("getting loopback routes and links for iface %q: %v", iface.Name, err) } args.LoopbackLinks = append(args.LoopbackLinks, links...) continue @@ -218,7 +218,7 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string) error { // will remove the routes as well. routes, def, err := routesForIface(iface) if err != nil { - return fmt.Errorf("error getting routes for interface %q: %v", iface.Name, err) + return fmt.Errorf("getting routes for interface %q: %v", iface.Name, err) } if def != nil { if !args.DefaultGateway.Route.Empty() { @@ -237,7 +237,7 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string) error { // Get the link for the interface. ifaceLink, err := netlink.LinkByName(iface.Name) if err != nil { - return fmt.Errorf("error getting link for interface %q: %v", iface.Name, err) + return fmt.Errorf("getting link for interface %q: %v", iface.Name, err) } // Collect the addresses for the interface, enable forwarding, @@ -247,7 +247,7 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string) error { // Steal IP address from NIC. if err := removeAddress(ifaceLink, addr.String()); err != nil { - return fmt.Errorf("error removing address %v from device %q: %v", iface.Name, addr, err) + return fmt.Errorf("removing address %v from device %q: %v", iface.Name, addr, err) } } @@ -257,7 +257,7 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string) error { log.Debugf("Setting up network, config: %+v", args) if err := conn.Call(boot.NetworkCreateLinksAndRoutes, &args, nil); err != nil { - return fmt.Errorf("error creating links and routes: %v", err) + return fmt.Errorf("creating links and routes: %v", err) } return nil } @@ -291,7 +291,7 @@ func routesForIface(iface net.Interface) ([]boot.Route, *boot.Route, error) { } rs, err := netlink.RouteList(link, netlink.FAMILY_ALL) if err != nil { - return nil, nil, fmt.Errorf("error getting routes from %q: %v", iface.Name, err) + return nil, nil, fmt.Errorf("getting routes from %q: %v", iface.Name, err) } var def *boot.Route |