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

  • Committer: Teddy Hogeborn
  • Date: 2012-01-08 10:12:18 UTC
  • mfrom: (553 trunk)
  • mto: (237.4.29 release)
  • mto: This revision was merged to the branch mainline in revision 554.
  • Revision ID: teddy@recompile.se-20120108101218-h6yp0akairb23436
merge from trunk

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