ip导入ip范围校验调整,去掉必须输入C段IP限制

This commit is contained in:
wangxin
2018-10-29 13:07:57 +08:00
parent 462e49317a
commit dc86b90a99
4 changed files with 19 additions and 9 deletions

View File

@@ -2062,10 +2062,18 @@ public class BaseController {
Properties prop = this.getMsgProp();
String prefix = ip.split("-")[0];
String subfix = ip.split("-")[1];
if (Integer.parseInt(prefix.split("\\.")[0]) < 192 || Integer.parseInt(prefix.split("\\.")[0]) > 223
|| Integer.parseInt(subfix.split("\\.")[0]) < 192 || Integer.parseInt(subfix.split("\\.")[0]) > 223) {
errInfo.append(prop.get(ipName) + " " + prop.get("ip_range_in_c") + ";");
if ((Integer.parseInt(prefix.split("\\.")[0])<128&&Integer.parseInt(subfix.split("\\.")[0])<128)
||(Integer.parseInt(prefix.split("\\.")[0])>127&&Integer.parseInt(subfix.split("\\.")[0])>127&&Integer.parseInt(prefix.split("\\.")[0])<192&&Integer.parseInt(subfix.split("\\.")[0])<192)
||(Integer.parseInt(prefix.split("\\.")[0])>191&&Integer.parseInt(subfix.split("\\.")[0])>191&&Integer.parseInt(prefix.split("\\.")[0])<224&&Integer.parseInt(subfix.split("\\.")[0])<224)
||(Integer.parseInt(prefix.split("\\.")[0])>223&&Integer.parseInt(subfix.split("\\.")[0])>223&&Integer.parseInt(prefix.split("\\.")[0])<240&&Integer.parseInt(subfix.split("\\.")[0])<240)
||(Integer.parseInt(prefix.split("\\.")[0])>239&&Integer.parseInt(subfix.split("\\.")[0])>239&&Integer.parseInt(prefix.split("\\.")[0])<256&&Integer.parseInt(subfix.split("\\.")[0])<256)) {
}else {
errInfo.append(prop.get(ipName) + " " + prop.get("ip_range_in_the_same") + ";");
}
// if (Integer.parseInt(prefix.split("\\.")[0]) < 192 || Integer.parseInt(prefix.split("\\.")[0]) > 223
// || Integer.parseInt(subfix.split("\\.")[0]) < 192 || Integer.parseInt(subfix.split("\\.")[0]) > 223) {
// errInfo.append(prop.get(ipName) + " " + prop.get("ip_range_in_c") + ";");
// }
if (!prefix.split("\\.")[0].equals(subfix.split("\\.")[0])
|| !prefix.split("\\.")[1].equals(subfix.split("\\.")[1])
|| !prefix.split("\\.")[2].equals(subfix.split("\\.")[2])) {

View File

@@ -1295,4 +1295,5 @@ cfg_operation_log=Configuration Operation Log
function_name=Operation Module
config_service_statistics=Config Statistics
ruleLimitTip=The number of effective rules has reached the limit(%s).
av_protocol_note=Note:Recognizable Protocols Include RTSP,RTMP.
av_protocol_note=Note:Recognizable Protocols Include RTSP,RTMP.
ip_range_in_the_same=Start IP and end IP in a IP range must with in the same subnet

View File

@@ -1287,4 +1287,5 @@ cfg_operation_log=\u914D\u7F6E\u64E6\u6B27\u6D32\u54E6\u65E5\u5FD7
function_name=\u64CD\u4F5C\u6A21\u5757
config_service_statistics=\u914D\u7F6E\u7EDF\u8BA1
ruleLimitTip=\u6709\u6548\u89C4\u5219\u91CF\u5DF2\u8FBE\u5230\u9650\u5236(%s).
av_protocol_note=\u6CE8\uFF1A\u53EF\u8BC6\u522B\u534F\u8BAE\u5305\u62EC RTSP\u3001RTMP\u3002
av_protocol_note=\u6CE8\uFF1A\u53EF\u8BC6\u522B\u534F\u8BAE\u5305\u62EC RTSP\u3001RTMP\u3002
ip_range_in_the_same=IP\u8303\u56F4\u7684\u8D77\u59CBIP\u4E0E\u7EC8\u6B62IP\u5FC5\u987B\u5728\u76F8\u540C\u7F51\u6BB5

View File

@@ -341,7 +341,7 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
if((startPart0<128&&startPart1<128)||(startPart0>127&&startPart1>127&&startPart0<192&&startPart1<192)
||(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224)
||(startPart0>223&&startPart1>223&&startPart0<240&&startPart1<240)
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){//仅允许C段IP
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){//仅允许段IP
if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小
if((startIp.split(".")[0]!=endIp.split(".")[0])||
(startIp.split(".")[1]!=endIp.split(".")[1])||
@@ -465,7 +465,7 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
if((startPart0<128&&startPart1<128)||(startPart0>127&&startPart1>127&&startPart0<192&&startPart1<192)
||(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224)
||(startPart0>223&&startPart1>223&&startPart0<240&&startPart1<240)
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){//仅允许C段IP
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){//仅允许段IP
if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小
if((startIp.split(".")[0]!=endIp.split(".")[0])||
(startIp.split(".")[1]!=endIp.split(".")[1])||
@@ -636,7 +636,7 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
if((startPart0<128&&startPart1<128)||(startPart0>127&&startPart1>127&&startPart0<192&&startPart1<192)
||(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224)
||(startPart0>223&&startPart1>223&&startPart0<240&&startPart1<240)
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){//仅允许C段IP
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){//仅允许段IP
if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小
if((startIp.split(".")[0]!=endIp.split(".")[0])||
(startIp.split(".")[1]!=endIp.split(".")[1])||
@@ -692,7 +692,7 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
if((startPart0<128&&startPart1<128)||(startPart0>127&&startPart1>127&&startPart0<192&&startPart1<192)
||(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224)
||(startPart0>223&&startPart1>223&&startPart0<240&&startPart1<240)
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){//仅允许C段IP
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){//仅允许段IP
if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小
if((startIp.split(".")[0]!=endIp.split(".")[0])||
(startIp.split(".")[1]!=endIp.split(".")[1])||