mirror of https://github.com/apache/cloudstack.git
Port ranges for PF rules: public port start should be equal to ending port start; the same applies to end ports
This commit is contained in:
parent
2392f655b0
commit
aa8048aa04
|
|
@ -66,7 +66,6 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
|
|||
@Parameter(name = ApiConstants.PRIVATE_END_PORT, type = CommandType.INTEGER, required = false, description = "the ending port of port forwarding rule's private port range")
|
||||
private Integer privateEndPort;
|
||||
|
||||
|
||||
@Parameter(name = ApiConstants.PUBLIC_START_PORT, type = CommandType.INTEGER, required = true,
|
||||
description = "the starting port of port forwarding rule's public port range")
|
||||
private Integer publicStartPort;
|
||||
|
|
|
|||
|
|
@ -244,6 +244,15 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||
} else {
|
||||
dstIp = new Ip(guestNic.getIp4Address());
|
||||
}
|
||||
|
||||
//source start port and source dest port should be the same. The same applies to dest ports
|
||||
if (rule.getSourcePortStart().intValue() != rule.getDestinationPortStart()) {
|
||||
throw new InvalidParameterValueException("Private port start should be equal to public port start", null);
|
||||
}
|
||||
|
||||
if (rule.getSourcePortEnd().intValue() != rule.getDestinationPortEnd()) {
|
||||
throw new InvalidParameterValueException("Private port end should be equal to public port end", null);
|
||||
}
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
|
|
|||
Loading…
Reference in New Issue