Share gateway IP address between OpenWRT instances am: 2fb899a07f am: 171611e0bd

Original change: https://android-review.googlesource.com/c/platform/external/openwrt-prebuilts/+/2390994

Change-Id: I5794a13f62769809ced051bd804879dc0be5ab97
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/shared/config/network b/shared/config/network
index 1d76e21..3760c8c 100644
--- a/shared/config/network
+++ b/shared/config/network
@@ -33,7 +33,6 @@
 config interface 'wan'
 	option device 'br-lan'
 	option proto 'static'
-	option netmask '255.255.255.252'
 	option ip6assign '30'
 	option dns '8.8.8.8'
 
diff --git a/shared/uci-defaults/0_default_config b/shared/uci-defaults/0_default_config
index 1f82066..baf5650 100644
--- a/shared/uci-defaults/0_default_config
+++ b/shared/uci-defaults/0_default_config
@@ -21,20 +21,21 @@
     words=$next
 done
 
-# Setup wan based on instance_num. Interface wan will occupy 192.168.96.X.
 rule_name=$(uci add network rule)
+
+# Setup wan based on instance_num. Interface wan will occupy 192.168.96.X.
 if $bridged_host_network; then
     uci set network.wan.gateway="192.168.96.1"
-    uci set network.wan.ipaddr="192.168.96.2"
-    uci set network.wan.broadcast="192.168.96.3"
+    uci set network.wan.netmask="255.255.255.0"
 else
     d_class_wan_gateway=$(expr $instance_num \* 4 - 3);
-    d_class_wan_ipaddr=$(expr $instance_num \* 4 - 2);
-    d_class_wan_broadcast=$(expr $instance_num \* 4 - 1);
     uci set network.wan.gateway="192.168.96."$d_class_wan_gateway
-    uci set network.wan.ipaddr="192.168.96."$d_class_wan_ipaddr
-    uci set network.wan.broadcast="192.168.96."$d_class_wan_broadcast
+    uci set network.wan.netmask="255.255.255.252"
 fi
+d_class_wan_ipaddr=$(expr $instance_num \* 4 - 2);
+d_class_wan_broadcast=$(expr $instance_num \* 4 - 1);
+uci set network.wan.ipaddr="192.168.96."$d_class_wan_ipaddr
+uci set network.wan.broadcast="192.168.96."$d_class_wan_broadcast
 
 # Setup wifi0 and wifi1 based on instance_num.
 # Interfaces wifi0 and wifi1 will occupy 192.168.2.X - 192.168.33.X.