/mandos/release

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

« back to all changes in this revision

Viewing changes to network-hooks.d/bridge

  • Committer: Teddy Hogeborn
  • Date: 2008-08-19 13:25:14 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080819132514-wawrvgmfjovg9poj
* Makefile (DOCBOOKTOMAN): Added "--xinclude".

* mandos-options.xml: New file; moved mandos(8) option descriptions
                      here.

* mandos.conf.xml: Add XInclude namespace.
  (OPTIONS): New separate section with options from old "DESCRIPTION"
             section.  Changed all options to include a synopsis and
             include its paragraph from "mandos-options.xml".
  (FILES): Moved to before "EXAMPLES".
  (BUGS): New section.
  (EXAMPLES): Renamed to "EXAMPLE", as per man-pages(7).  Unindented
              example text.

* mandos.xml: Removed OVERVIEW entity.  Add XInclude namespace.
  (OPTIONS): Moved all descriptive paragraphs to "mandos-options.xml"
             and just <xi:include/> them from here.
  (OVERVIEW): Changed to do <xi:include/>.

* overview.xml: Added DOCTYPE; reportedly needed for XInclude to work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
#
3
 
# This is an example of a Mandos client network hook.  This hook
4
 
# brings up a bridge interface as specified in a separate
5
 
# configuration file.  To be used, this file and any needed
6
 
# configuration file(s) should be copied into the
7
 
# /etc/mandos/network-hooks.d directory.
8
 
9
 
# Copying and distribution of this file, with or without modification,
10
 
# are permitted in any medium without royalty provided the copyright
11
 
# notice and this notice are preserved.  This file is offered as-is,
12
 
# without any warranty.
13
 
 
14
 
set -e
15
 
 
16
 
CONFIG="$MANDOSNETHOOKDIR/bridge.conf"
17
 
 
18
 
# Read config file, which must set "BRIDGE", "PORTS", and optionally
19
 
# "IPADDRS" and "ROUTES".
20
 
if [ -e "$CONFIG" ]; then
21
 
    . "$CONFIG"
22
 
fi
23
 
 
24
 
if [ -z "$BRIDGE" -o -z "$PORTS" ]; then
25
 
    exit
26
 
fi
27
 
 
28
 
if [ -n "$DEVICE" -a "$DEVICE" != "$BRIDGE" ]; then
29
 
    exit
30
 
fi
31
 
 
32
 
for b in /sbin/brctl /usr/sbin/brctl; do
33
 
    if [ -e "$b" ]; then
34
 
        brctl="$b"
35
 
        break
36
 
    fi
37
 
done
38
 
 
39
 
case "$1" in
40
 
    start)
41
 
        "$brctl" addbr "$BRIDGE"
42
 
        for port in $PORTS; do
43
 
            "$brctl" addif "$BRIDGE" "$port"
44
 
            ip link set up "$port"
45
 
        done
46
 
        ip link set up "$BRIDGE"
47
 
        sleep "$DELAY"
48
 
        if [ -n "$IPADDRS" ]; then
49
 
            for ipaddr in $IPADDRS; do
50
 
                ip addr add "$ipaddr" dev "$BRIDGE"
51
 
            done
52
 
        fi
53
 
        if [ -n "$ROUTES" ]; then
54
 
            for route in $ROUTES; do
55
 
                ip route add "$route" dev "$BRIDGE"
56
 
            done
57
 
        fi
58
 
        ;;
59
 
    stop)
60
 
        ip link set down "$BRIDGE"
61
 
        for port in $PORTS; do
62
 
            ip link set down "$port"
63
 
            "$brctl" delif "$BRIDGE" "$port"
64
 
        done
65
 
        "$brctl" delbr "$BRIDGE"
66
 
        ;;
67
 
    files)
68
 
        echo /bin/ip
69
 
        echo "$brctl"
70
 
        ;;
71
 
    modules)
72
 
        echo bridge
73
 
        ;;
74
 
esac