| 206 | const sysctlBridgeCallIP6Tables = "net/bridge/bridge-nf-call-ip6tables" |
| 207 | |
| 208 | func (plugin *NoopNetworkPlugin) Init( |
| 209 | host Host, |
| 210 | hairpinMode config.HairpinMode, |
| 211 | nonMasqueradeCIDR string, |
| 212 | mtu int, |
| 213 | ) error { |
| 214 | // Set bridge-nf-call-iptables=1 to maintain compatibility with older |
| 215 | // kubernetes versions to ensure the iptables-based kube proxy functions |
| 216 | // correctly. Other plugins are responsible for setting this correctly |
| 217 | // depending on whether or not they connect containers to Linux bridges |
| 218 | // or use some other mechanism (ie, SDN vswitch). |
| 219 | |
| 220 | // Ensure the netfilter module is loaded on kernel >= 3.18; previously |
| 221 | // it was built-in. |
| 222 | utilexec.New().Command("modprobe", "br-netfilter").CombinedOutput() |
| 223 | if err := plugin.Sysctl.SetSysctl(sysctlBridgeCallIPTables, 1); err != nil { |
| 224 | logrus.Errorf("can't set sysctl bridge-nf-call-iptables: %v", err) |
| 225 | } |
| 226 | if val, err := plugin.Sysctl.GetSysctl(sysctlBridgeCallIP6Tables); err == nil { |
| 227 | if val != 1 { |
| 228 | if err = plugin.Sysctl.SetSysctl(sysctlBridgeCallIP6Tables, 1); err != nil { |
| 229 | logrus.Errorf("can't set sysctl bridge-nf-call-ip6tables: %v", err) |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | return nil |
| 235 | } |
| 236 | |
| 237 | func (plugin *NoopNetworkPlugin) Event(name string, details map[string]interface{}) { |
| 238 | } |