This commit is contained in:
afeiszli
2021-07-28 02:23:20 +00:00
parent 60ef0e80b7
commit 12c4fa33f5
13 changed files with 208 additions and 19 deletions

View File

@@ -559,8 +559,6 @@ func CreateEgressGateway(gateway models.EgressGatewayRequest) (models.Node, erro
if err != nil {
return models.Node{}, err
}
log.Println("GATEWAY:",gateway)
log.Println("NODE:",node)
err = ValidateEgressGateway(gateway)
if err != nil {
return models.Node{}, err
@@ -699,16 +697,17 @@ func CreateIngressGateway(netid string, macaddress string) (models.Node, error)
postDownCmd := "iptables -D FORWARD -i " + node.Interface + " -j ACCEPT; iptables -t nat -D POSTROUTING -o " + node.Interface + " -j MASQUERADE"
if node.PostUp != "" {
if !strings.Contains(node.PostUp, postUpCmd) {
node.PostUp = node.PostUp + "; " + postUpCmd
postUpCmd = node.PostUp + "; " + postUpCmd
}
}
if node.PostDown != "" {
if !strings.Contains(node.PostDown, postDownCmd) {
node.PostDown = node.PostDown + "; " + postDownCmd
postDownCmd = node.PostDown + "; " + postDownCmd
}
}
node.SetLastModified()
node.PostUp = postUpCmd
node.PostDown = postDownCmd
key, err := functions.GetRecordKey(node.MacAddress, node.Network)
if err != nil {
return models.Node{}, err