blob: 5b492d699b7330f60eb279b2e62abcc7aa7d8025 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
. /lib/functions.sh
. /lib/functions/network.sh
tunneldigger_get_bridge() {
local variable="$1"
local mtu="$2"
# Overwrite the destination variable.
unset $variable
# Discover the configured bridge.
unset _td_bridge
_td_bridge=""
handle_bridge() {
local cfg="$1"
config_get cfg_mtu "$cfg" mtu
config_get interface "$cfg" interface
if [ "$cfg_mtu" != "$mtu" ]; then
return
fi
_td_bridge="$interface"
}
config_load tunneldigger-broker
config_foreach handle_bridge bridge $mtu
if [ -z "$_td_bridge" ]; then
return
fi
variable="$_td_bridge"
export ${NO_EXPORT:+-n} "$1=$variable"
}
# Get the isolation option for this bridge
tunneldigger_get_bridge_isolate() {
local variable="$1"
local mtr="$2"
# Overwrite the destination variable.
unset $variable
# Discover the configured bridge.
unset _isolate_bridge
_isolate_bridge=""
handle_bridge() {
local cfg="$1"
config_get cfg_mtu "$cfg" mtu
config_get isolate "$cfg" isolate 0
if [ "$cfg_mtu" != "$mtu" ]; then
return
fi
_isolate_bridge="$isolate"
}
config_load tunneldigger-broker
config_foreach handle_bridge bridge $mtu
if [ -z "$_isolate_bridge" ]; then
return
fi
variable="$_isolate_bridge"
export ${NO_EXPORT:+-n} "$1=$variable"
}
|