harikrishna-patnala commented on code in PR #12706:
URL: https://github.com/apache/cloudstack/pull/12706#discussion_r3233253399


##########
server/src/main/java/com/cloud/network/firewall/FirewallManagerImpl.java:
##########
@@ -198,25 +198,62 @@ public FirewallRule createEgressFirewallRule(FirewallRule 
rule) throws NetworkRu
         if (sourceCidrs != null && !sourceCidrs.isEmpty())
         Collections.replaceAll(sourceCidrs, "0.0.0.0/0", network.getCidr());
 
-        return createFirewallRule(null, caller, rule.getXid(), 
rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getProtocol(), 
sourceCidrs, rule.getDestinationCidrList(),
-                rule.getIcmpCode(), rule.getIcmpType(), null, rule.getType(), 
rule.getNetworkId(), rule.getTrafficType(), rule.isDisplay());
+        return createFirewallRuleForNonVPC(null, caller, rule.getXid(), 
rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getProtocol(), 
sourceCidrs,
+                rule.getDestinationCidrList(), rule.getIcmpCode(), 
rule.getIcmpType(), null, rule.getType(), rule.getNetworkId(), 
rule.getTrafficType(), rule.isDisplay());
     }
 
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_FIREWALL_OPEN, eventDescription 
= "creating firewall rule", create = true)
     public FirewallRule createIngressFirewallRule(FirewallRule rule) throws 
NetworkRuleConflictException {
-         Account caller = CallContext.current().getCallingAccount();
+        Account caller = CallContext.current().getCallingAccount();
         Long sourceIpAddressId = rule.getSourceIpAddressId();
+        IPAddressVO sourceIp = getSourceIpForIngressRule(sourceIpAddressId);
+
+        if (sourceIp.getVpcId() != null) {

Review Comment:
   Existing calls of createIngressFirewallRule will not cause NPE, but I will 
fix it, thanks for pointing @sudo87 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to