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
parent bfdf63d37c
commit ba8bb0c1d7
2 changed files with 24 additions and 7 deletions

View file

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

View file

@ -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. // Check if AppArmor is supported.
if _, err := os.Stat("/sys/kernel/security/apparmor"); os.IsNotExist(err) { if _, err := os.Stat("/sys/kernel/security/apparmor"); os.IsNotExist(err) {
sysInfo.AppArmor = false sysInfo.AppArmor = false