1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

assume ip_forwarding = 1 by default

This commit is contained in:
Victor Vieux 2013-08-19 12:34:30 +00:00
parent f6653c3fa5
commit b21f898620
4 changed files with 8 additions and 8 deletions

2
api.go
View file

@ -526,7 +526,7 @@ func postContainersCreate(srv *Server, version float64, w http.ResponseWriter, r
out.Warnings = append(out.Warnings, "Your kernel does not support memory swap capabilities. Limitation discarded.")
}
if !srv.runtime.capabilities.IPv4Forwarding {
if srv.runtime.capabilities.IPv4ForwardingDisabled {
log.Println("Warning: IPv4 forwarding is disabled.")
out.Warnings = append(out.Warnings, "IPv4 forwarding is disabled.")
}

View file

@ -548,7 +548,7 @@ func (container *Container) Start(hostConfig *HostConfig) error {
container.Config.MemorySwap = -1
}
if !container.runtime.capabilities.IPv4Forwarding {
if container.runtime.capabilities.IPv4ForwardingDisabled {
log.Printf("WARNING: IPv4 forwarding is disabled. Networking will not work")
}

View file

@ -15,9 +15,9 @@ import (
)
type Capabilities struct {
MemoryLimit bool
SwapLimit bool
IPv4Forwarding bool
MemoryLimit bool
SwapLimit bool
IPv4ForwardingDisabled bool
}
type Runtime struct {
@ -244,8 +244,8 @@ func (runtime *Runtime) UpdateCapabilities(quiet bool) {
}
content, err3 := ioutil.ReadFile("/proc/sys/net/ipv4/ip_forward")
runtime.capabilities.IPv4Forwarding = err3 == nil && len(content) > 0 && content[0] == '1'
if !runtime.capabilities.IPv4Forwarding && !quiet {
runtime.capabilities.IPv4ForwardingDisabled = err3 != nil || len(content) == 0 || content[0] != '1'
if runtime.capabilities.IPv4ForwardingDisabled && !quiet {
log.Printf("WARNING: IPv4 forwarding is disabled.")
}
}

View file

@ -269,7 +269,7 @@ func (srv *Server) DockerInfo() *APIInfo {
Images: imgcount,
MemoryLimit: srv.runtime.capabilities.MemoryLimit,
SwapLimit: srv.runtime.capabilities.SwapLimit,
IPv4Forwarding: srv.runtime.capabilities.IPv4Forwarding,
IPv4Forwarding: !srv.runtime.capabilities.IPv4ForwardingDisabled,
Debug: os.Getenv("DEBUG") != "",
NFd: utils.GetTotalUsedFds(),
NGoroutines: runtime.NumGoroutine(),