[qca-nss-ecm] Skip multicast over pppoe
Skip mutlicast over pppoe packets
Change-Id: I9a33f19a8d7fbefe554d559c94f6a143f278b787
Signed-off-by: ratheesh kannoth <rkannoth@codeaurora.org>
diff --git a/ecm_interface.c b/ecm_interface.c
index febaf46..e5018f8 100644
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -765,7 +765,10 @@
for (i = 0; i < max_if; i++) {
br_dev = dev_get_by_index(&init_net, dest_if[i]);
if (!br_dev) {
- DEBUG_ASSERT(NULL, "expected only valid netdev here\n");
+ /*
+ * Interface got deleted; but is yet to be updated in MFC table
+ */
+ DEBUG_WARN("Could not find a valid netdev here\n");
continue;
}
@@ -780,6 +783,39 @@
EXPORT_SYMBOL(ecm_interface_multicast_check_for_br_dev);
/*
+ * ecm_interface_multicast_is_iface_type()
+ * Checks if interface of type exist in mc_if_index
+ */
+bool ecm_interface_multicast_is_iface_type(int32_t mc_if_index[], int32_t max_if_index, unsigned short type)
+{
+ int32_t i;
+ struct net_device *dev;
+
+ for (i = 0; i < max_if_index; i++) {
+
+ if (!mc_if_index[i]) {
+ break;
+ }
+
+ dev = dev_get_by_index(&init_net, mc_if_index[i]);
+ if (!dev) {
+ DEBUG_WARN("Could not find a valid interface with index = %d\n", mc_if_index[i]);
+ continue;
+ }
+
+ if (dev->type == type) {
+ DEBUG_TRACE("Interface dev = %s of type %u\n", dev->name, type);
+ dev_put(dev);
+ return true;
+ }
+
+ dev_put(dev);
+ }
+
+ return false;
+}
+
+/*
* ecm_interface_multicast_check_for_src_if_index()
* Find if a source netdev ifindex is matching with list of
* multicast destination netdev ifindex. If find a match then
diff --git a/ecm_interface.h b/ecm_interface.h
index cd51ddd..3439492 100644
--- a/ecm_interface.h
+++ b/ecm_interface.h
@@ -76,6 +76,7 @@
bool ecm_interface_multicast_find_updates_to_iface_list(struct ecm_db_connection_instance *ci, struct ecm_multicast_if_update *, uint32_t flags, bool is_br_snooper, uint32_t *dst_dev, uint32_t max_to_dev);
bool ecm_interface_multicast_check_for_br_dev(uint32_t dest_if[], uint8_t max_if);
+bool ecm_interface_multicast_is_iface_type(int32_t mc_if_index[], int32_t max_if_index, unsigned short type);
int32_t ecm_interface_multicast_check_for_src_ifindex(int32_t mc_if_index[], int32_t max_if_index, int32_t if_num);
int32_t ecm_interface_multicast_from_heirarchy_construct(struct ecm_front_end_connection_instance *feci,
diff --git a/frontends/nss/ecm_nss_multicast_ipv4.c b/frontends/nss/ecm_nss_multicast_ipv4.c
index 595950d..f6c069f 100644
--- a/frontends/nss/ecm_nss_multicast_ipv4.c
+++ b/frontends/nss/ecm_nss_multicast_ipv4.c
@@ -2434,9 +2434,9 @@
* Return if source dev is any tunnel type
* TODO: Add support for multicast over tunnels
*/
- if (in_dev->type == ECM_ARPHRD_IPSEC_TUNNEL_TYPE ||
- in_dev->type == ARPHRD_SIT ||
- in_dev->type == ARPHRD_TUNNEL6) {
+ if ((in_dev->type == ECM_ARPHRD_IPSEC_TUNNEL_TYPE) ||
+ (in_dev->type == ARPHRD_SIT) || (in_dev->type == ARPHRD_PPP) ||
+ (in_dev->type == ARPHRD_TUNNEL6)) {
DEBUG_TRACE("Net device: %p is TUNNEL type: %d\n", in_dev, in_dev->type);
return NF_ACCEPT;
}
@@ -2476,6 +2476,15 @@
*/
memset(dst_dev, 0, sizeof(dst_dev));
if_cnt = ipmr_find_mfc_entry(&init_net, ip_src, ip_grp, ECM_DB_MULTICAST_IF_MAX, dst_dev);
+
+ /*
+ * Skip PPP acceleration
+ */
+ if (ecm_interface_multicast_is_iface_type(dst_dev, if_cnt, ARPHRD_PPP)) {
+ DEBUG_TRACE("%p: Packet is of type PPP; skip it\n", skb);
+ return NF_ACCEPT;
+ }
+
if (is_routed) {
/*
* This is a routed flow, hence look for a valid MFC rule
diff --git a/frontends/nss/ecm_nss_multicast_ipv6.c b/frontends/nss/ecm_nss_multicast_ipv6.c
index cb0176e..98d9995 100644
--- a/frontends/nss/ecm_nss_multicast_ipv6.c
+++ b/frontends/nss/ecm_nss_multicast_ipv6.c
@@ -2337,9 +2337,9 @@
/*
* Return if source dev is any tunnel type
*/
- if (in_dev->type == ECM_ARPHRD_IPSEC_TUNNEL_TYPE ||
- in_dev->type == ARPHRD_SIT ||
- in_dev->type == ARPHRD_TUNNEL6) {
+ if ((in_dev->type == ECM_ARPHRD_IPSEC_TUNNEL_TYPE) ||
+ (in_dev->type == ARPHRD_SIT) || (in_dev->type == ARPHRD_PPP) ||
+ (in_dev->type == ARPHRD_TUNNEL6)) {
DEBUG_TRACE("Net device: %p is TUNNEL type: %d\n", in_dev, in_dev->type);
return NF_ACCEPT;
}
@@ -2375,6 +2375,14 @@
mc_if_cnt = ip6mr_find_mfc_entry(&init_net, &origin6, &group6, ECM_DB_MULTICAST_IF_MAX, mc_dest_if);
+ /*
+ * Skip PPP interface
+ */
+ if (ecm_interface_multicast_is_iface_type(mc_dest_if, mc_if_cnt, ARPHRD_PPP)) {
+ DEBUG_TRACE("%p: Packet is of type PPP; skip it\n", skb);
+ return NF_ACCEPT;
+ }
+
if (is_routed) {
/*
* This is a routed flow, hence look for a valid MFC rule