|
|
@ -10,6 +10,7 @@ import (
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"proxy/cmd"
|
|
|
|
"proxy/cmd"
|
|
|
|
"proxy/util"
|
|
|
|
"proxy/util"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
@ -30,6 +31,8 @@ func main() {
|
|
|
|
newmac := flag.String("newmac", "52:54:00:12:34:aa", "MAC after change")
|
|
|
|
newmac := flag.String("newmac", "52:54:00:12:34:aa", "MAC after change")
|
|
|
|
passthrough := flag.Bool("passthrough", false, "Whether to pass every traffic through")
|
|
|
|
passthrough := flag.Bool("passthrough", false, "Whether to pass every traffic through")
|
|
|
|
proxy := flag.String("proxy", "1", "Number of the proxy switch")
|
|
|
|
proxy := flag.String("proxy", "1", "Number of the proxy switch")
|
|
|
|
|
|
|
|
pidfile := flag.String("pidfile", "", "Location to write the pid to")
|
|
|
|
|
|
|
|
logfile := flag.String("logfile", "", "Location to write output to")
|
|
|
|
flag.Parse()
|
|
|
|
flag.Parse()
|
|
|
|
log.SetLevel(log.Level(*logLvl))
|
|
|
|
log.SetLevel(log.Level(*logLvl))
|
|
|
|
OldMac, _ = net.ParseMAC(*oldmac)
|
|
|
|
OldMac, _ = net.ParseMAC(*oldmac)
|
|
|
@ -39,6 +42,14 @@ func main() {
|
|
|
|
log.SetFormatter(&log.TextFormatter{
|
|
|
|
log.SetFormatter(&log.TextFormatter{
|
|
|
|
DisableTimestamp: true,
|
|
|
|
DisableTimestamp: true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
if *logfile != "" {
|
|
|
|
|
|
|
|
if f, err := os.OpenFile(*logfile, os.O_WRONLY | os.O_CREATE, 0755); err != nil {
|
|
|
|
|
|
|
|
log.Error("Error opening logfile ", *logfile)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
log.SetOutput(f)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
util.WritePIDFile(*pidfile)
|
|
|
|
c1 := cmd.New("vde_plug", "/run/vde/sw_main.sock")
|
|
|
|
c1 := cmd.New("vde_plug", "/run/vde/sw_main.sock")
|
|
|
|
c2 := cmd.New("vde_plug", "/run/vde/sw_proxy"+*proxy+".sock")
|
|
|
|
c2 := cmd.New("vde_plug", "/run/vde/sw_proxy"+*proxy+".sock")
|
|
|
|
c1.Execute()
|
|
|
|
c1.Execute()
|
|
|
|