/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 at bsnet
  • Date: 2011-12-25 00:40:09 UTC
  • Revision ID: teddy@fukt.bsnet.se-20111225004009-n5uimmac6h8djtv8
* plugin-runner.c (add_to_char_array): Added "nonnull" attribute.
  (add_argument): Added "nonnull" attribute on the "arg" argument.
  (add_environment): Added "nonnull" attribute on the "def" argument.
  (print_out_password, free_plugin): Added "nonnull" attribute.
  (main/parse_opt): Added "nonnull" attribute on the "state" argument.
* plugins.d/mandos-client.c (perror_plus): Bug fix; restore errno
                                           after fprintf().
* plugins.d/password-prompt.c (fprintf_plus): New.
 (conflict_detection/is_plymouth, main/parse_opt): Added "nonnull"
                                                   attribute.
 (conflict_detection/is_plymouth, conflict_detection, main): Bug fix;
                                                             Call
                                                             error_plus()
                                                             instead
                                                             of
                                                             error().
  (main/parse_opt): Added "nonnull" attribute on the "state" argument.
* plugins.d/plymouth.c (exec_and_wait): Added "nonnull" attribute on
                                        the "path" and "argv"
                                        arguments.
  (is_plymouth): Added "nonnull" attribute.

Show diffs side-by-side

added added

removed removed

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