[Bugfix][API-1022] fix can't get connect ap ip of iQOO pro
[Bugfix][API-1031] fix can't get hostname

Change-Id: I7dc3bfa8e913c6326b5d214d1c5d6fb0913dece5
diff --git a/lib/liblynq-wifi6/scripts/start_stop_ap.sh b/lib/liblynq-wifi6/scripts/start_stop_ap.sh
index 5415602..259aa01 100755
--- a/lib/liblynq-wifi6/scripts/start_stop_ap.sh
+++ b/lib/liblynq-wifi6/scripts/start_stop_ap.sh
@@ -13,6 +13,7 @@
 	echo "bind-interfaces"  >> /run/wg870/dnsmasq.conf
 	echo "localise-queries" >> /run/wg870/dnsmasq.conf
 	echo "dhcp-range=192.168.15.2,192.168.15.14,255.255.255.240,1h"  >> /run/wg870/dnsmasq.conf
+	echo "dhcp-leasefile=/run/wg870/ap0.lease" >> /run/wg870/dnsmasq.conf
 	ps -eo "%p %a" | grep "/usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid" | grep -v grep
 	if [ $? != 0 ]; then
 		/usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid -7 /run/wg870/dnsmasq.d --local-service -C /run/wg870/dnsmasq.conf -r /run/wg870
diff --git a/lib/liblynq-wifi6/scripts/start_stop_sta.sh b/lib/liblynq-wifi6/scripts/start_stop_sta.sh
index 5118808..4fd9ef0 100755
--- a/lib/liblynq-wifi6/scripts/start_stop_sta.sh
+++ b/lib/liblynq-wifi6/scripts/start_stop_sta.sh
@@ -7,7 +7,18 @@
         fi
 		ps -eo "%p %a" | grep "dhcpcd wlan0" | grep -v grep
 		if [ $? != 0 ];	then
-			dhcpcd wlan0 -t 0 -o domain_name_servers --noipv4ll -B -G -j /tmp/dhcpcd.log &
+			echo "" > /tmp/wlan0_dhcpcd_router
+			echo "#!/bin/sh" > /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			echo "if [ \"\$reason\" == \"BOUND\" -o \"\$reason\" == \"RENEW\" -o \"\$reason\" == \"REBIND\" ]; then" >> /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			echo "    if [ \"\$new_routers\" != \"\" ]; then" >> /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			echo "        for x in \$new_routers; do" >> /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			echo "            echo \"new_router \$x\" > /tmp/wlan0_dhcpcd_router" >> /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			echo "            ping -c2 \$x &" >> /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			echo "        done" >> /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			echo "    fi" >> /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			echo "fi" >> /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			chmod +x /run/wg870/wlan0_dhcpcd_run_hooks.sh
+			dhcpcd wlan0 -t 0 -o domain_name_servers --noipv4ll -4 -B -G -c /run/wg870/wlan0_dhcpcd_run_hooks.sh &
 		fi
 elif [ "$1" == "stop" ]; then
         ps -eo "%p %a" | grep "dhcpcd wlan0" | grep -v grep | awk '{print "kill "$1}' | sh