mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-02-18 02:01:16 +01:00
layer2interface: layer2 interface ethernet and vlan scripts run adaptation code to netifd way
This commit is contained in:
parent
5a8f5e841c
commit
1cbe737ca8
2 changed files with 51 additions and 3 deletions
|
|
@ -6,6 +6,8 @@ include /lib/network
|
|||
START=22
|
||||
USE_PROCD=1
|
||||
|
||||
DEVICE_ADDED=0
|
||||
|
||||
get_current_status() {
|
||||
local port="$1"
|
||||
local media="$(ethctl $port media-type 2>&1)"
|
||||
|
|
@ -18,6 +20,37 @@ get_current_status() {
|
|||
fi
|
||||
}
|
||||
|
||||
untagged_vlan_exists() {
|
||||
ubus call uci get '{"config":"network","type":"device"}' | grep -w name | grep -w "$1" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
configure_ethernet_iface() {
|
||||
local name baseifname ifname
|
||||
|
||||
config_get name $1 name
|
||||
config_get baseifname $1 baseifname
|
||||
config_get ifname $1 ifname
|
||||
|
||||
[ -n "$ifname" -a -n "$name" ] || return
|
||||
untagged_vlan_exists "$ifname" && return
|
||||
|
||||
uci -q set network.$name=device
|
||||
uci -q set network.$name.type=untagged
|
||||
uci -q set network.$name.ifname="$baseifname"
|
||||
uci -q set network.$name.name="$ifname"
|
||||
|
||||
DEVICE_ADDED=1
|
||||
}
|
||||
|
||||
|
||||
start_service() {
|
||||
config_load layer2_interface_ethernet
|
||||
config_foreach configure_ethernet_iface ethernet_interface
|
||||
|
||||
[ $DEVICE_ADDED -eq 1 ] && ubus call uci commit '{"config":"network"}'
|
||||
}
|
||||
|
||||
boot() {
|
||||
local baseifname wanport portnum
|
||||
config_load layer2_interface_ethernet
|
||||
|
|
@ -52,6 +85,11 @@ boot() {
|
|||
fi
|
||||
[ -n "$ifname" ] && echo '1' > /proc/sys/net/ipv6/conf/$baseifname/disable_ipv6
|
||||
[ -n $baseifname ] && ifconfig $baseifname up
|
||||
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger layer2_interface_ethernet
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@
|
|||
START=22
|
||||
USE_PROCD=1
|
||||
|
||||
DEVICE_ADDED=0
|
||||
|
||||
vlan_exists() {
|
||||
ubus call uci get '{"config":"network","type":"device"}' | grep -w name | grep -w "$1" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
vlan_inf_conf() {
|
||||
local name baseifname ifname
|
||||
local vlan8021p vlan8021q
|
||||
|
|
@ -15,21 +22,24 @@ vlan_inf_conf() {
|
|||
config_get vlan8021p $1 vlan8021p
|
||||
config_get vlan8021q $1 vlan8021q
|
||||
|
||||
[ -n "$name" ] || return
|
||||
[ -n "$ifname" -a -n "$name" ] || return
|
||||
vlan_exists "$ifname" && return
|
||||
|
||||
uci -q set network.$name=device
|
||||
uci -q set network.$name.type=8021q
|
||||
uci -q set network.$name.priority=$vlan8021p
|
||||
uci -q set network.$name.vid="$vlan8021q"
|
||||
uci -q set network.$name.ifname="$baseifname"
|
||||
uci -q set network.$name.name="$baseifname.$vlan8021q"
|
||||
uci -q set network.$name.name="$ifname"
|
||||
|
||||
DEVICE_ADDED=1
|
||||
}
|
||||
|
||||
|
||||
start_service() {
|
||||
config_load layer2_interface_vlan
|
||||
config_foreach vlan_inf_conf vlan_interface
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
[ $DEVICE_ADDED -eq 1 ] && ubus call uci commit '{"config":"network"}'
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue