-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathremote-999-tether.sh
50 lines (42 loc) · 1.01 KB
/
remote-999-tether.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
tether_rndis() {
oc_opkg_install kmod-usb-net-rndis
local iface wan
iface="$1"
wan="$2"
uci batch <<EOF
set network.wan.metric=10
set network.${wan}=interface
set network.${wan}.ifname=${iface}
set network.${wan}.proto=dhcp
set network.${wan}.ipv6=0
set network.${wan}.metric=20
EOF
oc_service reload network
oc_uci_add_list 'firewall.zone_wan.network' "$wan"
oc_service reload firewall 2>/dev/null
}
tether_wlan() {
local iface wan
iface="$1"
wan="$2"
uci batch <<EOF
set network.wan.metric=10
set network.${wan}=interface
set network.${wan}.proto=dhcp
set network.${wan}.ipv6=0
set network.${wan}.metric=30
set wireless.${iface}.network=twan2
EOF
uci commit wireless
oc_service reload network
oc_uci_add_list 'firewall.zone_wan.network' "$wan"
oc_service reload firewall 2>/dev/null
}
if [ -n "$config_tether_rndis" ]
then
tether_rndis "$config_tether_rndis" twan1
fi
if [ -n "$config_tether_wlan" ]
then
tether_wlan "$config_tether_wlan" twan2
fi