summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container.go27
1 files changed, 4 insertions, 23 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 0e57f7296..b6c3d1f40 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -663,7 +663,7 @@ func (c *Container) IPs() ([]net.IPNet, error) {
}
if !c.config.CreateNetNS {
- return errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod")
+ return nil, errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod")
}
ips := make([]net.IPNet, 0, len(c.state.IPs))
@@ -688,12 +688,12 @@ func (c *Container) Routes() ([]types.Route, error) {
}
}
- routes := make([]types.Route, 0, len(c.state.Routes))
-
if !c.config.CreateNetNS {
- return errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod")
+ return nil, errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod")
}
+ routes := make([]types.Route, 0, len(c.state.Routes))
+
for _, route := range c.state.Routes {
newRoute := types.Route{
Dst: route.Dst,
@@ -709,25 +709,6 @@ func (c *Container) Routes() ([]types.Route, error) {
// Misc Accessors
// Most will require locking
-// IPAddress returns the IP address of the container
-// If the container does not have a network namespace, an error will be returned
-func (c *Container) IPAddress() (net.IP, error) {
- if !c.locked {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- if err := c.syncContainer(); err != nil {
- return nil, errors.Wrapf(err, "error updating container %s state", c.ID())
- }
- }
-
- if !c.config.CreateNetNS || c.state.NetNS == nil {
- return nil, errors.Wrapf(ErrInvalidArg, "container %s does not have a network namespace", c.ID())
- }
-
- return c.runtime.getContainerIP(c)
-}
-
// NamespacePath returns the path of one of the container's namespaces
// If the container is not running, an error will be returned
func (c *Container) NamespacePath(ns LinuxNS) (string, error) {