From c61d58e172890879b8fd89cc84995d650db5b717 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Fri, 18 Apr 2014 08:53:54 -0700 Subject: [PATCH] Add initial support for a monitor interface to be used for SSID based identification. ref BBHN->ticket:28 --- files/etc/config.mesh/network | 3 +++ files/etc/config.mesh/wireless | 4 ++++ files/usr/local/bin/aimer | 8 +++++--- files/www/cgi-bin/setup | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/files/etc/config.mesh/network b/files/etc/config.mesh/network index 52399ed2..f9cf668c 100644 --- a/files/etc/config.mesh/network +++ b/files/etc/config.mesh/network @@ -38,3 +38,6 @@ config interface dtdlink option proto static option ipaddr option netmask 255.0.0.0 + +config interface wifi_mon + option proto none diff --git a/files/etc/config.mesh/wireless b/files/etc/config.mesh/wireless index bd223825..06125f20 100644 --- a/files/etc/config.mesh/wireless +++ b/files/etc/config.mesh/wireless @@ -12,3 +12,7 @@ config wifi-iface option ssid "" option encryption none +config wifi-iface + option device radio0 + option network wifi_mon + option mode monitor diff --git a/files/usr/local/bin/aimer b/files/usr/local/bin/aimer index e000c844..dc05cce5 100755 --- a/files/usr/local/bin/aimer +++ b/files/usr/local/bin/aimer @@ -65,7 +65,8 @@ sub aimmode_start { # Prep the system system('/etc/init.d/linkled stop'); system('/etc/init.d/olsrd stop'); - system('/sbin/ifconfig wlan0 down'); + system('/sbin/ifdown wifi'); + system('/sbin/ifdown wifi_mon'); system('/usr/sbin/iw phy phy0 interface add mon0 type monitor'); system('/usr/sbin/iw dev mon0 set channel 1'); system('/sbin/ifconfig mon0 up'); @@ -93,8 +94,9 @@ sub aimmode_shutdown { close ($LINK3_led); close ($LINK2_led); close ($LINK1_led); - # Brining up wifi is a bit more complicated than just ifconfig up so we let `wifi` handle it ... Wifi takes a bit to finish so sleep 10s - system('/sbin/wifi'); + # Brining up wifi is a bit more complicated than just ifconfig up so we let `ifup` handle it ... takes a bit to finish so sleep 10s + system('ifup wifi'); + system('ifup wifi_mon'); print "Please wait while we restart the services"; sleep 10; system('/etc/init.d/olsrd start'); diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index 17c1ab94..b67d1efd 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -140,8 +140,10 @@ if($parms{button_apply} or $parms{button_save}) $cmd .= "echo $wifi_txant > /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask;"; } else { $cmd .= "ifdown wifi >/dev/null 2>&1;"; + $cmd .= "ifdown wifi_mon >/dev/null 2>&1;"; $cmd .= "iw phy phy0 set antenna $wifi_txantenna $wifi_rxantenna >/dev/null 2>&1;"; $cmd .= "ifup wifi >/dev/null 2>&1;"; + $cmd .= "ifup wifi_mon >/dev/null 2>&1;"; } $cmd .= "iw phy phy0 set distance $wifi_distance >/dev/null 2>&1;"; $cmd .= "iwconfig wlan0 txpower $wifi_txpower >/dev/null 2>&1;";