Skip to content
Snippets Groups Projects
Commit c1e9cb83 authored by Rahul Thakur's avatar Rahul Thakur
Browse files

netifd: rename device section

Rename device section to more user friendly LANX and WAN. This will
appear in Ethernet.Interface.{i}.Alias. The value for the parameter
Ethernet.Interface.{i}.Name will remain the underlying device name
for example, eth0.1, eth1 etc.

Note: for this to take effect, device will need default reset since
the change is in uci-defaults and considering this is a cosmetic change,
migrations over upgrades is not accounted for.
parent b385c9ca
No related branches found
No related tags found
1 merge request!540netifd: rename device section
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
INDEX=1
create_dev_section() {
local itf="$1"
......@@ -8,21 +9,23 @@ create_dev_section() {
local sec_name="$(echo "${itf}" | tr '.' '_')"
uci add network device
uci rename network.@device[-1]="dev_${sec_name}"
uci set network.@device[-1].enabled="1"
uci set network.@device[-1].ifname="$itf"
uci set network.@device[-1].name="$itf"
uci set network.@device[-1].eee="0"
if [ "$uplink" == "1" ]; then
uci rename network.@device[-1]="WAN"
uci set network.@device[-1].pause="1"
uci set network.@device[-1].rxpause="1"
uci set network.@device[-1].txpause="1"
else
uci rename network.@device[-1]="LAN${INDEX}"
uci set network.@device[-1].pause="0"
uci set network.@device[-1].rxpause="0"
uci set network.@device[-1].txpause="0"
INDEX=$((INDEX + 1))
fi
uci set network.@device[-1].enabled="1"
uci set network.@device[-1].ifname="$itf"
uci set network.@device[-1].name="$itf"
uci set network.@device[-1].eee="0"
}
generate_device() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment