[qca-nss-ecm] l2tpv2 support for ipv6

ipv6 support is only for encapsulated packet. Only ipv4 is supported
for outer rule

Change-Id: I5e3c084a9c04dab867740eddad63f7e07313f80b
Signed-off-by: ratheesh kannoth <rkannoth@codeaurora.org>
diff --git a/frontends/nss/ecm_nss_ipv6.c b/frontends/nss/ecm_nss_ipv6.c
index 59eec83..1c4ef5e 100644
--- a/frontends/nss/ecm_nss_ipv6.c
+++ b/frontends/nss/ecm_nss_ipv6.c
@@ -195,6 +195,9 @@
 	int i;
 	bool done;
 	uint8_t node_addr[ETH_ALEN];
+#ifdef ECM_INTERFACE_L2TPV2_ENABLE
+	ip_addr_t remote_ip;
+#endif
 
 	DEBUG_INFO("Establish node for " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(addr));
 
@@ -222,6 +225,9 @@
 #ifdef ECM_INTERFACE_PPPOE_ENABLE
 		struct ecm_db_interface_info_pppoe pppoe_info;
 #endif
+#ifdef ECM_INTERFACE_L2TPV2_ENABLE
+		struct ecm_db_interface_info_pppol2tpv2 pppol2tpv2_info;
+#endif
 		type = ecm_db_connection_iface_type_get(interface_list[i]);
 		DEBUG_INFO("Lookup node address, interface @ %d is type: %d\n", i, type);
 
@@ -246,6 +252,20 @@
 			done = true;
 			break;
 
+		case ECM_DB_IFACE_TYPE_PPPOL2TPV2:
+#ifdef ECM_INTERFACE_L2TPV2_ENABLE
+			ecm_db_iface_pppol2tpv2_session_info_get(interface_list[i], &pppol2tpv2_info);
+			ECM_HIN4_ADDR_TO_IP_ADDR(remote_ip, pppol2tpv2_info.ip.daddr);
+			if (unlikely(!ecm_interface_mac_addr_get(remote_ip, node_addr, &on_link, gw_addr))) {
+				DEBUG_TRACE("Failed to obtain mac for host " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(addr));
+				return NULL;
+			}
+			done = true;
+			break;
+#else
+			DEBUG_TRACE("PPPoL2TPV2 interface unsupported\n");
+			return NULL;
+#endif
 		case ECM_DB_IFACE_TYPE_VLAN:
 #ifdef ECM_INTERFACE_VLAN_ENABLE
 			/*
@@ -1037,6 +1057,14 @@
 #endif
 
 #ifdef ECM_INTERFACE_PPP_ENABLE
+#ifdef ECM_INTERFACE_L2TPV2_ENABLE
+	/*
+	 * skip l2tpv3/pptp because we don't accelerate them
+	 */
+	if (ecm_interface_skip_l2tpv3_pptp(skb, out)) {
+		return NF_ACCEPT;
+	}
+#else
 	/*
 	 * skip l2tp/pptp because we don't accelerate them
 	 */
@@ -1044,6 +1072,7 @@
 		return NF_ACCEPT;
 	}
 #endif
+#endif
 
 	/*
 	 * Identify interface from where this packet came
@@ -1705,7 +1734,6 @@
 	queue_delayed_work(ecm_nss_ipv6_workqueue, &ecm_nss_ipv6_work, ECM_NSS_IPV6_STATS_SYNC_PERIOD);
 }
 
-
 /*
  * struct nf_hook_ops ecm_nss_ipv6_netfilter_hooks[]
  *	Hooks into netfilter packet monitoring points.