2019-01-01 08:23:01 +00:00
|
|
|
package syssetup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
2019-01-26 04:52:29 +00:00
|
|
|
"os/exec"
|
2019-01-01 08:23:01 +00:00
|
|
|
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
callIPTablesFile = "/proc/sys/net/bridge/bridge-nf-call-iptables"
|
2019-02-24 05:38:24 +00:00
|
|
|
forward = "/proc/sys/net/ipv4/ip_forward"
|
2019-01-01 08:23:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func Configure() error {
|
2019-01-26 04:52:29 +00:00
|
|
|
exec.Command("modprobe", "br_netfilter").Run()
|
2019-01-01 08:23:01 +00:00
|
|
|
if err := ioutil.WriteFile(callIPTablesFile, []byte("1"), 0640); err != nil {
|
|
|
|
logrus.Warnf("failed to write value 1 at %s: %v", callIPTablesFile, err)
|
|
|
|
}
|
2019-02-24 05:38:24 +00:00
|
|
|
if err := ioutil.WriteFile(forward, []byte("1"), 0640); err != nil {
|
|
|
|
logrus.Warnf("failed to write value 1 at %s: %v", forward, err)
|
|
|
|
}
|
2019-01-01 08:23:01 +00:00
|
|
|
return nil
|
|
|
|
}
|