/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to network-hooks.d/bridge

  • Committer: Teddy Hogeborn
  • Date: 2012-01-01 04:02:00 UTC
  • Revision ID: teddy@recompile.se-20120101040200-8wgma707v4gi7hxn
* debian/rules (binary-common): Exclude network-hooks.d from
                                dh_fixperms.
* mandos (DBusObjectWithProperties.Set): Bug fix: handle byte arrays.
* mandos-clients.conf.xml (DESCRIPTION): Add reference to persistent
                                         state.
* mandos-options.xml (restore): Adjust wording slightly.
* mandos.xml (OPTIONS/--no-restore): Refer to "PERSISTENT STATE"
                                     section.
  (PERSISTENT STATE): New section.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
CONFIG="$MANDOSNETHOOKDIR/bridge.conf"
17
17
 
18
 
# Read config file, which must set "BRIDGE", "PORTS", and optionally
19
 
# "IPADDRS" and "ROUTES".
 
18
addrtoif(){
 
19
    grep -liFe "$1" /sys/class/net/*/address \
 
20
        | sed -e 's,.*/\([^/]*\)/[^/]*,\1,'
 
21
}
 
22
 
 
23
# Read config file, which must set "BRIDGE", "PORT_ADDRESSES", and
 
24
# optionally "IPADDRS" and "ROUTES".
20
25
if [ -e "$CONFIG" ]; then
21
26
    . "$CONFIG"
22
27
fi
23
28
 
24
 
if [ -z "$BRIDGE" -o -z "$PORTS" ]; then
 
29
if [ -z "$BRIDGE" -o -z "$PORT_ADDRESSES" ]; then
25
30
    exit
26
31
fi
27
32
 
39
44
case "$1" in
40
45
    start)
41
46
        "$brctl" addbr "$BRIDGE"
42
 
        for port in $PORTS; do
43
 
            "$brctl" addif "$BRIDGE" "$port"
44
 
            ip link set dev "$port" up
 
47
        for address in $PORT_ADDRESSES; do
 
48
            interface=`addrtoif "$address"`
 
49
            "$brctl" addif "$BRIDGE" "$interface"
 
50
            ip link set dev "$interface" up
45
51
        done
46
52
        ip link set dev "$BRIDGE" up
47
53
        sleep "$DELAY"
58
64
        ;;
59
65
    stop)
60
66
        ip link set dev "$BRIDGE" down
61
 
        for port in $PORTS; do
62
 
            ip link set dev "$port" down
63
 
            "$brctl" delif "$BRIDGE" "$port"
 
67
        for address in $PORT_ADDRESSES; do
 
68
            interface=`addrtoif "$address"`
 
69
            ip link set dev "$interface" down
 
70
            "$brctl" delif "$BRIDGE" "$interface"
64
71
        done
65
72
        "$brctl" delbr "$BRIDGE"
66
73
        ;;