mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-17 22:48:49 +08:00
fixed iptable check
This commit is contained in:
parent
627f63a193
commit
a2a6d75c25
1 changed files with 3 additions and 1 deletions
|
|
@ -110,7 +110,7 @@ func iptablesPortForward(entry string, inport string, outport string, isIP bool)
|
|||
return errors.New("could not locate ip for " + entry)
|
||||
}
|
||||
|
||||
if output, _ := ncutils.RunCmd("iptables -t nat -C PREROUTING -p tcp --dport "+inport+" -j DNAT --to-destination "+address+":"+outport, false); output == "" {
|
||||
if output, err := ncutils.RunCmd("iptables -t nat -C PREROUTING -p tcp --dport "+inport+" -j DNAT --to-destination "+address+":"+outport, false); output != "" || err != nil {
|
||||
_, err := ncutils.RunCmd("iptables -t nat -A PREROUTING -p tcp --dport "+inport+" -j DNAT --to-destination "+address+":"+outport, false)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -121,6 +121,8 @@ func iptablesPortForward(entry string, inport string, outport string, isIP bool)
|
|||
}
|
||||
_, err = ncutils.RunCmd("iptables -t nat -A POSTROUTING -j MASQUERADE", false)
|
||||
return err
|
||||
} else {
|
||||
logger.Log(2, "mq forwarding could not be set reliably")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue