1.修改 导入时只有源IP或目的IP的配置 不能为0.0.0.0
同时有源IP和目的IP两个IP不能一样,仅有一个可为0.0.0.0 2.修复 新增功能和导入功能的IP校验不一致问题
This commit is contained in:
@@ -488,11 +488,11 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
||||
if (valType == String.class){
|
||||
String s = String.valueOf(val.toString().trim());
|
||||
//0.0.0.0表示任意IP的含义
|
||||
if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
|
||||
val = StringUtils.substringBefore(s, ".0");
|
||||
}else{
|
||||
val=val == null ? "" : StringEscapeUtils.escapeHtml4(val.toString().trim());
|
||||
}
|
||||
// if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
|
||||
// val = StringUtils.substringBefore(s, ".0");
|
||||
// }else{
|
||||
val=val == null ? "" : StringEscapeUtils.escapeHtml4(val.toString().trim());
|
||||
// }
|
||||
}else if (valType == Integer.class){
|
||||
val = Double.valueOf(val.toString().trim()).intValue();
|
||||
}else if (valType == Long.class){
|
||||
|
||||
@@ -138,6 +138,9 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseIpCfg,errInfo);
|
||||
|
||||
//IP校验
|
||||
this.validSrcAndDescIp(baseIpCfg.getSrcIpAddress(), baseIpCfg.getDestIpAddress(), configIpPortShow,errInfo);
|
||||
|
||||
// 特殊字段验证
|
||||
// packet ip ratelimit
|
||||
if (serviceDict!=null && serviceDict.getAction().intValue() == 64 && (serviceDict.getFunctionId().intValue() == 5
|
||||
@@ -1328,4 +1331,24 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
public void setAsnGroupInfos(Map<Long, AsnGroupInfo> asnGroupInfos) {
|
||||
this.asnGroupInfos = asnGroupInfos;
|
||||
}
|
||||
|
||||
public void validSrcAndDescIp(String srcIp, String descIp, String configIpPortShow, StringBuffer errInfo) {
|
||||
if (configIpPortShow.contains("1") && configIpPortShow.contains("3")) {
|
||||
if (srcIp.equals(descIp)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("are_the_same"), prop.getProperty("server_ip"), prop.getProperty("client_ip"))
|
||||
+ ";");
|
||||
}
|
||||
} else if (configIpPortShow.contains("1")) {
|
||||
if ("0.0.0.0".equals(srcIp)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_ip")) + ";");
|
||||
}
|
||||
} else if (configIpPortShow.contains("3")) {
|
||||
if ("0.0.0.0".equals(descIp)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_ip")) + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user