1#! /bin/sh
2#
3# Setup an ap that accepts wds traffic from associated stations.
4# This can be used as the "back end" for setup.extender and/or
5# setup.repeater.  Note that the wds vap's are created by the
6# wlanwds program that listens for wds discovery events (to create
7# wds vaps) and for sta leave events (to destroy wds vaps it
8# created).  The WDSUP script is invoked for each wds vap that
9# gets created--to add the vap to a bridge.
10#
11# $FreeBSD: src/tools/tools/net80211/scripts/setup.wdsmain,v 1.2 2009/04/15 22:11:04 sam Exp $
12#
13PATH=.:$PATH
14. config
15
16SSID='freebsd+wdsmain'
17WDSUP=$TMPDIR/wdsup$$
18
19#mwldebug state+node+reset+xmit+recv+beacon+hal+hal2
20WLAN_AP=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
21ifconfig $WLAN_AP ssid "$SSID" channel $CHANNEL mtu 1500
22ifconfig $WLAN_AP dwds -apbridge
23wlandebug -i $WLAN_AP state+scan+assoc+auth+wds+11n
24
25BRIDGE=`ifconfig bridge create`
26
27# NB: start wlanwds first to avoid races.
28rm -f $WDSUP
29cat >$WDSUP <<EOF
30#! /bin/sh
31DEV=\$1
32ifconfig $BRIDGE addm \$DEV
33ifconfig \$DEV up
34EOF
35chmod +x $WDSUP
36$WLANWDS -v -s $WDSUP &
37
38ifconfig $BRIDGE addm $WLAN_AP addm $WIRED up
39ifconfig $WIRED up
40ifconfig $WLAN_AP up
41