Add bridge-nf-call-iptables/bridge-nf-call-ipv6tables to docker info

Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
Lei Jitang 2015-06-17 09:19:11 +08:00
Родитель ba9db62e68
Коммит 57d12a0e0a
5 изменённых файлов: 34 добавлений и 7 удалений

Просмотреть файл

@ -76,6 +76,12 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
if !info.IPv4Forwarding {
fmt.Fprintf(cli.err, "WARNING: IPv4 forwarding is disabled.\n")
}
if !info.BridgeNfIptables {
fmt.Fprintf(cli.err, "WARNING: bridge-nf-call-iptables is disabled\n")
}
if !info.BridgeNfIp6tables {
fmt.Fprintf(cli.err, "WARNING: bridge-nf-call-ip6tables is disabled\n")
}
if info.Labels != nil {
fmt.Fprintln(cli.out, "Labels:")
for _, attribute := range info.Labels {

Просмотреть файл

@ -153,6 +153,8 @@ type Info struct {
CpuCfsPeriod bool
CpuCfsQuota bool
IPv4Forwarding bool
BridgeNfIptables bool
BridgeNfIp6tables bool
Debug bool
NFd int
OomKillDisable bool

Просмотреть файл

@ -67,6 +67,8 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
CpuCfsPeriod: daemon.SystemConfig().CpuCfsPeriod,
CpuCfsQuota: daemon.SystemConfig().CpuCfsQuota,
IPv4Forwarding: !daemon.SystemConfig().IPv4ForwardingDisabled,
BridgeNfIptables: !daemon.SystemConfig().BridgeNfCallIptablesDisabled,
BridgeNfIp6tables: !daemon.SystemConfig().BridgeNfCallIp6tablesDisabled,
Debug: os.Getenv("DEBUG") != "",
NFd: fileutils.GetTotalUsedFds(),
OomKillDisable: daemon.SystemConfig().OomKillDisable,

Просмотреть файл

@ -3,11 +3,13 @@ package sysinfo
// SysInfo stores information about which features a kernel supports.
// TODO Windows: Factor out platform specific capabilities.
type SysInfo struct {
MemoryLimit bool
SwapLimit bool
CpuCfsPeriod bool
CpuCfsQuota bool
IPv4ForwardingDisabled bool
AppArmor bool
OomKillDisable bool
MemoryLimit bool
SwapLimit bool
CpuCfsPeriod bool
CpuCfsQuota bool
IPv4ForwardingDisabled bool
AppArmor bool
OomKillDisable bool
BridgeNfCallIptablesDisabled bool
BridgeNfCallIp6tablesDisabled bool
}

Просмотреть файл

@ -63,6 +63,21 @@ func New(quiet bool) *SysInfo {
}
}
// Check if bridge-nf-call-iptables is disabled.
if data, err := ioutil.ReadFile("/proc/sys/net/bridge/bridge-nf-call-iptables"); os.IsNotExist(err) {
sysInfo.BridgeNfCallIptablesDisabled = true
} else {
enabled, _ := strconv.Atoi(strings.TrimSpace(string(data)))
sysInfo.BridgeNfCallIptablesDisabled = enabled == 0
}
// Check if bridge-nf-call-ip6tables is disabled.
if data, err := ioutil.ReadFile("/proc/sys/net/bridge/bridge-nf-call-ip6tables"); os.IsNotExist(err) {
sysInfo.BridgeNfCallIp6tablesDisabled = true
} else {
enabled, _ := strconv.Atoi(strings.TrimSpace(string(data)))
sysInfo.BridgeNfCallIp6tablesDisabled = enabled == 0
}
// Check if AppArmor is supported.
if _, err := os.Stat("/sys/kernel/security/apparmor"); os.IsNotExist(err) {
sysInfo.AppArmor = false