Merge "IPANAT: fix for loop issue"
diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h
index d537790..0daf100 100644
--- a/ipacm/inc/IPACM_Defs.h
+++ b/ipacm/inc/IPACM_Defs.h
@@ -67,7 +67,7 @@
 
 #define IPA_MAX_IFACE_ENTRIES 15
 #define IPA_MAX_PRIVATE_SUBNET_ENTRIES 3
-#define IPA_MAX_ALG_ENTRIES 10
+#define IPA_MAX_ALG_ENTRIES 20
 #define IPA_MAX_RM_ENTRY 6
 
 #define V4_DEFAULT_ROUTE_TABLE_NAME  "ipa_dflt_rt"
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index db827e4..65dcca8 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -91,6 +91,7 @@
 	num_ipv6_dest_flt_rule = 0;
 	memset(ipv6_dest_flt_rule_hdl, 0, MAX_DEFAULT_v6_ROUTE_RULES*sizeof(uint32_t));
 	memset(ipv6_prefix, 0, sizeof(ipv6_prefix));
+	ext_prop = NULL;
 
 	if(m_is_sta_mode == Q6_WAN)
 	{
@@ -808,6 +809,20 @@
 	{
 		IPACM_Wan::backhaul_is_sta_mode	= false;
 		IPACMDBG_H("reset backhaul to LTE \n");
+
+		if (iface_query != NULL && iface_query->num_ext_props > 0)
+		{
+			if(ext_prop == NULL)
+			{
+				IPACMERR("Extended property is empty.\n");
+				return IPACM_FAILURE;
+			}
+			else
+			{
+				IPACM_Iface::ipacmcfg->SetQmapId(ext_prop->ext[0].mux_id);
+				IPACMDBG_H("Setting up QMAP ID %d.\n", ext_prop->ext[0].mux_id);
+			}
+		}
 	}
 
     for (cnt=0; cnt<tx_prop->num_tx_props; cnt++)
@@ -2712,13 +2727,11 @@
 							 cnt, ext_prop->ext[cnt].ip, ext_prop->ext[cnt].mux_id, ext_prop->ext[cnt].action, ext_prop->ext[cnt].rt_tbl_idx, ext_prop->ext[cnt].filter_hdl);
 		}
 
-		IPACM_Iface::ipacmcfg->SetQmapId(ext_prop->ext[0].mux_id);
 		if(IPACM_Wan::is_ext_prop_set == false)
 		{
 			IPACM_Iface::ipacmcfg->SetExtProp(ext_prop);
 			IPACM_Wan::is_ext_prop_set = true;
 		}
-		free(ext_prop);
 		close(fd);
 	}
 	return IPACM_SUCCESS;
@@ -3642,6 +3655,10 @@
 	{
 		free(rx_prop);
 	}
+	if (ext_prop != NULL)
+	{
+		free(ext_prop);
+	}
 	if (iface_query != NULL)
 	{
 		free(iface_query);
diff --git a/ipacm/src/IPACM_cfg.xml b/ipacm/src/IPACM_cfg.xml
index 95aad5a..7a7de58 100644
--- a/ipacm/src/IPACM_cfg.xml
+++ b/ipacm/src/IPACM_cfg.xml
@@ -69,30 +69,76 @@
 			<ALG>
   			   <Protocol>TCP</Protocol>
   			   <Port>21</Port>
-		    </ALG>		
+			   <Description>FTP</Description>
+		    </ALG>
 			<ALG>
   			   <Protocol>TCP</Protocol>
   			   <Port>554</Port>
-		    </ALG>		
-		<ALG>
+			   <Description>RTSP</Description>
+		    </ALG>
+			<ALG>
   			   <Protocol>TCP</Protocol>
   			   <Port>5060</Port>
-		    </ALG>		
+			   <Description>SIP</Description>
+		    </ALG>
 			<ALG>
   			   <Protocol>UDP</Protocol>
   			   <Port>5060</Port>
-		    </ALG>		
+			   <Description>SIP</Description>
+		    </ALG>
 			<ALG>
   			   <Protocol>TCP</Protocol>
   			   <Port>1723</Port>
-		    </ALG>		
+			   <Description>PPTP</Description>
+		    </ALG>
 			<ALG>
   			   <Protocol>UDP</Protocol>
   			   <Port>69</Port>
-		    </ALG>		
+			   <Description>TFTP</Description>
+		    </ALG>
+			<ALG>
+  			   <Protocol>UDP</Protocol>
+  			   <Port>53</Port>
+			   <Description>DNS</Description>
+		    </ALG>
+			<ALG>
+  			   <Protocol>TCP</Protocol>
+  			   <Port>53</Port>
+			   <Description>DNS</Description>
+		    </ALG>
+			<ALG>
+  			   <Protocol>UDP</Protocol>
+  			   <Port>10080</Port>
+			   <Description>AMANDA</Description>
+		    </ALG>
+			<ALG>
+  			   <Protocol>UDP</Protocol>
+  			   <Port>1719</Port>
+			   <Description>H323</Description>
+		    </ALG>
+			<ALG>
+  			   <Protocol>TCP</Protocol>
+  			   <Port>1720</Port>
+			   <Description>H323</Description>
+		    </ALG>
+			<ALG>
+  			   <Protocol>TCP</Protocol>
+  			   <Port>6667</Port>
+			   <Description>IRC</Description>
+		    </ALG>
+			<ALG>
+  			   <Protocol>UDP</Protocol>
+  			   <Port>137</Port>
+			   <Description>NETBIOS_NS</Description>
+		    </ALG>
+			<ALG>
+  			   <Protocol>TCP</Protocol>
+  			   <Port>6566</Port>
+			   <Description>SANE</Description>
+		    </ALG>
 		</IPACMALG>
 		<IPACMNAT>		
- 	        <MaxNatEntries>100</MaxNatEntries>
+ 	        <MaxNatEntries>500</MaxNatEntries>
 		</IPACMNAT>
 		</IPACM>
 </system>
\ No newline at end of file