Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Feed
iopsys
Commits
cd55bbdf
Commit
cd55bbdf
authored
Nov 25, 2022
by
Amit Kumar
Browse files
mapagent: port add delete to bridge using uci ubus
parent
ac7abe05
Changes
1
Hide whitespace changes
Inline
Side-by-side
map-agent/files/etc/hotplug.d/ethernet/map-dynamic-backhaul
View file @
cd55bbdf
...
...
@@ -14,24 +14,31 @@ al_brnet="${al_bridge:3}"
############## Dynamic Backhaul Daemon ##############
if
[
-n
"
$(
which dynbhd
)
"
]
;
then
pidof dynbhd
>
/dev/null
&&
exit
0
# dynbhd is managing the links
device
=
"br_
$al_brnet
"
if
[
!
-f
$conn_ports_file
]
;
then
touch
$conn_ports_file
if
[
"
$LINK
"
=
"up"
]
;
then
touch
$conn_ports_file
echo
"
$PORT
"
>
$conn_ports_file
brctl delif
$al_bridge
$PORT
#brctl delif $al_bridge $PORT
uci
-q
del_list network.
${
device
}
.ports
=
"
$PORT
"
ubus call uci commit
'{"config":"network"}'
#ubus call network.interface.lan remove_device "{\"name\":\"$PORT\"}"
fi
else
if
[
"
$LINK
"
=
"up"
]
;
then
brctl delif
$al_bridge
$PORT
#brctl delif $al_bridge $PORT
uci
-q
del_list network.
${
device
}
.ports
=
"
$PORT
"
ubus call uci commit
'{"config":"network"}'
echo
"
$PORT
"
>>
$conn_ports_file
#ubus call network.interface.lan remove_device "{\"name\":\"$PORT\"}"
else
sed
-i
-E
"/(^|:)
${
PORT
}
(:|
$)
/d"
$conn_ports_file
#ubus call network.interface.lan add_device "{\"name\":\"$PORT\"}"
brctl addif
$al_bridge
$PORT
#brctl addif $al_bridge $PORT
uci
-q
add_list network.
${
device
}
.ports
=
"
$PORT
"
ubus call uci commit
'{"config":"network"}'
[
"
$(
cat
$conn_ports_file
|
wc
-c
)
"
=
"0"
]
&&
rm
-f
$conn_ports_file
fi
fi
...
...
@@ -50,11 +57,14 @@ else
[
"
$(
uci
-q
get network.
${
al_brnet
}
.proto
)
"
==
"dhcp"
]
||
exit
0
if
[
"
$LINK
"
=
"up"
]
;
then
brctl delif
$al_bridge
$PORT
device
=
"br_
$al_brnet
"
uci
-q
del_list network.
${
device
}
.ports
=
"
$PORT
"
ubus call uci commit
'{"config":"network"}'
udhcpc
-qnRoC
-i
$PORT
>
/dev/null 2>&1
&&
dhcp
=
1
brctl addif
$al_bridge
$PORT
uci
-q
add_list network.
${
device
}
.ports
=
"
$PORT
"
ubus call uci commit
'{"config":"network"}'
[
$dhcp
-eq
1
]
||
exit
0
else
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment