Commit a4fce333 authored by Bruno Randolf's avatar Bruno Randolf

import what i released in dec 2005

parents
This diff is collapsed.
# olsr scanning tool
#
# Copyright (C) 2005 Bruno Randolf
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
NAME=horst
OBJS=protocol_parser.o main.o display.o
LIBS=-l ncurses
CFLAGS=-Wall
all: $(NAME)
protocol_parser.o: ieee80211_header.h prism_header.h olsr_header.h
main.o: main.h
display.o: display.h
$(NAME): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
clean:
-rm -f *.o
-rm -f $(NAME)
\ No newline at end of file
HORST - Horsts Olsr Radio Scanning Tool
---------------------------------------
Copyright (C) 2005 Bruno Randolf
Released under the GPL
"horst" is a scanning and analysis tool for wireless OLSR nodes in ad-hoc mode.
problem description: with the usual wireless tools like iwconfig and iwspy it is hard
to measure the received signal strength (or SNR) for each of the different nodes which
form an ad-hoc network. this information however is very important for setting up,
debugging and optimizing wireless OLSR mesh networks.
"horst" aims to fill this gap and lists the single nodes of an ad-hoc network
seperately including the signal strength (SNR) of the last received packet from each node.
this way you can see which nodes are part of a specific ad-hoc cell (BSSID), discover
problems with ad-hoc cell merging (a problem of many wlan drivers), which of the
nodes send OLSR packets, wether they use the link quality exension, how many neighbors
each node sees and the SNR of the last received packet of each station.
it uses the monitor mode including prism2 headers (for the signal strength information)
of the wlan cards and listens to all packets which come in the wireless interface.
these packets are scanned for OLSR traffic and summarized by the MAC address of the
sending node. [actually what it does is quite similar to kismet, and in might be a good
idea to include this functionality into kismet.]
it should work with any wlan card which can do monitor mode and which has prism2 headers
in monitor mode. but it has been tested only with the following wlan chipsets/drivers:
* prism2 with hostap
* atheros with madwifi-ng
you have to put your card in monitor mode and set the channel manually before you start
the tool:
1.) put card in monitor mode:
hostap:
# iwconfig wlan0 mode monitor
madwifi-ng:
# wlanconfig wlan0 create wlandev wifi0 wlanmode monitor
2.) enable prism headers in monitor mode
hostap:
# iwpriv wlan0 monitor_type 1
or
# prism2_param wlan0 monitor_type 1
(madwifi-ng: prism headers are enabled by default)
3.) tune to a channel
# ifconfig wlan0 up
# iwconfig wlan0 channel 10
4.) start tool
# ./horst
/* olsr scanning tool
*
* Copyright (C) 2005 Bruno Randolf
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "display.h"
#include "ieee80211_header.h"
#include "olsr_header.h"
#include <stdio.h>
#include <curses.h>
WINDOW *dump_win;
WINDOW* dump_win_box;
WINDOW *list_win;
WINDOW *stat_win;
static void update_stat_win(struct packet_info* pkt);
static void update_list_win(void);
static int do_sort=1;
void
init_display(void)
{
initscr();
start_color(); /* Start the color functionality */
keypad(stdscr, TRUE);
nonl(); /* tell curses not to do NL->CR/NL on output */
cbreak(); /* take input chars one at a time, no wait for \n */
noecho(); /* echo input - in color */
nodelay(stdscr,TRUE);
init_pair(1, COLOR_CYAN, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
init_pair(5, COLOR_WHITE, COLOR_BLACK);
move(0,COLS/2-20);
printw("HORST - Horsts OLSR Radio Scanning Tool");
refresh();
list_win = newwin(LINES/2-1, COLS, 1, 0);
scrollok(list_win,FALSE);
wrefresh(list_win);
stat_win = newwin(LINES/2, 15, LINES/2, COLS-15);
box(stat_win, 0 , 0);
mvwprintw(stat_win,0,2," status ");
wattron(stat_win, COLOR_PAIR(2));
scrollok(stat_win,FALSE);
wrefresh(stat_win);
dump_win_box = newwin(LINES/2, COLS-15, LINES/2, 0);
box(dump_win_box, 0 , 0);
mvwprintw(dump_win_box,0,1,"Sig/Noi");
mvwprintw(dump_win_box,0,9,"SOURCE");
mvwprintw(dump_win_box,0,27,"(BSSID)");
mvwprintw(dump_win_box,0,47,"TYPE");
mvwprintw(dump_win_box,0,54,"INFO");
wrefresh(dump_win_box);
dump_win = newwin(LINES/2-2, COLS-15-2, LINES/2+1, 1);
wattron(dump_win, COLOR_PAIR(1));
scrollok(dump_win,TRUE);
wrefresh(dump_win);
}
void
finish_display(int sig)
{
printw("CLEAN");
endwin();
}
void
handle_user_input()
{
int key;
key = getch();
switch(key) {
case ' ': case 'p': case 'P':
paused = paused ? 0 : 1;
update_stat_win(NULL);
break;
case 'o': case 'O':
olsr_only = olsr_only ? 0 : 1;
update_stat_win(NULL);
break;
case 'q': case 'Q':
finish_all(0);
case 's': case 'S':
do_sort = do_sort ? 0 : 1;
break;
/* not yet:
case 'c': case 'C':
pause = 1;
show_channel_win();
break;
*/
case KEY_RESIZE: /* xterm window resize event */
endwin();
init_display();
}
}
void
update_display(struct packet_info* pkt)
{
if (pkt->olsr_type>0)
if (pkt->pkt_types & PKT_TYPE_OLSR)
wattron(dump_win,A_BOLD);
/* print */
wprintw(dump_win,"%03d/%03d %s ",
pkt->prism_signal, pkt->prism_noise,
ether_sprintf(pkt->wlan_src));
wprintw(dump_win,"(%s) ", ether_sprintf(pkt->wlan_bssid));
if (pkt->pkt_types & PKT_TYPE_BEACON) {
//wprintw(dump_win,"BEACON %02x%02x%02x%02x%02x%02x%02x%02x", pkt->wlan_tsf[7], pkt->wlan_tsf[6], pkt->wlan_tsf[5], pkt->wlan_tsf[4], pkt->wlan_tsf[3], pkt->wlan_tsf[2], pkt->wlan_tsf[1], pkt->wlan_tsf[0] );
wprintw(dump_win,"BEACON %s", pkt->wlan_essid );
}
else if (pkt->pkt_types & PKT_TYPE_PROBE_REQ) {
wprintw(dump_win,"PROBE_REQUEST" );
}
else if (pkt->pkt_types & PKT_TYPE_OLSR) {
wprintw(dump_win,"OLSR %s ", ip_sprintf(pkt->ip_src));
switch (pkt->olsr_type) {
case HELLO_MESSAGE: wprintw(dump_win,"HELLO"); break;
case TC_MESSAGE: wprintw(dump_win,"TC"); break;
case MID_MESSAGE: wprintw(dump_win,"MID");break;
case HNA_MESSAGE: wprintw(dump_win,"HNA"); break;
case LQ_HELLO_MESSAGE: wprintw(dump_win,"LQ_HELLO"); break;
case LQ_TC_MESSAGE: wprintw(dump_win,"LQ_TC"); break;
default: wprintw(dump_win,"UNKNOWN");
}
}
else if (pkt->pkt_types & PKT_TYPE_DATA) {
wprintw(dump_win,"IP %s ", ip_sprintf(pkt->ip_src));
}
else if (pkt->pkt_types & PKT_TYPE_DATA) {
wprintw(dump_win,"DATA");
}
else {
wprintw(dump_win,"UNKNOWN");
}
wprintw(dump_win,"\n");
wattroff(dump_win,A_BOLD);
wrefresh(dump_win);
update_stat_win(pkt);
update_list_win();
}
static void
update_stat_win(struct packet_info* pkt)
{
if (pkt!=NULL)
{
int snr = pkt->snr;
int max_bar = LINES/2-2;
snr=(snr/60.0)*max_bar; /* normalize for bar, assume max received SNR is 60 */
if (snr>max_bar) snr=max_bar; /* cap if still bigger */
wattron(stat_win, COLOR_PAIR(2));
mvwvline(stat_win, 1, 2, ' ', max_bar-snr);
mvwvline(stat_win, max_bar-snr+1, 2, ACS_BLOCK, snr);
mvwvline(stat_win, 1, 3, ' ', max_bar-snr);
mvwvline(stat_win, max_bar-snr+1, 3, ACS_BLOCK, snr);
mvwprintw(stat_win, LINES/2-4,6,"SIG:%03d", pkt->prism_signal);
mvwprintw(stat_win, LINES/2-3,6,"NOI:%03d", pkt->prism_noise);
mvwprintw(stat_win, LINES/2-2,6,"SNR:%02d", pkt->snr);
}
wattron(stat_win, COLOR_PAIR(5));
mvwprintw(stat_win,2,6,"q: QUIT");
if (paused)
mvwprintw(stat_win,3,6,"p: PAUSE");
else
mvwprintw(stat_win,3,6,"p: RUN ");
if (olsr_only)
mvwprintw(stat_win,4,6,"o: OLSR");
else
mvwprintw(stat_win,4,6,"o: ALL ");
if (do_sort)
mvwprintw(stat_win,5,6,"s: SORT ");
else
mvwprintw(stat_win,5,6,"s: !SORT");
wrefresh(stat_win);
}
static void
print_list_line(int line, int i, struct packet_info* p)
{
if (nodes[i].pkt_types & PKT_TYPE_OLSR)
wattron(list_win,A_BOLD);
mvwprintw(list_win,line,1,"%2d %03d/%03d %s",
p->snr,
p->prism_signal, p->prism_noise,
ether_sprintf(p->wlan_src));
mvwprintw(list_win,line,29," (%s)", ether_sprintf(nodes[i].wlan_bssid));
if (nodes[i].pkt_types & PKT_TYPE_IP)
mvwprintw(list_win,line,50,"%s", ip_sprintf(nodes[i].ip_src));
if (nodes[i].pkt_types & PKT_TYPE_OLSR_LQ)
mvwprintw(list_win,line,66,"LQ");
if (nodes[i].pkt_types & PKT_TYPE_OLSR_GW)
mvwprintw(list_win,line,69,"GW");
if (nodes[i].pkt_types & PKT_TYPE_OLSR)
mvwprintw(list_win,line,72,"N:%d", nodes[i].olsr_neigh);
mvwprintw(list_win,line,78,"%d/%d", nodes[i].olsr_count, nodes[i].pkt_count);
wattroff(list_win,A_BOLD);
}
static void
update_list_win(void)
{
int i;
int s;
int line=0;
struct packet_info* p;
time_t now;
now = time(NULL);
werase(list_win);
wattron(list_win,COLOR_PAIR(5));
box(list_win, 0 , 0);
mvwprintw(list_win,0,1,"SN");
mvwprintw(list_win,0,4,"Sig/Noi");
mvwprintw(list_win,0,12,"SOURCE");
mvwprintw(list_win,0,30,"(BSSID)");
mvwprintw(list_win,0,50,"IP");
mvwprintw(list_win,0,66,"LQ GW NEIGH");
mvwprintw(list_win,0,78,"OLSR/COUNT");
wattron(list_win,COLOR_PAIR(1));
if (do_sort) {
/* sort by SNR: probably the most inefficient way to do it ;) */
for (s=100; s>0; s--) {
for (i=0; i<MAX_NODES; i++) {
if (nodes[i].status == 1) {
p = &nodes[i].last_pkt;
if ((p->snr) == s
&& nodes[i].last_seen > now - NODE_TIMEOUT) {
line++;
print_list_line(line,i,p);
}
}
else
break;
}
}
}
else {
for (i=0; i<MAX_NODES; i++) {
if (nodes[i].status == 1
&& nodes[i].last_seen > now - NODE_TIMEOUT) {
p = &nodes[i].last_pkt;
line++;
print_list_line(line,i,p);
}
}
}
wrefresh(list_win);
}
#if 0 /* not used yet */
static void
show_channel_win()
{
char buf[255];
WINDOW* chan_win = newwin(3, 30, LINES/2-5, COLS/2-10);
box(chan_win, 0 , 0);
mvwprintw(chan_win,1,2,"enter channel number: ");
wrefresh(chan_win);
echo();
nodelay(stdscr,FALSE);
getnstr(buf,255);
mvwprintw(chan_win,1,20,"%s",buf);
nodelay(stdscr,TRUE);
noecho();
wrefresh(chan_win);
delwin(chan_win);
paused = 0;
wrefresh(list_win);
}
#endif
void
dump_packet(const unsigned char* buf, int len)
{
int i;
for (i = 0; i < len; i++) {
if ((i%2) == 0)
DEBUG(" ");
if ((i%16) == 0)
DEBUG("\n");
DEBUG("%02x", buf[i]);
}
DEBUG("\n");
}
const char*
ether_sprintf(const unsigned char *mac)
{
static char etherbuf[18];
snprintf(etherbuf, sizeof(etherbuf), "%02x:%02x:%02x:%02x:%02x:%02x",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
return etherbuf;
}
const char*
ip_sprintf(const unsigned int ip)
{
static char ipbuf[18];
unsigned char* cip = (unsigned char*)&ip;
snprintf(ipbuf, sizeof(ipbuf), "%d.%d.%d.%d",
cip[0], cip[1], cip[2], cip[3]);
return ipbuf;
}
/* olsr scanning tool
*
* Copyright (C) 2005 Bruno Randolf
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DISPLAY_H_
#define _DISPLAY_H_
#include "main.h"
void update_display(struct packet_info* pkg);
void handle_user_input();
void dump_packet(const unsigned char* buf, int len);
const char* ether_sprintf(const unsigned char *mac);
const char* ip_sprintf(const unsigned int ip);
void init_display(void);
void finish_display(int sig);
#endif
/* olsr scanning tool
*
* Copyright (C) 2005 Bruno Randolf
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _IEEE80211_HEADER_H_
#define _IEEE80211_HEADER_H_
#include <sys/types.h>
typedef u_int8_t u8;
typedef u_int16_t u16;
/* from hostap_80211.h */
struct ieee80211_hdr {
u16 frame_control;
u16 duration_id;
u8 addr1[6];
u8 addr2[6];
u8 addr3[6];
u16 seq_ctrl;
u8 addr4[6];
} __attribute__ ((packed));
#define IEEE80211_HEADER_LEN 24 /* 3 addr data frame */
struct ieee80211_mgmt {
u16 frame_control;
u16 duration;
u8 da[6];
u8 sa[6];
u8 bssid[6];
u16 seq_ctrl;
union {
struct {
u16 auth_alg;
u16 auth_transaction;
u16 status_code;
/* possibly followed by Challenge text */
u8 variable[0];
} __attribute__ ((packed)) auth;
struct {
u16 reason_code;
} __attribute__ ((packed)) deauth;
struct {
u16 capab_info;
u16 listen_interval;
/* followed by SSID and Supported rates */
u8 variable[0];
} __attribute__ ((packed)) assoc_req;
struct {
u16 capab_info;
u16 status_code;
u16 aid;
/* followed by Supported rates */
u8 variable[0];
} __attribute__ ((packed)) assoc_resp, reassoc_resp;
struct {
u16 capab_info;
u16 listen_interval;
u8 current_ap[6];
/* followed by SSID and Supported rates */
u8 variable[0];
} __attribute__ ((packed)) reassoc_req;
struct {
u16 reason_code;
} __attribute__ ((packed)) disassoc;
struct {
} __attribute__ ((packed)) probe_req;
struct {
u8 timestamp[8];
u16 beacon_int;
u16 capab_info;
/* followed by some of SSID, Supported rates,
* FH Params, DS Params, CF Params, IBSS Params, TIM */
u8 variable[0];
} __attribute__ ((packed)) beacon, probe_resp;
} u;
} __attribute__ ((packed));
#define BIT(x) (1 << (x))
/* IEEE 802.11 defines */
#define WLAN_FC_PVER (BIT(1) | BIT(0))
#define WLAN_FC_TODS BIT(8)
#define WLAN_FC_FROMDS BIT(9)
#define WLAN_FC_MOREFRAG BIT(10)
#define WLAN_FC_RETRY BIT(11)
#define WLAN_FC_PWRMGT BIT(12)
#define WLAN_FC_MOREDATA BIT(13)
#define WLAN_FC_ISWEP BIT(14)
#define WLAN_FC_ORDER BIT(15)
#define WLAN_FC_GET_TYPE(fc) (((fc) & (BIT(3) | BIT(2))) >> 2)
#define WLAN_FC_GET_STYPE(fc) \
(((fc) & (BIT(7) | BIT(6) | BIT(5) | BIT(4))) >> 4)
#define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
#define WLAN_GET_SEQ_SEQ(seq) \
(((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
#define WLAN_FC_TYPE_MGMT 0
#define WLAN_FC_TYPE_CTRL 1
#define WLAN_FC_TYPE_DATA 2
/* management */
#define WLAN_FC_STYPE_ASSOC_REQ 0
#define WLAN_FC_STYPE_ASSOC_RESP 1
#define WLAN_FC_STYPE_REASSOC_REQ 2
#define WLAN_FC_STYPE_REASSOC_RESP 3
#define WLAN_FC_STYPE_PROBE_REQ 4
#define WLAN_FC_STYPE_PROBE_RESP 5
#define WLAN_FC_STYPE_BEACON 8
#define WLAN_FC_STYPE_ATIM 9
#define WLAN_FC_STYPE_DISASSOC 10
#define WLAN_FC_STYPE_AUTH 11
#define WLAN_FC_STYPE_DEAUTH 12
/* control */
#define WLAN_FC_STYPE_PSPOLL 10
#define WLAN_FC_STYPE_RTS 11
#define WLAN_FC_STYPE_CTS 12
#define WLAN_FC_STYPE_ACK 13
#define WLAN_FC_STYPE_CFEND 14
#define WLAN_FC_STYPE_CFENDACK 15
/* data */
#define WLAN_FC_STYPE_DATA 0
#define WLAN_FC_STYPE_DATA_CFACK 1
#define WLAN_FC_STYPE_DATA_CFPOLL 2
#define WLAN_FC_STYPE_DATA_CFACKPOLL 3
#define WLAN_FC_STYPE_NULLFUNC 4
#define WLAN_FC_STYPE_CFACK 5
#define WLAN_FC_STYPE_CFPOLL 6
#define WLAN_FC_STYPE_CFACKPOLL 7
/* Authentication algorithms */
#define WLAN_AUTH_OPEN 0
#define WLAN_AUTH_SHARED_KEY 1
#define WLAN_AUTH_CHALLENGE_LEN 128
#define WLAN_CAPABILITY_ESS BIT(0)
#define WLAN_CAPABILITY_IBSS BIT(1)
#define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
#define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
#define WLAN_CAPABILITY_PRIVACY BIT(4)
/* Status codes */
#define WLAN_STATUS_SUCCESS 0
#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
#define WLAN_STATUS_CAPS_UNSUPPORTED 10
#define WLAN_STATUS_REASSOC_NO_ASSOC 11
#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
#define WLAN_STATUS_CHALLENGE_FAIL 15
#define WLAN_STATUS_AUTH_TIMEOUT 16
#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
#define WLAN_STATUS_ASSOC_DENIED_RATES 18
/* 802.11b */
#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
/* IEEE 802.11i */
#define WLAN_STATUS_INVALID_IE 40
#define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
#define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
#define WLAN_STATUS_AKMP_NOT_VALID 43
#define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
#define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
#define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
/* Reason codes */
#define WLAN_REASON_UNSPECIFIED 1
#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
#define WLAN_REASON_DEAUTH_LEAVING 3
#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
#define WLAN_REASON_DISASSOC_AP_BUSY 5
#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
/* IEEE 802.11i */
#define WLAN_REASON_INVALID_IE 13
#define WLAN_REASON_MICHAEL_MIC_FAILURE 14
#define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
#define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
#define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
#define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
#define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
#define WLAN_REASON_AKMP_NOT_VALID 20
#define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
#define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
#define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
#define WLAN_REASON_CIPHER_SUITE_REJECTED 24
/* Information Element IDs */
#define WLAN_EID_SSID 0
#define WLAN_EID_SUPP_RATES 1
#define WLAN_EID_FH_PARAMS 2
#define WLAN_EID_DS_PARAMS 3
#define WLAN_EID_CF_PARAMS 4
#define WLAN_EID_TIM 5
#define WLAN_EID_IBSS_PARAMS 6
#define WLAN_EID_CHALLENGE 16
#define WLAN_EID_RSN 48
#define WLAN_EID_GENERIC 221
#endif
/* olsr scanning tool
*
* Copyright (C) 2005 Bruno Randolf
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <sys/ioctl.h>
//#include <net/if.h> /* not needed since we include linux/wireless.h */
#include <string.h>
#include <getopt.h>
#include <signal.h>
#include <time.h>
#include <linux/wireless.h> /* it's not good to include kernel headers, i know... ;( */
#include "protocol_parser.h"
#include "display.h"
#include "main.h"
static int device_index(int fd, const char *if_name);
static void device_promisc(int fd, const char *if_name, int on);
static int init_packet_socket(char* devname);
static void get_options(int argv, char** argc);
static void node_update(struct packet_info* pkt);
struct packet_info current_packet;
struct node_info nodes[MAX_NODES]; /* no, i dont want to implement a list now */
char* ifname = "wlan0";
int paused = 0;
int olsr_only = 0;
static int mon; /* monitoring socket */