/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-15 20:27:28 UTC
  • Revision ID: teddy@recompile.se-20120115202728-185929ww2r84s8xg
* DBUS-API (se.recompile.Mandos.Client.LastCheckerStatus): New
                                                           property.
* mandos (Client.last_checker_status): Use -2 instead of None to match
                                       D-Bus property.  All users
                                       changed.
  (Client.checked_ok): Remove "timeout" argument and call
                       "self.bump_timeout()" instead.
  (Client.bump_timeout): New; separated out from "checked_ok".
  (ClientDBus.last_checker_status): Hook to a D-Bus property.
  (ClientDBus.LastCheckerStatus_dbus_property): New D-Bus property.
  (ClientHandler.handle): Call client.bump_timeout() instead of
                          client.checked_ok().

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
# configuration file(s) should be copied into the
7
7
# /etc/mandos/network-hooks.d directory.
8
8
 
9
# Copyright © 2011 Teddy Hogeborn
 
10
# Copyright © 2011 Björn Påhlsson
 
11
9
12
# Copying and distribution of this file, with or without modification,
10
13
# are permitted in any medium without royalty provided the copyright
11
14
# notice and this notice are preserved.  This file is offered as-is,
17
20
 
18
21
addrtoif(){
19
22
    grep -liFe "$1" /sys/class/net/*/address \
20
 
        | sed -e 's,.*/\([^/]*\)/[^/]*,\1,'
 
23
        | sed -e 's,.*/\([^/]*\)/[^/]*,\1,' -e "/^${BRIDGE}\$/d"
21
24
}
22
25
 
23
26
# Read config file, which must set "BRIDGE", "PORT_ADDRESSES", and
34
37
    exit
35
38
fi
36
39
 
37
 
for b in /sbin/brctl /usr/sbin/brctl; do
 
40
brctl="/sbin/brctl"
 
41
for b in "$brctl" /usr/sbin/brctl; do
38
42
    if [ -e "$b" ]; then
39
43
        brctl="$b"
40
44
        break
50
54
            ip link set dev "$interface" up
51
55
        done
52
56
        ip link set dev "$BRIDGE" up
53
 
        sleep "$DELAY"
 
57
        sleep "${DELAY%%.*}"
54
58
        if [ -n "$IPADDRS" ]; then
55
59
            for ipaddr in $IPADDRS; do
56
60
                ip addr add "$ipaddr" dev "$BRIDGE"