mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
netmode: fix static mode
and improve other modes
This commit is contained in:
parent
2fe133227d
commit
dfe2af4643
3 changed files with 23 additions and 30 deletions
|
|
@ -46,16 +46,19 @@ l3_network_config() {
|
|||
uci -q set network.wan6.proto='dhcpv6'
|
||||
uci -q delete network.wan6.disabled
|
||||
|
||||
if [ -n "$wandev" -a -n "$NETMODE_vlanid" -a $NETMODE_vlanid -gt 0 ]; then
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
uci -q set network.vlan_${NETMODE_vlanid}=device
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.type="8021q"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.name="$wandev.$NETMODE_vlanid"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.ifname="$wandev"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.vid=$NETMODE_vlanid
|
||||
|
||||
uci -q set network.wan.device="$wandev.$NETMODE_vlanid"
|
||||
wandev="$wandev.$NETMODE_vlanid"
|
||||
fi
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
uci -q set network.wan6.device="$wandev"
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
if [ -n "$NETMODE_dns_servers" ]; then
|
||||
dns_servers="$(echo $NETMODE_dns_servers | tr ',' ' ')"
|
||||
|
|
@ -84,12 +87,6 @@ l3_network_config() {
|
|||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
if [ -n "$device" ]; then
|
||||
uci -q set network.wan.device="$device"
|
||||
uci -q set network.wan6.device="$device"
|
||||
fi
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -44,16 +44,19 @@ l3_network_pppoe_config() {
|
|||
|
||||
uci -q set network.wan6.disabled='1'
|
||||
|
||||
if [ -n "$wandev" -a -n "$NETMODE_vlanid" -a $NETMODE_vlanid -gt 0 ]; then
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
uci -q set network.vlan_${NETMODE_vlanid}=device
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.type="8021q"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.name="$wandev.$NETMODE_vlanid"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.ifname="$wandev"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.vid=$NETMODE_vlanid
|
||||
|
||||
uci -q set network.wan.device="$wandev.$NETMODE_vlanid"
|
||||
wandev="$wandev.$NETMODE_vlanid"
|
||||
fi
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
uci -q set network.wan6.device="$wandev"
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
if [ -n "$NETMODE_dns_servers" ]; then
|
||||
dns_servers="$(echo $NETMODE_dns_servers | tr ',' ' ')"
|
||||
|
|
@ -82,12 +85,6 @@ l3_network_pppoe_config() {
|
|||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
if [ -n "$device" ]; then
|
||||
uci -q set network.wan.device="$device"
|
||||
uci -q set network.wan6.device="$device"
|
||||
fi
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,19 @@ l3_network_config() {
|
|||
|
||||
uci -q set network.wan6.disabled='1'
|
||||
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
uci -q set network.vlan_${NETMODE_vlanid}=device
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.type="8021q"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.name="$wandev.$NETMODE_vlanid"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.ifname="$wandev"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.vid=$NETMODE_vlanid
|
||||
|
||||
wandev="$wandev.$NETMODE_vlanid"
|
||||
fi
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
uci -q set network.wan6.device="$wandev"
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
if [ -n "$NETMODE_dns_servers" ]; then
|
||||
dns_servers="$(echo $NETMODE_dns_servers | tr ',' ' ')"
|
||||
|
|
@ -53,14 +66,6 @@ l3_network_config() {
|
|||
done
|
||||
fi
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
if [ -n "$NETMODE_dns_servers" ]; then
|
||||
IFS=',' read -ra ADDRS <<< "$NETMODE_dns_servers"
|
||||
for ip in "${ADDRS[@]}"; do
|
||||
uci -q add_list network.wan.dns=$ip
|
||||
done
|
||||
fi
|
||||
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
|
||||
|
|
@ -81,12 +86,6 @@ l3_network_config() {
|
|||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
if [ -n "$device" ]; then
|
||||
uci -q set network.wan.device="$device"
|
||||
uci -q set network.wan6.device="$device"
|
||||
fi
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue