summaryrefslogtreecommitdiff
path: root/shared/uci-defaults/0_default_config
blob: deeac1feb5598f94d7abd3b9ff853fbc7b688f6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

opkg install /ipks/*
ip link set eth0 mtu 1460

rule_name=$(uci add network rule)

# Extract configs from /proc/cmdline
bridged_wifi_tap=false
words=$(cat /proc/cmdline)
while
    word=${words%%" "*}
    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" ]
do
    words=$next
done

if $bridged_wifi_tap; then
    uci set network.wan.netmask="255.255.255.0"
else
    uci set network.wan.netmask="255.255.255.252"
fi

uci commit

# Regarding hostapd issue of OpenWRT 22.03.X versions, reboot it.
reboot