forked from freifunk-franken/firmware
fff-vxlan-node: disable vxlan if no peers available
Disabling vxlan via uci solves all problemes. A reload_config does now everything we need. Bringing up vxlan if peers available and shuting down the Interface if not. This will also remove old fdb entries and clear the batman tables immediately. No ifup and no extra cleaning of the fdb is required. Signed-off-by: Robert Langhammer <rlanghammer@web.de> Acked-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
4cd3b17714
commit
a317557320
|
@ -3,6 +3,8 @@ protocol=vxlan
|
||||||
vxlan_clear() {
|
vxlan_clear() {
|
||||||
while uci -q delete network.@vxlan_peer[0]; do :; done
|
while uci -q delete network.@vxlan_peer[0]; do :; done
|
||||||
uci set network.vxlan0.vid="0"
|
uci set network.vxlan0.vid="0"
|
||||||
|
uci set network.vxlan0.disabled="1"
|
||||||
|
uci set network.vxbat.disabled="1"
|
||||||
}
|
}
|
||||||
|
|
||||||
vxlan_addpeer() {
|
vxlan_addpeer() {
|
||||||
|
@ -10,18 +12,13 @@ vxlan_addpeer() {
|
||||||
address=$(ping6 -w1 -c1 "$address" | awk '/from/ {print substr($4, 1, length($4)-1); exit}')
|
address=$(ping6 -w1 -c1 "$address" | awk '/from/ {print substr($4, 1, length($4)-1); exit}')
|
||||||
[ -z $address ] && return ## address not reachable
|
[ -z $address ] && return ## address not reachable
|
||||||
uci set network.vxlan0.vid="$id"
|
uci set network.vxlan0.vid="$id"
|
||||||
|
uci set network.vxlan0.disabled="0"
|
||||||
|
uci set network.vxbat.disabled="0"
|
||||||
uci add network vxlan_peer
|
uci add network vxlan_peer
|
||||||
uci set network.@vxlan_peer[-1].vxlan="vxlan0"
|
uci set network.@vxlan_peer[-1].vxlan="vxlan0"
|
||||||
uci set network.@vxlan_peer[-1].dst="$address"
|
uci set network.@vxlan_peer[-1].dst="$address"
|
||||||
}
|
}
|
||||||
|
|
||||||
vxlan_start_stop() {
|
vxlan_start_stop() {
|
||||||
# reload_config will not add new peers. A ifup is needed
|
reload_config
|
||||||
ifup vxlan0
|
|
||||||
|
|
||||||
# this workaround is cleaning up old fdb entries
|
|
||||||
# and can be removed if someday netifd will do that
|
|
||||||
bridge fdb show dev vxlan0 state permanent | while read mac dst ip rest ; do
|
|
||||||
uci show network | grep -q "$ip" || bridge fdb del $mac dev vxlan0 dst $ip
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user