[Bugfix][ZXW-311] add lynq nv config support & merge changes for sihai

Only Configure :No
Affected branch: master
Affected module: ap
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: Ic053bce99ae5c28f7e181983314edd1887372741
diff --git a/ap/app/zte_comm/zte_mainctrl/netdev_proc.c b/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
index 4a4ae9b..2533625 100755
--- a/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
+++ b/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
@@ -874,17 +874,26 @@
 			(actinfo->act_info.ip46flag & V4_VALID))
 		{
 			char nat_enable[4] = {0};
-			
+			/*add lynq nv config support & merge changes for sihai@cz.li on 2024/10/11 start*/
+			int rndis_ip_map = !system("cat /sys/class/lynq_nv_cfg/cdev_lynq_nv_cfg/rndis_ip_map | grep 1");
 			system_cmd_ex("iptables -P INPUT ACCEPT");
 			system_cmd_ex("iptables -P OUTPUT ACCEPT");
 			system_cmd_ex("iptables -P FORWARD ACCEPT");
-			system_cmd_ex("iptables -t nat -F");
+			if (rndis_ip_map == 0)
+				system_cmd_ex("iptables -t nat -F");
 			system_cmd_ex("iptables -t nat -X port_forward");
 			system_cmd_ex("iptables -t nat -X DMZ");
 			system_cmd_ex("iptables -t nat -X port_mapping");
 			system_cmd_ex("iptables -t nat -N port_forward");
 			system_cmd_ex("iptables -t nat -N DMZ");
 			system_cmd_ex("iptables -t nat -N port_mapping");
+			if (rndis_ip_map == 1)
+			{
+				system_cmd_ex("iptables -t nat -D PREROUTING -j port_forward");
+				system_cmd_ex("iptables -t nat -D PREROUTING -j DMZ");
+				system_cmd_ex("iptables -t nat -D PREROUTING -j port_mapping");
+			}
+			/*add lynq nv config support & merge changes for sihai@cz.li on 2024/10/11 end*/
 			system_cmd_ex("iptables -t nat -I PREROUTING 1 -j port_forward");
 			system_cmd_ex("iptables -t nat -I PREROUTING 1 -j DMZ");
 			system_cmd_ex("iptables -t nat -I PREROUTING 1 -j port_mapping");