From 5d161042d05d40bbbd6e241f029a82abd7bfa54e Mon Sep 17 00:00:00 2001
From: "Mutalik Desai, Suprasad" <suprasad.desai@intel.com>
Date: Wed, 14 Feb 2018 11:11:18 +0100
Subject: [PATCH] Merge pull request #242 in SW_PON/linux from
 UGW_SW-20774-9710-11-12-multicast-porting-to-linux4.9 to xrx500

UGW_SW-20774-9710-11-12-multicast-porting-to-linux4.9

* commit 'a62ee6fdd766c0f68403b92a834da8c3ce583b45':
  UGW_SW-20774: Changes requred to Build Multicast without ACL Support
---
 net/mcast_helper/mcast_helper.c | 53 ++++++++++++++++++++-------------
 1 file changed, 32 insertions(+), 21 deletions(-)

diff --git a/net/mcast_helper/mcast_helper.c b/net/mcast_helper/mcast_helper.c
index 386dea5a4..6241f0713 100644
--- a/net/mcast_helper/mcast_helper.c
+++ b/net/mcast_helper/mcast_helper.c
@@ -110,8 +110,12 @@ static char mch_signature[] = "mcast1234";
 int mch_timerstarted;
 int mch_timermod;
 int mch_iptype;
-int mch_acl_enabled ;
+int mch_acl_enabled = 0;
 int mch_accl_enabled = 1;
+#ifdef CONFIG_MCAST_HELPER_ACL
+mch_acl_enabled	= 1;
+#endif
+
 
 #ifdef CONFIG_SYSCTL
 static struct ctl_table_header *mcast_acl_sysctl_header;
@@ -679,8 +683,10 @@ static MCAST_GIMC_t *mcast_helper_add_gimc_record(struct net_device *netdev,
 
 	gimc_rec->grpIdx = grpidx;
 	gimc_rec->br_callback_flag = 0;
+#ifdef CONFIG_MCAST_HELPER_ACL
 	gimc_rec->oifbitmap = 0;
 	gimc_rec->probeFlag = 0;
+#endif
 
 
 	INIT_LIST_HEAD(&gimc_rec->list);
@@ -796,8 +802,11 @@ static MCAST_MEMBER_t *mcast_helper_add_gitxmc_record(unsigned int grpidx,
 					return NULL;
 				}
 
-				if (mch_acl_enabled)
+				if (mch_acl_enabled) {
+#ifdef CONFIG_MCAST_HELPER_ACL
 					gitxmc_rec->aclBlocked = 0;
+#endif
+				}
 				INIT_LIST_HEAD(&gitxmc_rec->list);
 				list_add_tail(&gitxmc_rec->list, &gimc_rec->mc_mem_list);
 
@@ -1299,12 +1308,16 @@ static int mcast_helper_update_entry(struct net_device *netdev, struct net_devic
 
 		/*Send the Skb probe packet on interfaces */
 		if (gimc_rec->mc_stream.sIP.ipType == IPV6) {
+#ifdef CONFIG_MCAST_HELPER_ACL
 			gimc_rec->probeFlag = 1;
+#endif
 			mch_iptype = IPV6;
 			mcast_helper_acl_probe_pckt_send6(gimc_rec->mc_stream.rxDev, netdev, gimc_rec->grpIdx, &(gimc_rec->mc_stream.dIP), &(gimc_rec->mc_stream.sIP), gimc_rec->mc_stream.proto, gimc_rec->mc_stream.sPort, gimc_rec->mc_stream.dPort);
 
 		} else {
+#ifdef CONFIG_MCAST_HELPER_ACL
 			gimc_rec->probeFlag = 1;
+#endif
 			mch_iptype = IPV4;
 			ret = mcast_helper_acl_probe_pckt_send(gimc_rec->mc_stream.rxDev, netdev, gimc_rec->grpIdx, &(gimc_rec->mc_stream.dIP), &(gimc_rec->mc_stream.sIP), gimc_rec->mc_stream.proto, gimc_rec->mc_stream.sPort, gimc_rec->mc_stream.dPort);
 			if (ret == 0)
@@ -1373,12 +1386,17 @@ static int mcast_helper_add_entry(struct net_device *netdev, struct net_device *
 
 				/*Send the Skb probe packet on interfaces */
 				if (gimc_rec->mc_stream.sIP.ipType == IPV6) {
+#ifdef CONFIG_MCAST_HELPER_ACL
 					gimc_rec->probeFlag = 1;
+#endif
 					mch_iptype = IPV6;
 					mcast_helper_acl_probe_pckt_send6(gimc_rec->mc_stream.rxDev, netdev, gimc_rec->grpIdx, &(gimc_rec->mc_stream.dIP), &(gimc_rec->mc_stream.sIP), gimc_rec->mc_stream.proto, gimc_rec->mc_stream.sPort, gimc_rec->mc_stream.dPort);
 
 				} else {
+
+#ifdef CONFIG_MCAST_HELPER_ACL
 					gimc_rec->probeFlag = 1;
+#endif
 					mch_iptype = IPV4;
 					ret = mcast_helper_acl_probe_pckt_send(gimc_rec->mc_stream.rxDev, netdev, gimc_rec->grpIdx, &(gimc_rec->mc_stream.dIP), &(gimc_rec->mc_stream.sIP), gimc_rec->mc_stream.proto, gimc_rec->mc_stream.sPort, gimc_rec->mc_stream.dPort);
 					if (ret == 0)
@@ -1417,10 +1435,12 @@ static int mcast_helper_delete_entry(struct net_device *netdev, struct net_devic
 
 	if (gimc_rec->mc_stream.sIP.ipType == IPV4) {
 		if (mch_acl_enabled) {
+#ifdef CONFIG_MCAST_HELPER_ACL
 			if (gitxmc_rec->aclBlocked != 1) {
 				memcpy(gimc_rec->mc_stream.macaddr, mc_mem->macaddr, sizeof(char)*ETH_ALEN);
 				mcast_helper_invoke_return_callback(gimc_rec->grpIdx, netdev, (MCAST_STREAM_t *)&(gimc_rec->mc_stream), MC_F_DEL, gitxmc_rec->macaddr_count);
 			}
+#endif
 		} else {
 			memcpy(gimc_rec->mc_stream.macaddr, mc_mem->macaddr, sizeof(char)*ETH_ALEN);
 			mcast_helper_invoke_return_callback(gimc_rec->grpIdx, netdev, (MCAST_STREAM_t *)&(gimc_rec->mc_stream), MC_F_DEL, gitxmc_rec->macaddr_count);
@@ -1608,15 +1628,6 @@ int mcast_helper_seq_show(struct seq_file *seq, void *v)
 					if (gitxmc_rec) {
 						list_for_each_safe(gliter_mac, iter_mac, &gitxmc_rec->macaddr_list) {
 							mac_rec = list_entry(gliter_mac, MCAST_MAC_t, list);
-							if (mac_rec) {
-								seq_printf(seq, "%8s(%02x:%02x:%02x:%02x:%02x:%02x)(%d)", gitxmc_rec->memDev->name, mac_rec->macaddr[0],
-										mac_rec->macaddr[1],
-										mac_rec->macaddr[2],
-										mac_rec->macaddr[3],
-										mac_rec->macaddr[4],
-										mac_rec->macaddr[5],
-										gitxmc_rec->aclBlocked);
-							}
 						}
 					}
 				}
@@ -1712,16 +1723,6 @@ int mcast_helper_seq_show6(struct seq_file *seq, void *v)
 					if (gitxmc_rec) {
 						list_for_each_safe(gliter_mac, iter_mac, &gitxmc_rec->macaddr_list) {
 							mac_rec = list_entry(gliter_mac, MCAST_MAC_t, list);
-							if (mac_rec) {
-								seq_printf(seq, "%8s(%02x:%02x:%02x:%02x:%02x:%02x)(%d)", gitxmc_rec->memDev->name,
-										mac_rec->macaddr[0],
-										mac_rec->macaddr[1],
-										mac_rec->macaddr[2],
-										mac_rec->macaddr[3],
-										mac_rec->macaddr[4],
-										mac_rec->macaddr[5],
-										gitxmc_rec->aclBlocked);
-							}
 						}
 					}
 				}
@@ -2038,7 +2039,9 @@ int mcast_helper_sig_check_update_ip(struct sk_buff *skb)
 				/*update the GIMcTx table to add the new interface into the list */
 				gitxmc_rec = mcast_helper_search_gitxmc_record(gimc_rec->grpIdx, skb->dev, &gimc_rec->mc_mem_list);
 				if (gitxmc_rec != NULL) {
+#ifdef CONFIG_MCAST_HELPER_ACL
 					gitxmc_rec->aclBlocked = 0;
+#endif
 					list_for_each_safe(liter, tliter, &gitxmc_rec->macaddr_list) {
 						mac_rec = list_entry(liter, MCAST_MAC_t, list);
 						if (mac_rec) {
@@ -2051,7 +2054,9 @@ int mcast_helper_sig_check_update_ip(struct sk_buff *skb)
 
 			}
 			/*update the oifindex bitmap to be used for evaluating after timer expires */
+#ifdef CONFIG_MCAST_HELPER_ACL
 			gimc_rec->oifbitmap |= 1 << skb->dev->ifindex;
+#endif
 		}
 
 		return 1;
@@ -2095,7 +2100,9 @@ int mcast_helper_sig_check_update_ip6(struct sk_buff *skb)
 			/*update the GIMcTx table to add the new interface into the list */
 			gitxmc_rec = mcast_helper_search_gitxmc_record(gimc_rec->grpIdx, skb->dev, &gimc_rec->mc_mem_list);
 			if (gitxmc_rec != NULL) {
+#ifdef CONFIG_MCAST_HELPER_ACL
 				gitxmc_rec->aclBlocked = 0;
+#endif
 				list_for_each_safe(liter, tliter, &gitxmc_rec->macaddr_list) {
 					mac_rec = list_entry(liter, MCAST_MAC_t, list);
 					if (mac_rec) {
@@ -2107,7 +2114,9 @@ int mcast_helper_sig_check_update_ip6(struct sk_buff *skb)
 
 		}
 		/*update the oifindex bitmap to be used for evaluating after timer expires */
+#ifdef CONFIG_MCAST_HELPER_ACL
 		gimc_rec->oifbitmap |= 1 << skb->dev->ifindex;
+#endif
 	}
 
 	return 1;
@@ -2154,6 +2163,7 @@ EXPORT_SYMBOL(mcast_helper_sig_check_update);
 
 static void mcast_helper_timer_handler(unsigned long data)
 {
+#ifdef CONFIG_MCAST_HELPER_ACL
 	struct list_head *liter = NULL;
 	struct list_head *gliter = NULL;
 	struct list_head *tliter = NULL;
@@ -2230,6 +2240,7 @@ static void mcast_helper_timer_handler(unsigned long data)
 
 	mch_iptype = 0;
 	mch_timerstarted = 0;
+#endif
 }
 
 
-- 
GitLab