/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/wireless

  • Committer: teddy at recompile
  • Date: 2011-12-31 14:05:57 UTC
  • mto: (237.7.89 trunk)
  • mto: This revision was merged to the branch mainline in revision 290.
  • Revision ID: teddy@recompile.se-20111231140557-5u4s7s2122gsw5uq
* network-hooks.s/bridge: Don't use interface names directly; search
                          for interface names using their address.
  (addrtoif): New function.
* network-hooks.s/bridge.conf (PORTS): Removed.
  (PORT_ADDRESSES): New.
* network-hooks.s/wireless: Don't use interface names directly; search
                            for interface names using their address.
  (addrtoif): New function.
* network-hooks.s/wireless.conf: Specify address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
CONFIG="$MANDOSNETHOOKDIR/wireless.conf"
22
22
 
23
23
addrtoif(){
24
 
    grep -liFe "$1" /sys/class/net/*/address | sed -e 's,.*/\([^/]*\)/[^/]*,\1,'
 
24
    grep -liFe "$1" /sys/class/net/*/address \
 
25
        | sed -e 's,.*/\([^/]*\)/[^/]*,\1,'
25
26
}
26
27
 
27
28
# Read config file
31
32
    exit
32
33
fi
33
34
 
34
 
ifkeys="`env | sed -n -e 's/^ADDRESS_\([^=]*\)=.*/\1/p' \"$CONFIG\" | sort -u`"
 
35
ifkeys=`env | sed -n -e 's/^ADDRESS_\([^=]*\)=.*/\1/p' "$CONFIG" \
 
36
    | sort -u`
35
37
 
36
38
# Exit if DEVICE is set and is not any of the wireless interfaces
37
39
if [ -n "$DEVICE" ]; then
80
82
            "$wpa_cli" -g "$CTRL" interface_add "$INTERFACE" "" \
81
83
                "${DRIVER:-wext}" "$CTRLDIR" > /dev/null \
82
84
                | sed -e '/^OK$/d'
83
 
            NETWORK=`"$wpa_cli" -p "$CTRLDIR" -i "$INTERFACE" add_network`
 
85
            NETWORK=`"$wpa_cli" -p "$CTRLDIR" -i "$INTERFACE" \
 
86
                add_network`
84
87
            eval wpa_interface_"$KEY"
85
88
            "$wpa_cli" -p "$CTRLDIR" -i "$INTERFACE" enable_network \
86
89
                "$NETWORK" | sed -e '/^OK$/d'
88
91
            sleep=$!
89
92
            while :; do
90
93
                kill -0 $sleep 2>/dev/null || break
91
 
                STATE=`"$wpa_cli" -p "$CTRLDIR" -i "$INTERFACE" status | sed -n -e 's/^wpa_state=//p'`
 
94
                STATE=`"$wpa_cli" -p "$CTRLDIR" -i "$INTERFACE" \
 
95
                    status | sed -n -e 's/^wpa_state=//p'`
92
96
                if [ "$STATE" = COMPLETED ]; then
93
97
                    while :; do
94
98
                        kill -0 $sleep 2>/dev/null || break 2