summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-25 07:12:25 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-25 07:12:25 +0000
commit9008ffbd4b2f2a62057969d31935d76ebca52935 (patch)
tree1a7bc34756bd98a5c8472260df7950906703af37
parent1fa657ff5afa7ac7058a1558449db69d41439d88 (diff)
parentd770550efb49899396aa9bdd94d8109f6bfa8126 (diff)
downloadopenwrt-prebuilts-android14-d1-s2-release.tar.gz
Change-Id: Ida0c5659987418b836b417cc4bba20edb6fc4b57
-rw-r--r--shared/config/network6
-rw-r--r--shared/uci-defaults/0_default_config40
2 files changed, 17 insertions, 29 deletions
diff --git a/shared/config/network b/shared/config/network
index 3760c8c..4f15042 100644
--- a/shared/config/network
+++ b/shared/config/network
@@ -39,9 +39,11 @@ config interface 'wan'
config interface 'wifi0'
option device 'br-wifi0'
option proto 'static'
- option netmask '255.255.255.192'
+ option netmask '255.255.255.128'
+ option ipaddr '192.168.99.1'
config interface 'wifi1'
option device 'br-wifi1'
option proto 'static'
- option netmask '255.255.255.192'
+ option netmask '255.255.255.128'
+ option ipaddr '192.168.99.129'
diff --git a/shared/uci-defaults/0_default_config b/shared/uci-defaults/0_default_config
index baf5650..deeac1f 100644
--- a/shared/uci-defaults/0_default_config
+++ b/shared/uci-defaults/0_default_config
@@ -3,17 +3,21 @@
opkg install /ipks/*
ip link set eth0 mtu 1460
-# Extract instance_num of CF instance. The default value is 1.
-instance_num=1
-bridged_host_network=false
+rule_name=$(uci add network rule)
+
+# Extract configs from /proc/cmdline
+bridged_wifi_tap=false
words=$(cat /proc/cmdline)
while
word=${words%%" "*}
- if echo "$word" | grep "instance_num"; then
- instance_num=${word#*"="}
- fi
- if echo "$word" | grep "bridged_host_network=true"; then
- bridged_host_network=true
+ if [ "$word" = "bridged_wifi_tap=true" ]; then
+ bridged_wifi_tap=true
+ elif echo "$word" | grep "^wan_gateway="; then
+ uci set network.wan.gateway=${word#*"="}
+ elif echo "$word" | grep "^wan_ipaddr="; then
+ uci set network.wan.ipaddr=${word#*"="}
+ elif echo "$word" | grep "^wan_broadcast="; then
+ uci set network.wan.broadcast=${word#*"="}
fi
next=${words#*" "}
[ "$words" != "$next" ]
@@ -21,29 +25,11 @@ do
words=$next
done
-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"
+if $bridged_wifi_tap; then
uci set network.wan.netmask="255.255.255.0"
else
- d_class_wan_gateway=$(expr $instance_num \* 4 - 3);
- uci set network.wan.gateway="192.168.96."$d_class_wan_gateway
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.
-c_class_wifi=$(expr \( $instance_num + 3 \) / 2)
-d_class_wifi0=$(expr \( $instance_num % 2 \* 128 \) + 1)
-d_class_wifi1=$(expr \( $instance_num % 2 \* 128 \) + 65)
-uci set network.wifi0.ipaddr="192.168."$c_class_wifi"."$d_class_wifi0
-uci set network.wifi1.ipaddr="192.168."$c_class_wifi"."$d_class_wifi1
uci commit