mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
fix CLOUDSTACK-2930, exception while applying ACL rule with protocol as ALL.
1) change UI, disable startport and endport when protocol=All 2) validate parameters for API createNetworkACL
This commit is contained in:
parent
18163eaa4d
commit
5e56e43e31
@ -294,6 +294,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
|
||||
throw new InvalidParameterValueException("Start port can't be bigger than end port");
|
||||
}
|
||||
|
||||
// start port and end port must be null for protocol = 'all'
|
||||
if ((portStart != null || portEnd != null ) && protocol != null && protocol.equalsIgnoreCase("all"))
|
||||
throw new InvalidParameterValueException("start port and end port must be null if protocol = 'all'");
|
||||
|
||||
if (sourceCidrList != null) {
|
||||
for (String cidr: sourceCidrList){
|
||||
if (!NetUtils.isValidCIDR(cidr)){
|
||||
|
||||
@ -97,6 +97,13 @@
|
||||
name != 'icmpcode' &&
|
||||
name != 'cidrlist';
|
||||
});
|
||||
var $portFields = $inputs.filter(function() {
|
||||
var name = $(this).attr('name');
|
||||
return $.inArray(name, [
|
||||
'startport',
|
||||
'endport'
|
||||
]) > -1;
|
||||
});
|
||||
|
||||
var $protocolinput = args.$form.find('td input');
|
||||
var $protocolFields = $protocolinput.filter(function(){
|
||||
@ -124,6 +131,10 @@
|
||||
$icmpFields.hide();
|
||||
$icmpFields.parent().find('label.error').hide();
|
||||
$protocolFields.hide().removeClass('required');
|
||||
if ($(this).val() == 'all'){
|
||||
$portFields.attr('disabled', 'disabled');
|
||||
$portFields.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -216,11 +227,11 @@
|
||||
|
||||
|
||||
|
||||
if((args.data.protocol == 'tcp' || args.data.protocol == 'udp' || args.data.protocol == 'all') && (args.data.startport=="" || args.data.startport == undefined)){
|
||||
if((args.data.protocol == 'tcp' || args.data.protocol == 'udp') && (args.data.startport=="" || args.data.startport == undefined)){
|
||||
cloudStack.dialog.notice({message:_l('Start Port or End Port value should not be blank')});
|
||||
$(window).trigger('cloudStack.fullRefresh');
|
||||
}
|
||||
else if((args.data.protocol == 'tcp' || args.data.protocol == 'udp' || args.data.protocol == 'all') && (args.data.endport=="" || args.data.endport == undefined)){
|
||||
else if((args.data.protocol == 'tcp' || args.data.protocol == 'udp') && (args.data.endport=="" || args.data.endport == undefined)){
|
||||
cloudStack.dialog.notice({message:_l('Start Port or End Port value should not be blank')});
|
||||
$(window).trigger('cloudStack.fullRefresh');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user