(1)ipsec协议修改

(2)ipv6掩码范围修改
(3)全部协议放开端口限制
This commit is contained in:
wangxin
2018-10-15 15:26:43 +08:00
parent fd2a4cf28e
commit b6276cdc8c
14 changed files with 107 additions and 50 deletions

View File

@@ -64,6 +64,20 @@
</div>
</div>
</c:if>
<div class="col-md-6 ipsecProtocol hidden">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ipsec_protocol"/></label>
<div class="col-md-6">
<select name="${cfgName}.userRegion1" class="selectpicker show-tick form-control required" disabled="disabled">
<option value=""><spring:message code="select"/></option>
<c:forEach items="${fns:getDictList('IPSEC_PROTOCOL')}" var="ipType">
<option value="${ipType.itemCode}" <c:if test="${_cfg.ipPortList[0].userRegion1==ipType.itemCode}">selected</c:if> ><spring:message code="${ipType.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="${cfgName}.userRegion1"></div>
</div>
</div>
</div>
<div class="row ip">
<div class="col-md-6">

View File

@@ -32,7 +32,12 @@
}else{
hideAction(1,asnRegionCode);
}
$("[name$='protocol']").each(function(){
showHideIPSECProtocol($(this));
});
$("[name$='protocol']").on("change",function(){
showHideIPSECProtocol($(this));
});
if(isAsn==0){
$("[class~='glyphicon-plus'][class~='ipPortList']").click();
$("[class~='boxSolid'][class~='asn']").find(".glyphicon-remove").click();
@@ -108,6 +113,7 @@
changeIPVal(tabInfo);
}
processAction(isAsn,tabInfo);
$("[name$='protocol']").change();
/* if(tabInfo){
tabInfo.find("[name$='cfgType']").val(cfgType);
tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode);
@@ -372,6 +378,23 @@ var processAction=function(configType,obj){
}
}
var showHideIPSECProtocol=function(obj){
var name=$(obj).attr("name");
var userRegion1=$("select[name='"+name.replace("protocol","userRegion1")+"']");
if($(obj).val()==8){
if(userRegion1){
userRegion1.removeAttr("disabled");
userRegion1.parents(".ipsecProtocol").removeClass("hidden");
userRegion1.selectpicker("refresh");
}
}else{
if(userRegion1){
userRegion1.attr("disabled","disabled");
userRegion1.parents(".ipsecProtocol").addClass("hidden");
userRegion1.selectpicker("refresh");
}
}
}
</script>
</head>
<body>

View File

@@ -237,8 +237,8 @@ jQuery.validator.addMethod("protocolPort",function(value, element) {
var protocolElement=$("[name='"+name.replace("destPort","protocol")+"']");
protocolVal=protocolElement.val();
}
if((protocolVal==0&&srcPortVal>0)||(protocolVal==0&&destPortVal>0)){
$.validator.messages.protocolPort=$.validator.messages.protocolPort;
if(protocolVal==0){
return true;
}else if((protocolVal!=tcp&&protocolVal!=udp&&srcPortVal>0)||(protocolVal!=tcp&&protocolVal!=udp&&destPortVal>0)){
$.validator.messages.protocolPort=$.validator.messages.protocolPort1;
return false;
@@ -250,7 +250,7 @@ jQuery.validator.addMethod("protocolPort",function(value, element) {
//ip地址校验
jQuery.validator.addMethod("ipCheck",function(value, element) {
var ipv4_ip_subnet_regexp=/^(0|1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(0|1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(0|1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(0|1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\/(3[0-2]|1[6-9]|2[0-9])$/;
var ipv6_ip_subnet_regexp=/^((::)|(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:)|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}(:[0-9A-Fa-f]{1,4}){1,2})|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){1,3})|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){1,4})|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){1,5})|([0-9A-Fa-f]{1,4}:(:[0-9A-Fa-f]{1,4}){1,6})|(:(:[0-9A-Fa-f]{1,4}){1,7})|(([0-9A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){0,1}:(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){3})|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}:(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){3})|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}:(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){3})|([0-9A-Fa-f]{1,4}:(:[0-9A-Fa-f]{1,4}){0,4}:(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){3})|(:(:[0-9A-Fa-f]{1,4}){0,5}:(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){3}))$/;
var ipv4_ip_regexp=/^(0|1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(0|1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(0|1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(0|1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$/;
@@ -370,7 +370,7 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
$.validator.messages.ipCheck=$.validator.messages.ipPart;
return false;
//}else if(!/^(0|2|4|8|16|32|64|128)$/.test(ipMaskArr[1])){
}else if(!/^(128)$/.test(ipMaskArr[1])){
}else if(!/^([2-9]|[1-9][0-9]|1[0-2][0-8])$/.test(ipMaskArr[1])){
$.validator.messages.ipCheck=$.validator.messages.ipv6MaskPart;
return false;
} else{
@@ -410,7 +410,6 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
}else if(typeInt==46){
var name=$(element).attr("name");
if(name.indexOf("srcIpAddress")>-1){
console.log("client ip must ipv4");
if(ipPattern==1){//ip/掩码格式
if(this.optional(element)||(/^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256 && RegExp.$5<=32))){
if(ipv4_ip_subnet_regexp.test(value)){
@@ -468,7 +467,6 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
}
}
}else if(name.indexOf("destIpAddress")>-1){
console.log("server ip must ipv6");
if(ipPattern==1){//ip/掩码格式
if(this.optional(element)||ipv6_ip_subnet_regexp.test(value)){
return true;
@@ -485,7 +483,7 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
$.validator.messages.ipCheck=$.validator.messages.ipPart;
return false;
//}else if(!/^(0|2|4|8|16|32|64|128)$/.test(ipMaskArr[1])){
}else if(!/^(128)$/.test(ipMaskArr[1])){
}else if(!/^([2-9]|[1-9][0-9]|1[0-2][0-8])$/.test(ipMaskArr[1])){
$.validator.messages.ipCheck=$.validator.messages.ipv6MaskPart;
return false;
} else{
@@ -526,7 +524,6 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
}else if(typeInt==64){
var name=$(element).attr("name");
if(name.indexOf("srcIpAddress")>-1){
console.log("client ip must ipv6");
if(ipPattern==1){//ip/掩码格式
if(this.optional(element)||ipv6_ip_subnet_regexp.test(value)){
return true;
@@ -543,7 +540,7 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
$.validator.messages.ipCheck=$.validator.messages.ipPart;
return false;
//}else if(!/^(0|2|4|8|16|32|64|128)$/.test(ipMaskArr[1])){
}else if(!/^(128)$/.test(ipMaskArr[1])){
}else if(!/^([2-9]|[1-9][0-9]|1[0-2][0-8])$/.test(ipMaskArr[1])){
$.validator.messages.ipCheck=$.validator.messages.ipv6MaskPart;
return false;
} else{

View File

@@ -27,7 +27,7 @@
ipMask:"Please enter a correct IP/mask",
ipPart:"Invalid IP part",
//ipv6MaskPart:"Mask must be exponent of 2,not greater than 128",
ipv6MaskPart:"Mask must be 128",
ipv6MaskPart:"Mask must between 2 and 128",
//ipMaskRange:"IP mask must between 0 and 32",
ipMaskRange:"IP mask must between 16 and 32",
srcIpNotEqDestIp:"Client IP ",
@@ -74,6 +74,6 @@
log_1_hour:"Log For The Last Hour",
input:"Please Enter ",
protocolPort:"TCP protocol or UDP protocol must be chosen when port is greater than 0",
protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0"
protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0,ALL protocol has no limit"
});
}(jQuery));

View File

@@ -27,7 +27,7 @@
ipMask:"Введите правильный IP/маску",
ipPart:"Недопустимая часть IP",
//ipv6MaskPart:"Mаска-показатель степени 2, небольше 128",
ipv6MaskPart:"掩码必须为128",
ipv6MaskPart:"掩码介于2到128",
//ipMaskRange:"Маска IP между 0 и 32",
ipMaskRange:"Маска IP должна между 16 и 32",
srcIpNotEqDestIp:"IP Источник",
@@ -74,6 +74,6 @@
log_1_hour:"Log For The Last Hour",
input:"Please Enter ",
protocolPort:"TCP protocol or UDP protocol must be chosen when port is greater than 0",
protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0"
protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0,ALL protocol has no limit"
});
}(jQuery));

View File

@@ -27,7 +27,7 @@
ipMask:"请填写正确的IP地址/掩码",
ipPart:"IP部分格式错误",
//ipv6MaskPart:"掩码为不大于128的2的指数幂",
ipv6MaskPart:"掩码必须为128",
ipv6MaskPart:"掩码介于2到128",
//ipMaskRange:"IP掩码介于0到32",
ipMaskRange:"IP掩码介于16到32",
srcIpNotEqDestIp:"源IP ",
@@ -74,6 +74,6 @@
log_1_hour:"1小时日志量",
input:"请输入 ",
protocolPort:"端口大于0时必须选择TCP协议或者UDP协议",
protocolPort1:"只有tcp,udp协议端口号可以不为0"
protocolPort1:"只有tcp,udp协议端口号可以不为0,全部协议无限制"
});
}(jQuery));