Skip to content

Commit

Permalink
Merge branch 'MobilityManager' into Development
Browse files Browse the repository at this point in the history
This version includes functionalities for client scanning by means of an
auxiliary wireless interface.
  • Loading branch information
luissequeira committed Jan 31, 2017
2 parents 5ef1cb6 + b8591ba commit 55e398a
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 59 deletions.
40 changes: 27 additions & 13 deletions agent-click-file-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
print ' If HIDDEN is 0, then the AP will also send responses to active scans with an empty SSID'
print ''
print 'Example:'
print '$ python %s X 50 XX:XX:XX:XX:XX:XX 192.168.1.X 2819 /sys/kernel/debug/ieee80211/phy0/ath9k/bssid_extra odin-unizar 192.168.1.Y L MM N P 0 > agent.click' %(sys.argv[0])
print '$ python agent-click-file-gen.py 9 50 60:E3:27:4F:C7:E1 192.168.1.129 2819 /sys/kernel/debug/ieee80211/phy0/ath9k/bssid_extra wi5-demo 192.168.1.9 1 01 108 25 0 > agent.cli' %(sys.argv[0])
print ''
print 'and then run the .click file you have generated'
print 'click$ ./bin/click agent.click'
Expand All @@ -51,8 +51,8 @@
ODIN_MASTER_PORT = sys.argv[5]
DEBUGFS_FILE = sys.argv[6]
SSIDAGENT = sys.argv[7]
DEFAULT_GW = sys.argv[8] #the IP address of the Access Point.
AP_UNIQUE_IP = sys.argv[8] # IP address of the wlan0 interface of the router where Click runs (in monitor mode). It seems it does not matter.
DEFAULT_GW = sys.argv[8] #the IP address of the Access Point.
AP_UNIQUE_IP = sys.argv[8] # IP address of the wlan0 interface of the router where Click runs (in monitor mode). It seems it does not matter.
DEBUG_CLICK = int(sys.argv[9])
DEBUG_ODIN = int(sys.argv[10])
TX_RATE = int(sys.argv[11])
Expand All @@ -61,22 +61,24 @@

# Set the value of some constants
NETWORK_INTERFACE_NAMES = "mon" # beginning of the network interface names in monitor mode. e.g. mon
TAP_INTERFACE_NAME = "ap" # name of the TAP device that Click will create in the
STA_IP = "192.168.1.11" # IP address of the STA in the LVAP tuple. It only works for a single client without DHCP
TAP_INTERFACE_NAME = "ap" # name of the TAP device that Click will create in the
STA_IP = "192.168.1.11" # IP address of the STA in the LVAP tuple. It only works for a single client without DHCP
STA_MAC = "74:F0:6D:20:D4:74" # MAC address of the STA in the LVAP tuple. It only works for a single client without DHCP

print '''
// This is the scheme:
//
// TAP interface 'ap' in the machine that runs Click
// | ^
// from host | | to host
// v |
// click
// | ^
// to device | | to device
// V |
// 'mon0' interface in the machine that runs Click. Must be in monitor mode
// | ^
// from host | | to host
// v |
// --------------
// | click |
// --------------
// | ^ | ^
// to device | | | | to device
// V | V |
// 'mon0' 'mon1' interfaces in the machine that runs Click. Must be in monitor mode
//
'''

Expand Down Expand Up @@ -183,6 +185,18 @@
-> [0]odinagent
''' % ( NETWORK_INTERFACE_NAMES )

print '''
// ----------------Packets coming up (from the STA to the AP) go to the input 0 of the Odin Agent
from_dev1 :: FromDevice(%s1, HEADROOM 50)
-> RadiotapDecap()
-> ExtraDecap()
-> phyerr_filter1 :: FilterPhyErr()
-> tx_filter1 :: FilterTX()
-> dupe1 :: WifiDupeFilter() // Filters out duplicate 802.11 packets based on their sequence number
// click/elements/wifi/wifidupefilter.hh
-> [2]odinagent
''' % ( NETWORK_INTERFACE_NAMES )

print '''
odinagent[0]
-> q
Expand Down
28 changes: 17 additions & 11 deletions scripts_start_ap_odin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ VSCTL="ovs-vsctl"

## Setting interfaces
echo "Setting interfaces"
ifconfig wlan0 down # Main interface
ifconfig wlan1 down # Auxiliary interface
ifconfig wlan0 down
ifconfig wlan1 down
iw phy phy0 interface add mon0 type monitor
iw phy phy1 interface add mon1 type monitor
iw phy phy0 set retry short 4
iw phy phy1 set retry short 4
#iw dev wlan0 set channel 1
ifconfig mon0 up
ifconfig mon1 up
ifconfig wlan0 up
Expand All @@ -27,9 +27,17 @@ route add -net 155.210.156.0 netmask 255.255.255.0 gw 155.210.157.254 eth0
#route del default gw 155.210.157.254
#route add default gw 192.168.1.131

## We assume that OpenvSwitch runs when OpenWRT starts up
echo "Restarting OpenvSwitch daemon"
## Mount USB
echo "Mounting USB"
if [ ! -d "/mnt/usb" ]; then
mkdir -p /mnt/usb
fi
mount /dev/sda1 /mnt/usb/

## OVS
echo "Restarting OpenvSwitch"
/etc/init.d/openvswitch stop
sleep 1
echo "Cleaning DB"
if [ -d "/etc/openvswitch" ]; then
rm -r /etc/openvswitch
Expand All @@ -43,8 +51,8 @@ fi
if [ -f "/var/run/ovs-vswitchd.pid" ]; then
rm /var/run/ovs-vswitchd.pid
fi
echo "Lanching OVS"
/etc/init.d/openvswitch start
echo "Configuring OpenvSwitch"
$VSCTL add-br $SW # Create the bridge
ifconfig $SW up # In OpenWrt 15.05 the bridge is created down
$VSCTL set-controller $SW tcp:$CTLIP:6633 # Configure the OpenFlow Controller.
Expand All @@ -55,15 +63,13 @@ for i in $DPPORTS ; do # Including ports to OVS
done

## Launch click
echo "Mounting USB" # Because we have click into the USB
if [ ! -d "/mnt/usb" ]; then
mkdir -p /mnt/usb
fi
mount /dev/sda1 /mnt/usb/
echo "Lanching Click"
cd /mnt/usb
sleep 1
./click aagent9.cli &
sleep 1
# Add ap to OVS
echo "Adding Click interface to OVS"
ifconfig ap up # Adding ap interface (click Interface) to OVS
$VSCTL add-port $SW ap
sleep 1
Expand Down
Loading

0 comments on commit 55e398a

Please sign in to comment.