Skip to content

Commit

Permalink
make sure iface param is quoted while enabling forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
rakelkar committed Oct 3, 2017
1 parent 374e3fc commit 512444a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions netsh/netsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,15 @@ func (runner *runner) GetInterfaces() ([]Ipv4Interface, error) {
// Enable forwarding on the interface (name or index)
func (runner *runner) EnableForwarding(iface string) error {
args := []string{
"int", "ipv4", "set", "int", iface, "for=en",
"int", "ipv4", "set", "int", strconv.Quote(iface), "for=en",
}
cmd := strings.Join(args, " ")
glog.V(4).Infof(cmd)
if stdout, err := runner.exec.Command(cmdNetsh, args...).CombinedOutput(); err != nil {
return fmt.Errorf("failed to enable forwarding on [%v], error: %v. cmd: %v. stdout: %v", iface, err.Error(), cmd, string(stdout))
}
glog.V(4).Infof(" netsh int ipv4 set int running netsh interface portproxy add v4tov4 %v", args)
_, err := runner.exec.Command(cmdNetsh, args...).CombinedOutput()

return err
return nil
}

// EnsurePortProxyRule checks if the specified redirect exists, if not creates it.
Expand Down

0 comments on commit 512444a

Please sign in to comment.