WAN Mode Page to configure this page." clasName = "floatRight toggletext_dis" dis_status = "disabled" end if (ButtonType and ButtonType == "config") then local inputTable = web.cgiToLuaTable(cgi) if(inputTable["IpsecIKEPolicy.AddressFamily"] == nil) then inputTable["IpsecIKEPolicy.AddressFamily"] = "10" end --automation part begin local tableIndex = 1 local errorFlag = "OK" validationTable = { function() return validations.isEmpty(inputTable["IpsecIKEPolicy.IKEPolicyName"],"IKE Policy Name Error") end, --function() return validations.checkboxValidate(inputTable["IpsecIKEPolicy.ModeConfigStatus"],"0",1) end, function() return validations.checkboxValidate(inputTable["IpsecIKEPolicy.AuthType"],"0",1) end, function() return validations.preShrKeyChk(inputTable["IpsecIKEPolicy.Presharedkey"],"Pre Share Key Error") end, function() return validations.checkboxValidate(inputTable["IpsecIKEPolicy.DPD"],"1",2) end, function() return validations.detPeriod(inputTable["IpsecIKEPolicy.DPDDetectionPeriod"],"Detection Period Error") end, function() return validations.reConCount(inputTable["IpsecIKEPolicy.DPDFailureCount"],"Re-Con Count Error") end } while (tableIndex <= #(validationTable)) do validationFunc = validationTable[tableIndex] errorFlag, statusCode,field,skipValidations = validationFunc() if(errorFlag==1 or errorFlag == "ERROR") then statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) or statusCode statusMessage = field .. ": " .. statusMessage break end if(skipValidations ~= "") then tableIndex = tableIndex + skipValidations + 1 else tableIndex = tableIndex + 1 end end if(errorFlag == "OK" or errorFlag == 0) then if (inputTable["IpsecIKEPolicy.XAUTHType"] == "2") then inputTable["IpsecIKEPolicy.XAUTHType"] = inputTable["IpsecIKEPolicy.XAUTHType1"] end if((tonumber(inputTable["IpsecIKEPolicy.AuthType"]) == 1) and (tonumber(inputTable["IpsecIKEPolicy.LocalIdentifierType"]) ~= 3 or tonumber(inputTable["IpsecIKEPolicy.RemoteIdentifierType"]) ~= 3)) then errorFlag, statusCode = "ERROR", "RSA-Signature selected. Please select 'DER ASN1 DN' for both Local and Remote Identifier Type" else if (RowId == "-1") then errorFlag, statusCode = vipSecure.ikeConfig(inputTable, "-1", "add") else errorFlag, statusCode = vipSecure.ikeEditCheck(RowId) if (errorFlag == "ERROR") then NextPage='ike_policies_IPv6' else if (inputTable["IpsecIKEPolicy.Password"] ~= nil and util.isAllMasked_new (inputTable["IpsecIKEPolicy.Password"])) then inputTable["IpsecIKEPolicy.Password"] = db.getAttribute ("IpsecIKEPolicy","_ROWID_",RowId,"Password") end errorFlag, statusCode = vipSecure.ikeConfig(inputTable, RowId, "edit") end end end -- save db if no error if (errorFlag == "OK") then db.save() end statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) or statusCode end web.goToPage(NextPage, true, true) else selected = 10 edit = "" editIKEName = "" tabHeadding = "" if (errorFlag ~= "OK") then configRowId = RowId elseif (configRowId == "-1") then configRow = db.getDefaults(true, "IpsecIKEPolicy") tabHeadding = "Add IKE Policy" else configRow = db.getRow("IpsecIKEPolicy", "_ROWID_", configRowId) selected = tonumber(configRow["IpsecIKEPolicy.XAUTHType"]) if (ACCESS_LEVEL ~= 0) then configRow["IpsecIKEPolicy.Presharedkey"] = util.mask (configRow["IpsecIKEPolicy.Presharedkey"]) end edit = "readonly" editIKEName = "DISABLED" tabHeadding = "Edit IKE Policy" end if (configRow["IpsecIKEPolicy.Password"] ~= nil) then configRow["IpsecIKEPolicy.Password"] = util.mask_new (configRow["IpsecIKEPolicy.Password"]) end if (configRow["IpsecIKEPolicy.XAUTHType"] ~= nil and tonumber(configRow["IpsecIKEPolicy.XAUTHType"]) > 1) then configRow["IpsecIKEPolicy.XAUTHType1"] = configRow["IpsecIKEPolicy.XAUTHType"] configRow["IpsecIKEPolicy.XAUTHType"] = "2" end ?>