+
+
+ /**
+ * Programs broadcast rules.
+ *
+ * @param port the Acl Interface port
+ * @param addOrRemove whether to delete or add flow
+ */
+ @Override
+ protected void programBroadcastRules(AclInterface port, int addOrRemove) {
+ programIpv4BroadcastRule(port, addOrRemove);
+ }
+
+ /**
+ * Programs IPv4 broadcast rules.
+ *
+ * @param port the Acl Interface port
+ * @param addOrRemove whether to delete or add flow
+ */
+ private void programIpv4BroadcastRule(AclInterface port, int addOrRemove) {
+ BigInteger dpId = port.getDpId();
+ int lportTag = port.getLPortTag();
+ MatchInfoBase lportMatchInfo = buildLPortTagMatch(lportTag);
+ List<IpPrefixOrAddress> cidrs = port.getSubnetIpPrefixes();
+ if (cidrs != null) {
+ List<String> broadcastAddresses = AclServiceUtils.getIpBroadcastAddresses(cidrs);
+ for (String broadcastAddress : broadcastAddresses) {
+ List<MatchInfoBase> matches =
+ AclServiceUtils.buildBroadcastIpV4Matches(broadcastAddress);
+ matches.add(lportMatchInfo);
+ List<InstructionInfo> instructions = new ArrayList<>();
+ instructions.add(new InstructionGotoTable(NwConstants.EGRESS_ACL_REMOTE_ACL_TABLE));
+ String flowName = "Ingress_v4_Broadcast_" + dpId + "_" + lportTag + "_" + broadcastAddress + "_Permit";
+ syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE, flowName,
+ AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, matches,
+ instructions, addOrRemove);
+ }
+ } else {
+ LOG.error("IP Broadcast CIDRs are missing for port {}", port.getInterfaceId());
+ }
+ }
+
+ protected MatchInfoBase buildLPortTagMatch(int lportTag) {
+ return AclServiceUtils.buildLPortTagMatch(lportTag, ServiceModeIngress.class);
+ }