/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: 2019-03-18 22:29:25 UTC
  • Revision ID: teddy@recompile.se-20190318222925-jvhek84dgcfgj6g3
mandos-ctl: Refactor tests

* mandos-ctl: Where the clients names "foo" and "barbar" do not refer
              to the actual mock clients in the TestCommand class,
              change all occurrences of these names to "client1" and
              "client2" (or just "client" when only one is used) .
              Also change all test doubles to use correct terminology;
              some things called mocks are actually stubs or spies,
              and rename all true mocks to have "mock" in their names.
              Also eliminate duplicate values in tests; derive values
              from previously defined values whenever possible.

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
 
9
# Copyright © 2012-2018 Teddy Hogeborn
 
10
# Copyright © 2012-2018 Björn Påhlsson
11
11
12
12
# Copying and distribution of this file, with or without modification,
13
13
# are permitted in any medium without royalty provided the copyright
35
35
    exit
36
36
fi
37
37
 
38
 
ifkeys=`env | sed -n -e 's/^ADDRESS_\([^=]*\)=.*/\1/p' "$CONFIG" \
39
 
    | sort -u`
 
38
ifkeys=`sed -n -e 's/^ADDRESS_\([^=]*\)=.*/\1/p' "$CONFIG" | sort -u`
40
39
 
41
40
# Exit if DEVICE is set and is not any of the wireless interfaces
42
41
if [ -n "$DEVICE" ]; then
44
43
        for KEY in $ifkeys; do
45
44
            ADDRESS=`eval 'echo "$ADDRESS_'"$KEY"\"`
46
45
            INTERFACE=`addrtoif "$ADDRESS"`
47
 
            if [ "$INTERFACE" = "$DEVICE" ]; then
48
 
                break 2
49
 
            fi
 
46
            
 
47
            case "$DEVICE" in
 
48
                *,"$INTERFACE"|*,"$INTERFACE",*|"$INTERFACE",*|"$INTERFACE")
 
49
                    break 2;;
 
50
            esac
50
51
        done
51
52
        exit
52
53
    done
122
123
        ROUTES=`eval 'echo "$ROUTES_'"$KEY"\"`
123
124
        if [ -n "$ROUTES" ]; then
124
125
            for route in $ROUTES; do
125
 
                "$ip" route add "$route" dev "$BRIDGE"
 
126
                "$ip" route add "$route" dev "$INTERFACE"
126
127
            done
127
128
        fi
128
129
    done