(1)修复忽略单属性判断时方向属性取错的bug

(2)Packet IP reject 协议特殊处理
This commit is contained in:
wangxin
2018-11-02 18:40:43 +08:00
parent 857e8ecb85
commit 9a5f311838
2 changed files with 32 additions and 20 deletions

View File

@@ -31,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
import com.google.common.collect.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
import com.nis.domain.configuration.template.IpAllTemplate;
import com.nis.domain.configuration.template.StringAllTemplate;
@@ -493,7 +494,7 @@ public class ImportExcel {
* @param cls 导入对象类型
* @param groups 导入分组
*/
public <E> List<E> getDataList(Class<E> cls,Properties props,FunctionRegionDict regionDict, int... groups) throws InstantiationException, IllegalAccessException{
public <E> List<E> getDataList(Class<E> cls,Properties props,FunctionRegionDict regionDict,FunctionServiceDict serviceDict, int... groups) throws InstantiationException, IllegalAccessException{
if(regionDict==null) {
throw new RuntimeException("regionDict is null!");
}
@@ -535,12 +536,16 @@ public class ImportExcel {
//协议方向等,如果只有一个值,就 不需要输入了
String direction=regionDict.getConfigDirection();
if(StringUtils.isNotBlank(direction)&&direction.indexOf(",")>-1) {
districtShow=true;
directionShow=true;
}
String protocol=regionDict.getConfigProtocol();
if(StringUtils.isNotBlank(protocol)&&protocol.indexOf(",")>-1) {
protocolShow=true;
}
//packet ip reject
if(regionDict.getFunctionId().equals(5)&&serviceDict!=null&&serviceDict.getServiceId().equals(16)) {
protocolShow=false;
}
}else if(regionType==2||regionType==3){
String matchMethod= regionDict.getConfigMatchMethod();
if(StringUtils.isNotBlank(matchMethod)&&matchMethod.indexOf(",")>-1) {

View File

@@ -1886,11 +1886,18 @@ public class BaseController {
boolean validPort = this.validPort(errInfo, baseIpCfg.getSrcPort(), baseIpCfg.getDestPort(),
portPattern);
if (StringUtil.isEmpty(baseIpCfg.getProtocol())) {
//packet ip reject
if(regionDict.getFunctionId().equals(5)&&serviceDict!=null&&serviceDict.getServiceId().equals(16)) {
baseIpCfg.setProtocol(6);
}else {
if (StringUtil.isEmpty(regionDict.getConfigProtocol())) {
baseIpCfg.setProtocol(0);
} else {
baseIpCfg.setProtocol(Integer.parseInt(regionDict.getConfigProtocol().split(",")[0]));
}
}
baseIpCfg.setProtocolId(serviceDict==null?0:serviceDict.getProtocolId());
} else {
baseIpCfg.setProtocol(baseIpCfg.getProtocol());
@@ -3230,61 +3237,61 @@ public class BaseController {
if (regionDict.getFunctionId().equals(5)) {
if (serviceDict!=null&&serviceDict.getAction().equals(64)) {
List<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class,
this.getMsgProp(),regionDict);
this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
} else {
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class, this.getMsgProp(),regionDict);
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class, this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
}
} else if (regionDict.getFunctionId().equals(7)&&serviceDict!=null&&serviceDict.getAction().intValue()==16) {
List<DnsIpTemplate> list = ei.getDataList(DnsIpTemplate.class, this.getMsgProp(),regionDict);
List<DnsIpTemplate> list = ei.getDataList(DnsIpTemplate.class, this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
}else if(regionDict.getFunctionId().equals(401)) {
List<DnsIpTemplate> list = ei.getDataList(DnsIpTemplate.class, this.getMsgProp(),regionDict);
List<DnsIpTemplate> list = ei.getDataList(DnsIpTemplate.class, this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
}else if (regionDict.getFunctionId().equals(212)) {
List<IpPayloadTemplate> list = ei.getDataList(IpPayloadTemplate.class, this.getMsgProp(),regionDict);
List<IpPayloadTemplate> list = ei.getDataList(IpPayloadTemplate.class, this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
} else if (regionDict.getFunctionId().equals(510)
&& "p2p_ip".equals(regionDict.getConfigServiceType())) { // P2p IP
List<P2pIpTemplate> list = ei.getDataList(P2pIpTemplate.class, this.getMsgProp(),regionDict);
List<P2pIpTemplate> list = ei.getDataList(P2pIpTemplate.class, this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
} else if (regionDict.getFunctionId().equals(600)) {// ANS IP
List<AsnIpTemplate> list = ei.getDataList(AsnIpTemplate.class, this.getMsgProp(),regionDict);
List<AsnIpTemplate> list = ei.getDataList(AsnIpTemplate.class, this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
} else if (regionDict.getFunctionId().equals(301)) {// ANS IP
List<DdosIpTemplate> list = ei.getDataList(DdosIpTemplate.class, this.getMsgProp(),regionDict);
List<DdosIpTemplate> list = ei.getDataList(DdosIpTemplate.class, this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
} else {
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class, this.getMsgProp(),regionDict);
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class, this.getMsgProp(),regionDict,serviceDict);
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
}
} else if (regionDict.getRegionType().equals(2)) {// 字符串类
if (regionDict.getFunctionId().equals(510)
&& "p2p_hash".equals(regionDict.getConfigServiceType())) { // P2p hash
List<P2pHashStringTemplate> list = ei.getDataList(P2pHashStringTemplate.class,
this.getMsgProp(),regionDict);
this.getMsgProp(),regionDict,serviceDict);
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
} else {
List<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class, this.getMsgProp(),regionDict);
List<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class, this.getMsgProp(),regionDict,serviceDict);
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
}
} else if (regionDict.getRegionType().equals(3)) {// 增强字符串类
if (regionDict.getFunctionId().equals(7)&&serviceDict!=null&&serviceDict.getAction().intValue()==16) {
List<DnsComplexStringTemplate> list = ei.getDataList(DnsComplexStringTemplate.class,
this.getMsgProp(),regionDict);
this.getMsgProp(),regionDict,serviceDict);
complexkeywordCfgs = this.checkComplexStringCfg(serviceDict, regionDict, list);
} else {
List<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class,
this.getMsgProp(),regionDict);
this.getMsgProp(),regionDict,serviceDict);
complexkeywordCfgs = this.checkComplexStringCfg(serviceDict, regionDict, list);
}
}else if (regionDict.getRegionType().equals(6)) {// 回调类
if (regionDict.getFunctionId().equals(400)) {
List<DnsResStrategyTemplate> list = ei.getDataList(DnsResStrategyTemplate.class,
this.getMsgProp(),regionDict);
this.getMsgProp(),regionDict,serviceDict);
dnsResStrategies = this.checkDnsResStrategyCfg(serviceDict, regionDict, list);
}
}