This file is indexed.

/etc/network/if-pre-up.d/linux-wlan-ng-pre-up is in linux-wlan-ng 0.2.9+dfsg-6.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#!/bin/sh
#
# This script takes care of bringing up wlan-ng device.
# It is run by ifup, and gets information from the 
# /etc/network/interfaces file. It is derived from the
# init.d/wlan script in the wlan-ng distribution 

case $IFACE in
wlan?)
	# Remainder of script.
;;
*)
	# Not a wlan-ng device.
	exit 0
;;
esac	

WLANCTL=/sbin/wlanctl-ng
PRIV_GENERATOR=/sbin/nwepgen

if [ ! -x $WLANCTL ] ; then 
	exit 0
fi

# Create a lock file; remove on script exit. This is a fairly crummy lock,
# but all it needs to do is prevent hotplug from calling this script,
# which may happen when the module is loaded below. Since it should only
# happen when the module is loaded, I don't need a proper lock.
if [ -e /var/lock/wlan-$IFACE.lock ]; then
	exit 0
fi
touch /var/lock/wlan-$IFACE.lock
cleanup () {
	rm -f /var/lock/wlan-$IFACE.lock
}
trap cleanup 0

# Translate some variable names from wireless-tools to make
# linux-wlan-ng more compatible with e.g. gnome-system-tools
# The new variables are only set if previously unset
: ${IF_WLAN_NG_KEY0:=$IF_WIRELESS_KEY}
if [ -n "$IF_WIRELESS_KEY" ]; then
	: ${IF_WIRELESS_ENC:=on}
fi
# End of translating hacks

#if [ -z "$IF_WIRELESS_MODE" ]; then
#	IF_WIRELESS_MODE="ad_hoc"
#fi

if [ -z "$IF_WLAN_NG_HOSTWEP" ]; then
	IF_WLAN_NG_HOSTWEP=false
fi

if [ -z "$IF_WLAN_NG_DEFAULT_KEY_ID" ]; then
	IF_WLAN_NG_DEFAULT_KEY_ID=0
fi

if [ -z "$IF_WLAN_NG_EXCLUDE_UNENCRYPTED" ]; then
	IF_WLAN_NG_EXCLUDE_UNENCRYPTED=true
fi

if [ -z "$IF_WLAN_NG_PRIV_KEY128" ]; then
	IF_WLAN_NG_PRIV_KEY128=false
fi

if [ -z "$IF_WLAN_NG_BCINT" ]; then
	IF_WLAN_NG_BCINT=100
fi

if [ -z "$IF_WLAN_NG_BASICRATES" ]; then
	IF_WLAN_NG_BASICRATES="2 4"
fi

if [ -z "$IF_WLAN_NG_OPRATES" ]; then
	IF_WLAN_NG_OPRATES="2 4 11 22"
fi

if [ -z "$IF_WLAN_NG_AUTHTYPE" ]; then
	IF_WLAN_NG_AUTHTYPE="opensystem"
fi

if [ -z "$IF_WIRELESS_CHANNEL" ]; then
	IF_WIRELESS_CHANNEL=1
fi

if [ ! -d /proc/net/p80211 ] && ! modprobe p80211; then
	echo "Failed to load p80211.ko." >&2
	exit 0
fi

# NOTE: We don't explicitly insmod the card driver here.  The
#  best thing to do is to specify an alias in /etc/modules.conf.
#  Then, the first time we call wlanctl with the named device,
#  the kernel module autoload stuff will take over.
#  But, if you prefer, you could modprobe it here.


# Bring the card up into an operable state.
result=`$WLANCTL $IFACE lnxreq_ifstate ifstate=enable`
if [ $? = 0 ] ; then
	eval $result
	if [ $resultcode != "success" ]; then
		echo "Failed to enable the device, resultcode=" $resultcode "." >&2
		exit 1
	fi
else
	echo "Failed to enable the device, exitcode=" $? "." >&2
	exit 1
fi

# Set user-specified MIB items.
for i in $IF_WLAN_NG_USER_MIBS; do
	result=`$WLANCTL $IFACE dot11req_mibset "mibattribute=$i"`

	if [ $? = 0 ] ; then
		eval $result
		if [ $resultcode != "success" ] ; then
			echo "Failed to set user MIB $i." >&2
			exit 1
		fi
	else
		echo "Failed to set user MIB $i." >&2
		exit 1
	fi
done

# Make the WEP key xx:xx:xx:xx:xx
format_key() {
  KEY="$1"

  # Don't touch a string key
  if [ x$(printf "%.2s" "$KEY") != "xs:" ]; then

    # Strip any delimiters (all non-digits)
    KEY=$(echo $KEY | tr -d -c '[:xdigit:]')

    # Inserts colon between pairs of hex digits
    while [ ${#KEY} -gt 2 ]; do
        NEWKEY=$(printf "%s%.2s:" "$NEWKEY" "$KEY")
        KEY=${KEY#??}
    done
    KEY=${NEWKEY}${KEY}
  fi
  echo $KEY
}

if [ "$IF_WIRELESS_ENC" = "on" ]; then
	# Set up WEP.
	result=`$WLANCTL $IFACE dot11req_mibget mibattribute=dot11PrivacyOptionImplemented`
	if [ $? = 0 ] ; then
		eval $result
		eval $mibattribute
	else
		echo "mibget failed." >&2
		exit 1
	fi
	
	if [ "$dot11PrivacyOptionImplemented" != "true" ]; then
		echo "Cannot enable privacy, dot11PrivacyOptionImplemented=$dot11PrivacyOptionImplemented." >&2
		exit 1
	fi

	$WLANCTL $IFACE lnxreq_hostwep decrypt=$IF_WLAN_NG_HOSTWEP encrypt=$IF_WLAN_NG_HOSTWEP >/dev/null
	
	$WLANCTL $IFACE dot11req_mibset \
		mibattribute=dot11WEPDefaultKeyID=$IF_WLAN_NG_DEFAULT_KEY_ID \
             >/dev/null
	
	$WLANCTL $IFACE dot11req_mibset \
		mibattribute=dot11ExcludeUnencrypted=$IF_WLAN_NG_EXCLUDE_UNENCRYPTED \
            >/dev/null

	$WLANCTL $IFACE dot11req_mibset \
		mibattribute=dot11PrivacyInvoked=true >/dev/null

	if [ -e "$IF_WLAN_NG_KEYFILE" ]; then
		IF_WLAN_NG_PRIV_GENSTR=`cat $IF_WLAN_NG_KEYFILE`
	fi
	if [ ! -z "$IF_WLAN_NG_PRIV_GENSTR" ]; then
		if [ "$IF_WLAN_NG_PRIV_KEY128" = "false" ]; then
			keys=`$PRIV_GENERATOR "$IF_WLAN_NG_PRIV_GENSTR" 5`
		else
			keys=`$PRIV_GENERATOR "$IF_WLAN_NG_PRIV_GENSTR" 13`
		fi

		knum=0
		for i in $keys; do
			$WLANCTL $IFACE dot11req_mibset \
				mibattribute=dot11WEPDefaultKey$knum=$i \
                             >/dev/null
			knum=$(expr $knum + 1)
		done
	else
		$WLANCTL $IFACE dot11req_mibset \
			mibattribute=dot11WEPDefaultKey0=`format_key $IF_WLAN_NG_KEY0` \
		     >/dev/null
		$WLANCTL $IFACE dot11req_mibset \
			mibattribute=dot11WEPDefaultKey1=`format_key $IF_WLAN_NG_KEY1` \
		     >/dev/null
		$WLANCTL $IFACE dot11req_mibset \
			mibattribute=dot11WEPDefaultKey2=`format_key $IF_WLAN_NG_KEY2` \
		     >/dev/null
		$WLANCTL $IFACE dot11req_mibset \
			mibattribute=dot11WEPDefaultKey3=`format_key $IF_WLAN_NG_KEY3` \
		     >/dev/null
	fi
fi
	
# MAC startup
if [ "$IF_WIRELESS_MODE" = "ad_hoc" ] || 
   [ "$IF_WIRELESS_MODE" = "ad-hoc" ]; then
	startcmd="$WLANCTL $IFACE dot11req_start "
	startcmd="$startcmd ssid=$IF_WIRELESS_ESSID"
	startcmd="$startcmd bsstype=independent"
	startcmd="$startcmd beaconperiod=$IF_WLAN_NG_BCINT"
	startcmd="$startcmd dtimperiod=3"
	startcmd="$startcmd cfpollable=false"
	startcmd="$startcmd cfpollreq=false"
	startcmd="$startcmd cfpperiod=3"
	startcmd="$startcmd cfpmaxduration=100"
	startcmd="$startcmd probedelay=100"
	startcmd="$startcmd dschannel=$IF_WIRELESS_CHANNEL"
	j=1
	for i in $IF_WLAN_NG_BASICRATES; do
		startcmd="$startcmd basicrate$j=$i"
		j=$(expr $j + 1)
	done
	j=1
	for i in $IF_WLAN_NG_OPRATES; do
		startcmd="$startcmd operationalrate$j=$i"
		j=$(expr $j + 1)
	done

	results=`$startcmd`
	if [ $? = 0 ]; then 
		eval $results
		if [ $resultcode != "success" ] ; then
			echo "IBSS not started, resultcode=$resultcode" >&2
			exit 1
		fi
	else
		echo FAILED: $startcmd >&2
		exit 1
	fi
else
	# Infrastructure mode.
	results=`$WLANCTL $IFACE lnxreq_autojoin \
		"ssid=$IF_WIRELESS_ESSID" \
		authtype=$IF_WLAN_NG_AUTHTYPE | sed 's/\([^=]*\)=\(.*\)/\1="\2"/'`
	if [ $? = 0 ]; then
		eval $results
		if [ ${resultcode:-"failure"} != "success" ]; then
			echo 'error: Autojoin indicated failure!' >&2
			exit 1
		fi
	fi
fi