aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/bin
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-05-24 16:45:06 +0200
committerRafał Miłecki <rafal@milecki.pl>2021-05-27 10:58:49 +0200
commit4b9a67362d70c544b85078b8d5c661f43f7472d9 (patch)
tree62551cfc23cac0cfe27183cc662ce9f65a1af400 /package/base-files/files/bin
parent553cc47ec75ee15ff51fde714a75403450bac730 (diff)
downloadupstream-4b9a67362d70c544b85078b8d5c661f43f7472d9.tar.gz
upstream-4b9a67362d70c544b85078b8d5c661f43f7472d9.tar.bz2
upstream-4b9a67362d70c544b85078b8d5c661f43f7472d9.zip
base-files: generate network config with "device" options
Replace "ifname" with "device" as netifd has been recently patches to used the later one. It's more clear and accurate. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'package/base-files/files/bin')
-rwxr-xr-xpackage/base-files/files/bin/config_generate26
1 files changed, 13 insertions, 13 deletions
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index be688a4ba3..d895090309 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -40,7 +40,7 @@ generate_static_network() {
uci -q batch <<-EOF
delete network.loopback
set network.loopback='interface'
- set network.loopback.ifname='lo'
+ set network.loopback.device='lo'
set network.loopback.proto='static'
set network.loopback.ipaddr='127.0.0.1'
set network.loopback.netmask='255.0.0.0'
@@ -91,22 +91,22 @@ generate_static_network() {
addr_offset=2
generate_network() {
- local ports ifname macaddr protocol type ipaddr netmask vlan
+ local ports device macaddr protocol type ipaddr netmask vlan
local bridge=$2
json_select network
json_select "$1"
+ json_get_vars device macaddr protocol ipaddr netmask vlan
json_get_values ports ports
- json_get_vars ifname macaddr protocol ipaddr netmask vlan
json_select ..
json_select ..
- [ -n "$ifname" -o -n "$ports" ] || return
+ [ -n "$device" -o -n "$ports" ] || return
# Force bridge for "lan" as it may have other devices (e.g. wireless)
# bridged
[ "$1" = "lan" -a -z "$ports" ] && {
- ports="$ifname"
+ ports="$device"
}
[ -n "$ports" -a -z "$bridge" ] && {
@@ -117,19 +117,19 @@ generate_network() {
set network.@device[-1].macaddr='$macaddr'
EOF
for port in $ports; do uci add_list network.@device[-1].ports="$port"; done
- ifname=br-$1
+ device=br-$1
type=
macaddr=""
}
[ -n "$bridge" ] && {
- [ -z "$ports" ] && ports="$ifname"
+ [ -z "$ports" ] && ports="$device"
if [ -z "$vlan" ]; then
bridge_vlan_id=$((bridge_vlan_id + 1))
vlan=$bridge_vlan_id
fi
generate_bridge_vlan $1 $bridge "$ports" $vlan
- ifname=$bridge.$vlan
+ device=$bridge.$vlan
type=""
}
@@ -137,12 +137,12 @@ generate_network() {
delete network.$1
set network.$1='interface'
set network.$1.type='$type'
- set network.$1.ifname='$ifname'
+ set network.$1.device='$device'
set network.$1.proto='none'
EOF
if [ -n "$macaddr" ]; then
- for name in $ifname; do
+ for name in $device; do
uci -q batch <<-EOF
delete network.$1_${name/./_}_dev
set network.$1_${name/./_}_dev='device'
@@ -172,14 +172,14 @@ generate_network() {
dhcp)
# fixup IPv6 slave interface if parent is a bridge
- [ "$type" = "bridge" ] && ifname="br-$1"
+ [ "$type" = "bridge" ] && device="br-$1"
uci set network.$1.proto='dhcp'
[ -e /proc/sys/net/ipv6 ] && {
uci -q batch <<-EOF
delete network.${1}6
set network.${1}6='interface'
- set network.${1}6.ifname='$ifname'
+ set network.${1}6.device='$device'
set network.${1}6.proto='dhcpv6'
EOF
}
@@ -196,7 +196,7 @@ generate_network() {
set network.$1.ipv6='1'
delete network.${1}6
set network.${1}6='interface'
- set network.${1}6.ifname='@${1}'
+ set network.${1}6.device='@${1}'
set network.${1}6.proto='dhcpv6'
EOF
}