1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix macvlan creation

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-05-11 09:57:25 +02:00
parent 35cd6be369
commit f7476239ad

View file

@ -46,11 +46,22 @@ _create_interface() {
_ifname=$1
}
config_get _masterifname "$1" ifname
[ "$1" != "$_ifname" ] && {
uci batch <<-EOF
delete macvlan.$1
set macvlan.$_ifname=macvlan
set macvlan.$_ifname.name=$_ifname
set macvlan.$_ifname.ifname=$_masterifname
commit macvlan
EOF
}
logger -t "MACVLAN" "Create interface $_ifname based on $_masterifname"
uci batch <<-EOF
set network.$_ifname=interface
set network.$_ifname.type=macvlan
set network.$_ifname.proto=static
set network.$_ifname.masterintf=$_masterifname
commit network
EOF
}
@ -67,6 +78,7 @@ _setup_interface() {
config_get _type "$1" type
[ "$_type" = "macvlan" ] && [ "$(uci -q get macvlan.$1)" = "" ] && {
logger -t "MACVLAN" "Delete $1"
uci -q batch <<-EOF
delete network.$1
delete network.$1_dev