Work on data channel
This commit is contained in:
parent
bc5dea6016
commit
259c6c5e66
@ -9,6 +9,7 @@ OBJS = \
|
||||
discovery_cache.o\
|
||||
rpc.o\
|
||||
statemachine.o\
|
||||
hapd.o
|
||||
|
||||
ACTOBJS = \
|
||||
act.o
|
||||
@ -26,8 +27,10 @@ LIBS+=-lnettle
|
||||
LIBS+=-lssl
|
||||
LIBS+=-lcrypto
|
||||
LIBS+=-ledit
|
||||
LIBS+=-lwifi
|
||||
#LIBS+=-l:libhapd.a
|
||||
|
||||
INCL_DIRS=-I../ -I/usr/local/include -I./ -I../../include
|
||||
INCL_DIRS=-I../ -I/usr/local/include -I./ -I../../include -I../../include/hostapd -I../../include/hostapd/utils
|
||||
#FLAGS=-DWITH_IPV6 -DWITH_OPENSSL -DSYS_ARCH="$(ARCH)" -DSYS_ARCH="XXX"
|
||||
FLAGS=-DWITH_IPV6 -DUSE_OPENSSL -DSYS_ARCH='"$(KERNEL)/$(ARCH)"'
|
||||
|
||||
|
@ -20,6 +20,7 @@ enum {
|
||||
int start_rpc(cw_Cfg_t *global_cfg);
|
||||
int test_shell();
|
||||
|
||||
void hapd_run();
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -211,6 +211,7 @@ return 0;
|
||||
*/
|
||||
|
||||
static cw_Cfg_t * global_cfg = NULL;
|
||||
void process_wtp_packet (int index, struct sockaddr *addr, uint8_t * buffer, int len, int dta);
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
@ -236,6 +237,8 @@ int main (int argc, char *argv[])
|
||||
goto errX;
|
||||
};
|
||||
|
||||
hapd_run(); // init
|
||||
//stop();
|
||||
//const char *ttt = cw_cfg_get(global_cfg,"cisco/ssl-cipher",NULL);
|
||||
//printf("CFG: %s\n",ttt);
|
||||
//stop();
|
||||
@ -455,7 +458,7 @@ int ac_run(cw_Cfg_t * cfg)
|
||||
(struct sockaddr *) &srcaddr,
|
||||
&srcaddrlen);
|
||||
|
||||
process_cw_data_packet (i, (struct sockaddr *) &srcaddr, buffer, len);
|
||||
process_wtp_packet (i, (struct sockaddr *) &srcaddr, buffer, len,1);
|
||||
|
||||
}
|
||||
|
||||
@ -468,7 +471,7 @@ int ac_run(cw_Cfg_t * cfg)
|
||||
(struct sockaddr *) &srcaddr,
|
||||
&srcaddrlen);
|
||||
|
||||
process_ctrl_packet (i, (struct sockaddr *) &srcaddr, buffer, len);
|
||||
process_wtp_packet (i, (struct sockaddr *) &srcaddr, buffer, len,0);
|
||||
}
|
||||
|
||||
}
|
||||
@ -482,14 +485,14 @@ int ac_run(cw_Cfg_t * cfg)
|
||||
void process_cw_data_packet (int index, struct sockaddr *addr, uint8_t * buffer, int len)
|
||||
{
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
cw_dbg (DBG_X, "There is a data packet now");
|
||||
// cw_dbg (DBG_X, "There is a data packet now");
|
||||
|
||||
dataman_list_lock();
|
||||
cw_dbg (DBG_X, "Dataman list locked, now getting");
|
||||
// cw_dbg (DBG_X, "Dataman list locked, now getting");
|
||||
struct dataman * dm = dataman_list_get (socklist[index].data_sockfd, addr);
|
||||
cw_dbg (DBG_X, "Dataman list locked, now gotted");
|
||||
// cw_dbg (DBG_X, "Dataman list locked, now gotted");
|
||||
|
||||
cw_dbg (DBG_INFO, "Packet for dataman %s,%d", sock_addr2str_p (addr, sock_buf), socklist[index].data_sockfd);
|
||||
// cw_dbg (DBG_INFO, "Packet for dataman %s,%d", sock_addr2str_p (addr, sock_buf), socklist[index].data_sockfd);
|
||||
|
||||
if (!dm) {
|
||||
cw_dbg (DBG_INFO, "No dataman %s,%d", sock_addr2str_p (addr, sock_buf), socklist[index].data_sockfd);
|
||||
@ -501,10 +504,7 @@ void process_cw_data_packet (int index, struct sockaddr *addr, uint8_t * buffer,
|
||||
}
|
||||
|
||||
dataman_list_add (dm);
|
||||
|
||||
dataman_start (dm);
|
||||
|
||||
|
||||
}
|
||||
|
||||
dataman_list_unlock();
|
||||
@ -532,7 +532,7 @@ void process_cw_data_packet (int index, struct sockaddr *addr, uint8_t * buffer,
|
||||
}
|
||||
|
||||
|
||||
void process_cw_ctrl_packet (int index, struct sockaddr *addr, uint8_t * buffer, int len)
|
||||
void process_wtp_packet (int index, struct sockaddr *addr, uint8_t * buffer, int len, int dta)
|
||||
{
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
|
||||
@ -552,6 +552,10 @@ void process_cw_ctrl_packet (int index, struct sockaddr *addr, uint8_t * buffer,
|
||||
|
||||
|
||||
if (!wtpman) {
|
||||
if (dta){
|
||||
cw_dbg(DBG_PKT_ERR,"Data packet w/o wtpman received, ignoring");
|
||||
return;
|
||||
}
|
||||
|
||||
wtpman = wtpman_create (index, addr, preamble & 0xf, global_cfg);
|
||||
|
||||
@ -573,9 +577,12 @@ void process_cw_ctrl_packet (int index, struct sockaddr *addr, uint8_t * buffer,
|
||||
wtpman_start (wtpman, preamble & 0xf);
|
||||
}
|
||||
|
||||
//printf("Got Packet with len: %d\n",len);
|
||||
|
||||
wtpman_addpacket (wtpman, buffer, len);
|
||||
if(!dta)
|
||||
wtpman_addpacket (wtpman, buffer, len);
|
||||
else{
|
||||
// cw_dbg(DBG_X,"Data packet received");
|
||||
wtpman_datapacket (wtpman, buffer, len);
|
||||
}
|
||||
wtplist_unlock();
|
||||
}
|
||||
|
||||
@ -646,7 +653,7 @@ void process_ctrl_packet (int index, struct sockaddr *addr, uint8_t * buffer, in
|
||||
{
|
||||
switch (socklist[index].ac_proto) {
|
||||
case AC_PROTO_CAPWAP:
|
||||
process_cw_ctrl_packet (index, addr, buffer, len);
|
||||
// process_cw_ctrl_packet (index, addr, buffer, len);
|
||||
return;
|
||||
|
||||
/*case AC_PROTO_LWAPP:
|
||||
|
@ -80,7 +80,7 @@ struct dataman *dataman_list_get(int sock, struct sockaddr *addr)
|
||||
|
||||
struct dataman *dm = mavl_get(dataman_list, &search_dm);
|
||||
|
||||
cw_dbg(DBG_X,"Getting dataman %p",dm);
|
||||
// cw_dbg(DBG_X,"Getting dataman %p",dm);
|
||||
return dm;
|
||||
}
|
||||
|
||||
@ -169,6 +169,8 @@ int dataman_process_keep_alive(struct cw_Conn *nc, uint8_t *rawmsg, int len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#include <libwifi.h>
|
||||
|
||||
int dataman_process_message0(struct cw_Conn *nc, uint8_t * rawmsg, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
@ -178,20 +180,75 @@ int dataman_process_message0(struct cw_Conn *nc, uint8_t * rawmsg, int len,
|
||||
sprintf(fn,"wificap-%03d",c++);
|
||||
/// cw_save_file(fn,(char*)rawmsg,len);
|
||||
/// cw_dbg(DBG_X,"saving %d bytes",len);
|
||||
int offs = cw_get_hdr_msg_offset(rawmsg);
|
||||
int rc;
|
||||
uint8_t * dot11frame = rawmsg + offs;
|
||||
int dot11len = len-offs;
|
||||
|
||||
// cw_dbg(DBG_X,"802.11 - %s",dot11_get_frame_name(dot11frame));
|
||||
// extern void ppacket(uint8_t * p, int len);
|
||||
|
||||
|
||||
// ppacket (dot11frame,len-cw_get_hdr_msg_offset(rawmsg));
|
||||
|
||||
|
||||
struct libwifi_frame frame = {0};
|
||||
struct libwifi_frame resp={0};
|
||||
|
||||
// cw_dbg(DBG_X,"802.11 - %s",dot11_get_frame_name(dot11frame));
|
||||
// cw_dbg(DBG_X,"802.11 - T&S: %d %d",dot11_get_type(dot11frame),dot11_get_subtype(dot11frame));
|
||||
|
||||
rc = libwifi_get_wifi_frame(&frame, (unsigned char*)(dot11frame+1), dot11len-1, 0);
|
||||
|
||||
// cw_dbg(DBG_X,"Frame CTL:%d,%d",frame.frame_control.type, frame.frame_control.subtype);
|
||||
|
||||
|
||||
|
||||
// cw_dbg(DBG_X,"CMP???CTL:%d,%d (%d,%d)",frame.frame_control.type, frame.frame_control.subtype,
|
||||
// TYPE_MANAGEMENT,SUBTYPE_ASSOC_REQ);
|
||||
|
||||
// char ffr[1024];
|
||||
// cw_format_dot11_hdr(ffr,dot11frame,dot11len);
|
||||
// cw_dbg(DBG_X,ffr);
|
||||
//
|
||||
//
|
||||
|
||||
if (frame.frame_control.type == TYPE_MANAGEMENT &&
|
||||
frame.frame_control.subtype == SUBTYPE_ASSOC_REQ){
|
||||
// cw_dbg(DBG_X,"ASSOC REQ RECEIVED");
|
||||
/* libwifi_create_assoc_resp(&resp,
|
||||
frame.frame_control.transmitter,
|
||||
frame.frame_control.receiver,
|
||||
frame.frame_control.transmitter,
|
||||
1
|
||||
);*/
|
||||
|
||||
|
||||
|
||||
|
||||
// stop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t * dot11frame = rawmsg + cw_get_hdr_msg_offset(rawmsg);
|
||||
|
||||
cw_dbg(DBG_X,"802.11 - %s",dot11_get_frame_name(dot11frame));
|
||||
|
||||
/* The very first data message MUST be a keep-alive message */
|
||||
if (!cw_get_hdr_flag_k(rawmsg)){
|
||||
|
||||
cw_dbg(DBG_X,"No K Flag founde");
|
||||
// cw_dbg(DBG_X,"No K Flag founde");
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cw_dbg(DBG_X, "Goto Keep Alive Pack");
|
||||
// cw_dbg(DBG_X, "Goto Keep Alive Pack");
|
||||
return dataman_process_keep_alive(nc,rawmsg,len);
|
||||
}
|
||||
|
||||
@ -207,6 +264,9 @@ int dataman_process_message(struct cw_Conn *nc, uint8_t * rawmsg, int len,
|
||||
sprintf(fn,"wificap-%03d",c++);
|
||||
cw_save_file(fn,(char*)rawmsg,len);
|
||||
|
||||
extern void ppacket(uint8_t * p, int len);
|
||||
|
||||
ppacket (rawmsg,len);
|
||||
|
||||
cw_dbg(DBG_X,"There was someting else than dataman");
|
||||
|
||||
|
@ -310,6 +310,36 @@ int run_update(struct wtpman *wtpman)
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int dataman_process_msg(struct cw_Conn *nc, uint8_t * rawmsg, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
int offs = cw_get_hdr_msg_offset(rawmsg);
|
||||
uint8_t * dot11frame = rawmsg + offs;
|
||||
int dot11len = len-offs;
|
||||
cw_dbg_dot11_frame(dot11frame,dot11len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *wtpman_data_main(void *arg)
|
||||
{
|
||||
struct wtpman * wtpman = arg;
|
||||
struct cw_Conn * nc = wtpman->dconn;
|
||||
nc->process_packet=conn_process_packet;
|
||||
nc->process_message=dataman_process_msg;
|
||||
|
||||
|
||||
while (1){
|
||||
time_t timer = cw_timer_start(2);
|
||||
while (!cw_timer_timeout(timer)){
|
||||
cw_read_messages(nc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void *wtpman_main(void *arg)
|
||||
{
|
||||
//mavl_t r;
|
||||
@ -560,7 +590,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
||||
{
|
||||
struct sockaddr dbgaddr;
|
||||
socklen_t dbgaddrl;
|
||||
int sockfd, replyfd;
|
||||
int sockfd, replyfd, data_sockfd,data_replyfd;
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
|
||||
struct wtpman *wtpman;
|
||||
@ -574,6 +604,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
||||
|
||||
int port = sock_getport(&socklist[socklistindex].addr);
|
||||
replyfd = socklist_find_reply_socket(srcaddr, port);
|
||||
data_replyfd=replyfd;
|
||||
|
||||
if (replyfd == -1) {
|
||||
cw_log(LOG_ERR,
|
||||
@ -584,10 +615,11 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
||||
}
|
||||
} else {
|
||||
replyfd = socklist[socklistindex].sockfd;
|
||||
data_replyfd = socklist[socklistindex].data_sockfd;
|
||||
}
|
||||
|
||||
sockfd = replyfd; /*//socklist[socklistindex].reply_sockfd; */
|
||||
|
||||
data_sockfd = data_replyfd;
|
||||
|
||||
dbgaddrl = sizeof(dbgaddr);
|
||||
getsockname(sockfd, &dbgaddr, &dbgaddrl);
|
||||
@ -606,6 +638,15 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wtpman->dconn = cw_conn_create(data_sockfd, srcaddr, 100);
|
||||
if (!wtpman->dconn) {
|
||||
wtpman_destroy(wtpman);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
cw_conn_register_msg_cb(wtpman->conn,
|
||||
CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
discovery_cb);
|
||||
@ -618,6 +659,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
||||
|
||||
wtpman->conn->role = CW_ROLE_AC;
|
||||
wtpman->conn->data=wtpman;
|
||||
wtpman->dconn->data=wtpman;
|
||||
|
||||
wtpman->conn->cfg_list[0]=wtpman->conn->update_cfg;
|
||||
wtpman->conn->cfg_list[1]=wtpman->conn->remote_cfg;
|
||||
@ -663,6 +705,8 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
||||
cmod->name, bmod->name);
|
||||
wtpman->conn->msgset =
|
||||
cw_mod_get_msg_set(wtpman->conn, cmod, bmod);
|
||||
|
||||
wtpman->dconn->msgset=wtpman->conn->msgset;
|
||||
wtpman->conn->detected = 1;
|
||||
cmod->setup_cfg(wtpman->conn);
|
||||
// if (wtpman->conn->setup_complete)
|
||||
@ -708,5 +752,14 @@ void wtpman_start(struct wtpman *wtpman, int dtlsmode)
|
||||
cw_dbg(DBG_INFO, "Starting wtpman, DTLS mode = %d", dtlsmode);
|
||||
wtpman->dtlsmode = dtlsmode;
|
||||
pthread_create(&wtpman->thread, NULL, wtpman_main, (void *) wtpman);
|
||||
pthread_create(&wtpman->thread, NULL, wtpman_data_main, (void *) wtpman);
|
||||
return;
|
||||
}
|
||||
|
||||
void wtpman_datapacket(struct wtpman *wtpman, uint8_t * packet, int len)
|
||||
{
|
||||
conn_q_add_packet(wtpman->dconn, packet, len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@ struct wtpman {
|
||||
pthread_t thread;
|
||||
|
||||
struct cw_Conn *conn;
|
||||
struct cw_Conn *dconn;
|
||||
|
||||
|
||||
/* wtp data */
|
||||
@ -67,6 +68,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
||||
extern void wtpman_addpacket(struct wtpman *wtpman, uint8_t * packet, int len);
|
||||
extern void wtpman_destroy(struct wtpman *wtpman);
|
||||
extern void wtpman_start(struct wtpman *wtpman, int dtlsmode);
|
||||
void wtpman_datapacket(struct wtpman *wtpman, uint8_t * packet, int len);
|
||||
|
||||
|
||||
|
||||
|
@ -6,7 +6,6 @@ CWSRC=\
|
||||
cw.c\
|
||||
cw_check_missing_mand.c\
|
||||
cw_clock_lap.c\
|
||||
cw_dbg_elem.c\
|
||||
cw_filename.c\
|
||||
cw_format_dump.c\
|
||||
cw_format_pkt_hdr.c\
|
||||
@ -77,6 +76,7 @@ CWSRC=\
|
||||
cw_in_radio_generic_struct.c\
|
||||
cw_in_generic_struct.c\
|
||||
cw_radio_set_admin_state.c\
|
||||
cw_dbg_elem.c\
|
||||
|
||||
KTVSRC=\
|
||||
cfg.c\
|
||||
|
@ -146,8 +146,10 @@
|
||||
|
||||
|
||||
int cw_get_hdr_ws_len(uint8_t * th);
|
||||
uint8_t *cw_get_hdr_ws_data(uint8_t * th);
|
||||
int cw_get_hdr_ws_len_7(uint8_t * th);
|
||||
|
||||
uint8_t *cw_get_hdr_ws_data(uint8_t * th);
|
||||
#define cw_get_hdr_ws_data_7(th) (cw_get_hdr_ws_data(th)+1)
|
||||
|
||||
|
||||
#define cw_get_hdr_msg_offset(th) (4*cw_get_hdr_hlen(th))
|
||||
|
@ -3,105 +3,103 @@
|
||||
#include "conn.h"
|
||||
#include "cw.h"
|
||||
|
||||
/**
|
||||
* @brief Format a packet header for debugging purposes
|
||||
* @param dst Destination buffer
|
||||
* @param incomming True if the packet is an incomming packet, otherweise 0
|
||||
* @param packet packet data
|
||||
* @param len length of packet data
|
||||
* @param from Address from where the packet was received
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
int cw_format_pkt_hdr(char *dst, int incomming, uint8_t * packet, int len,
|
||||
struct sockaddr *from)
|
||||
#include "dot11.h"
|
||||
|
||||
int cw_format_dot11_fc_flags(char *dst, uint8_t *frame){
|
||||
char *s = dst;
|
||||
uint8_t f = frame[2];
|
||||
s+=sprintf(s,"ToDS:%d ", f&1 ? 1:0);
|
||||
s+=sprintf(s,"FromDS:%d ", f&2 ? 1:0);
|
||||
s+=sprintf(s,"More Frgs:%d ", f&4 ? 1:0);
|
||||
s+=sprintf(s,"Retry:%d ", f&8 ? 1:0);
|
||||
s+=sprintf(s,"PwrMgmt:%d ", f&16 ? 1:0);
|
||||
s+=sprintf(s,"More Dta:%d ", f&32 ? 1:0);
|
||||
s+=sprintf(s,"Protec:%d ", f&64 ? 1:0);
|
||||
s+=sprintf(s,"+HTC/:%d ", f&128 ? 1:0);
|
||||
return s-dst;
|
||||
}
|
||||
|
||||
|
||||
int cw_format_dot11_rates(char *dst, const uint8_t *src, int len)
|
||||
{
|
||||
int i;
|
||||
char * k="";
|
||||
char *s=dst;
|
||||
|
||||
for(i=0; i<len; i++){
|
||||
int rate = src[i] &0x7f;
|
||||
s+=sprintf(s,"%s%0.1f",k,dot11_rate2float(rate));
|
||||
k=", ";
|
||||
}
|
||||
return s-dst;
|
||||
}
|
||||
|
||||
|
||||
int cw_format_dot11_elem(char *dst, uint8_t id, const uint8_t *src, int len)
|
||||
{
|
||||
char *s = dst;
|
||||
s += sprintf(s,"elem(id=%d) ",id);
|
||||
|
||||
|
||||
switch(id){
|
||||
case DOT11_ELEM_SSID:
|
||||
s+=sprintf(s," ssid: %.*s",len,src);
|
||||
break;
|
||||
case DOT11_ELEM_SUPPORTED_RATES:
|
||||
s+=sprintf(s," Supported Rates:");
|
||||
s+=cw_format_dot11_rates(s,src,len);
|
||||
break;
|
||||
case DOT11_ELEM_EXTENDED_SUPPORTED_RATES:
|
||||
s+=sprintf(s," Extended Supported Rates");
|
||||
break;
|
||||
case DOT11_ELEM_POWER_CAPABILITY:
|
||||
s+=sprintf(s," Power Capability");
|
||||
break;
|
||||
case DOT11_ELEM_SUPPORTED_CHANNELS:
|
||||
s+=sprintf(s," Supported Channels");
|
||||
break;
|
||||
case DOT11_ELEM_SUPPORTED_OPERATING_CLASSES:
|
||||
s+=sprintf(s," Supported Operating Classes");
|
||||
break;
|
||||
case DOT11_ELEM_VENDOR_SPECIFIC:
|
||||
s+=sprintf(s," Vendor Specific");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
s+=sprintf(s,", len=%d",len);
|
||||
return s-dst;
|
||||
}
|
||||
|
||||
|
||||
int cw_format_dot11_hdr(char * dst, uint8_t * packet, int len)
|
||||
{
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
int preamble;
|
||||
char *s;
|
||||
int hlen, rid, wbid;
|
||||
int frag_id,frag_offs;
|
||||
int type = dot11_get_type_and_subtype(packet);
|
||||
|
||||
s = dst;
|
||||
s=dst;
|
||||
|
||||
if (incomming){
|
||||
if (cw_get_hdr_flag_f(packet)) {
|
||||
s += sprintf(s, "Fragment from %s",
|
||||
sock_addr2str_p(from,sock_buf));
|
||||
} else {
|
||||
s += sprintf(s, "From %s", sock_addr2str_p(from,sock_buf));
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (cw_get_hdr_flag_f(packet)) {
|
||||
s += sprintf(s, "Fragment to %s", sock_addr2str(from,sock_buf));
|
||||
} else {
|
||||
s += sprintf(s, "To %s", sock_addr2str(from,sock_buf));
|
||||
}
|
||||
}
|
||||
s += sprintf(s, " l=%d: ", len);
|
||||
|
||||
preamble = cw_get_hdr_preamble(packet);
|
||||
if (preamble == 01) {
|
||||
s += sprintf(s, " (encrypted)");
|
||||
return s - dst;
|
||||
}
|
||||
|
||||
if (len < 4)
|
||||
goto abort;
|
||||
|
||||
/*
|
||||
if (cw_get_hdr_flag_f(packet)){
|
||||
s+=sprintf(s," (fragmented)");
|
||||
}
|
||||
*/
|
||||
hlen = cw_get_hdr_hlen(packet);
|
||||
rid = cw_get_hdr_rid(packet);
|
||||
wbid = cw_get_hdr_wbid(packet);
|
||||
s += sprintf(s, " H:%d R:%02d W:%02d", hlen, rid, wbid);
|
||||
|
||||
|
||||
s += sprintf(s, " Flgs:");
|
||||
s += format_hdr_flags(s, packet);
|
||||
|
||||
if (len < 8)
|
||||
goto abort;
|
||||
frag_id = cw_get_hdr_fragid(packet);
|
||||
frag_offs = cw_get_hdr_fragoffset(packet);
|
||||
s += sprintf(s, " Frag/Offs:%d/%d", frag_id, frag_offs);
|
||||
|
||||
|
||||
if (cw_get_hdr_flag_m(packet)) {
|
||||
/* rmac is present, print the rmac */
|
||||
int rmac_len = cw_get_hdr_rmac_len(packet);
|
||||
int plen = rmac_len;
|
||||
if (rmac_len + 8 > len)
|
||||
plen = len - 8;
|
||||
if (rmac_len > 10)
|
||||
plen = 10;
|
||||
|
||||
s += sprintf(s, " R-MAC:");
|
||||
s += format_mac(s, cw_get_hdr_rmac_data(packet), plen);
|
||||
if (rmac_len > 10) {
|
||||
s += sprintf(s, " ... (len=%d)", rmac_len);
|
||||
}
|
||||
}
|
||||
|
||||
if (cw_get_hdr_flag_w(packet)) {
|
||||
/* print wireless specific info */
|
||||
int ws_len = cw_get_hdr_ws_len(packet);
|
||||
int plen = ws_len > 20 ? 20 : ws_len;
|
||||
s += sprintf(s, " WS:");
|
||||
s += format_hexu(s, cw_get_hdr_ws_data(packet), plen);
|
||||
if (ws_len > 20) {
|
||||
s += sprintf(s, " ... (len=%d)", ws_len);
|
||||
}
|
||||
}
|
||||
return s - dst;
|
||||
|
||||
|
||||
|
||||
abort:
|
||||
s += sprintf(s, " Incomplete...");
|
||||
return s - dst;
|
||||
s+=sprintf(s,"IEEE 802.11 - %s",dot11_get_frame_name(packet));
|
||||
s+=sprintf(s," da:");
|
||||
s+=format_mac(s,dot11_get_da(packet),6);
|
||||
s+=sprintf(s," sa:");
|
||||
s+=format_mac(s,dot11_get_sa(packet),6);
|
||||
s+=sprintf(s," bssid:");
|
||||
s+=format_mac(s,dot11_get_bssid(packet),6);
|
||||
s+=sprintf(s," seq: %d\n",dot11_get_seq(packet));
|
||||
s+=cw_format_dot11_fc_flags(s,packet);
|
||||
//
|
||||
/* switch (type){
|
||||
case DOT11_ASSOC_REQ:
|
||||
s+=sprintf(s,"\n ssid: %.*s",dot11_assoc_req_get_ssid_len(packet),
|
||||
dot11_assoc_req_get_ssid(packet)
|
||||
);
|
||||
break;
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -15,6 +15,25 @@ int cw_get_hdr_ws_len(uint8_t * th)
|
||||
return *(th + 9 + cw_get_hdr_rmac_len(th));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get length of wireless specific data for CAPWAP packet draft 7
|
||||
* @param th Pointer to packet
|
||||
* @return length of wireless specific data
|
||||
*
|
||||
* Call this function only if the W flag is set
|
||||
*/
|
||||
int cw_get_hdr_ws_len_7(uint8_t * th)
|
||||
{
|
||||
if (!cw_get_hdr_flag_m(th)){
|
||||
return *(th + 9);
|
||||
}
|
||||
return *(th + 10 + cw_get_hdr_rmac_len(th));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get pointer to wireless specific data
|
||||
* @param th Pointer to packet
|
||||
|
73
src/cw/dbg.c
73
src/cw/dbg.c
@ -31,6 +31,7 @@
|
||||
#include "format.h"
|
||||
#include "ansi_colors.h"
|
||||
|
||||
#include "dot11.h"
|
||||
|
||||
/**
|
||||
*@addtogroup DBG
|
||||
@ -371,16 +372,26 @@ void cw_dbg_pkt(int level, struct cw_Conn *conn, uint8_t * packet, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
|
||||
/* int hlen;*/
|
||||
char buf[1024];
|
||||
int (*fmt_pkt_hdr)(char *dst, int incomming, uint8_t * packet, int len,
|
||||
struct sockaddr *from);
|
||||
fmt_pkt_hdr = NULL;
|
||||
if (conn){
|
||||
if (conn->msgset)
|
||||
fmt_pkt_hdr = conn->msgset->format_pkt_hdr;
|
||||
}
|
||||
if (fmt_pkt_hdr==NULL){
|
||||
fmt_pkt_hdr = cw_format_pkt_hdr;
|
||||
}
|
||||
|
||||
|
||||
if (!cw_dbg_is_level(level))
|
||||
return;
|
||||
|
||||
if (level == DBG_PKT_IN)
|
||||
cw_format_pkt_hdr(buf, 1, packet, len, from);
|
||||
fmt_pkt_hdr(buf, 1, packet, len, from);
|
||||
else
|
||||
cw_format_pkt_hdr(buf, 0, packet, len, from);
|
||||
fmt_pkt_hdr(buf, 0, packet, len, from);
|
||||
|
||||
/* hlen = cw_get_hdr_msg_offset(packet);*/
|
||||
|
||||
@ -638,6 +649,9 @@ int cw_dbg_set_level_from_str(const char *level)
|
||||
return cw_dbg_set_level_from_str0(slevel,on);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void cw_dbg_print_help(FILE *out, const char * prefix)
|
||||
{
|
||||
struct cw_DbgStr *s;
|
||||
@ -656,32 +670,45 @@ void cw_dbg_print_help(FILE *out, const char * prefix)
|
||||
}
|
||||
fprintf(out,"\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void dbg_istore_dmp(mbag_t s)
|
||||
|
||||
|
||||
void cw_dbg_dot11_elems(const uint8_t *src,int len)
|
||||
{
|
||||
DEFINE_AVLITER(it,s);
|
||||
avliter_foreach(&it) {
|
||||
|
||||
mbag_item_t *i = avliter_get(&it);
|
||||
|
||||
char buffer[1000];
|
||||
|
||||
struct cw_str * strings = cw_item_strings;
|
||||
|
||||
const char * in = cw_strlist_get_str(strings,i->id);
|
||||
|
||||
cw_format_item(buffer,i);
|
||||
printf("Item ID %d-%s: %s\n",i->id,in,buffer);
|
||||
|
||||
|
||||
uint8_t id,l;
|
||||
int p;
|
||||
char str[1024];
|
||||
|
||||
for(p=0; p<len; p+=l+2){
|
||||
if (len-p<3){
|
||||
cw_dbg(DBG_X,"Error in dot11 element");
|
||||
return;
|
||||
}
|
||||
id=src[p];
|
||||
l=src[p+1];
|
||||
cw_format_dot11_elem(str,id,src+p+2,l);
|
||||
cw_dbg_dmp(DBG_X,src+p+2,l,"");
|
||||
cw_dbg(DBG_X,str);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
void cw_dbg_dot11_frame(uint8_t * frame,int len)
|
||||
{
|
||||
char hdr[1024];
|
||||
cw_format_dot11_hdr(hdr, frame, len);
|
||||
cw_dbg(DBG_X,"%s",hdr);
|
||||
|
||||
int type =dot11_get_type_and_subtype(frame);
|
||||
|
||||
switch (type){
|
||||
case DOT11_ASSOC_REQ:
|
||||
cw_dbg_dot11_elems(frame+28,len-28);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**@}*/
|
||||
|
@ -244,6 +244,8 @@ void cw_dbg_ktv_dump(mavl_t ktv, uint32_t dbglevel,
|
||||
int cw_dbg_is_level(int level);
|
||||
|
||||
void cw_dbg_print_help(FILE *out, const char * prefix);
|
||||
void cw_dbg_dot11_frame(uint8_t * frame,int len);
|
||||
|
||||
|
||||
|
||||
#define stop() printf("STOP IN %s:%d - %s\n", __FILE__, __LINE__, __FUNCTION__); exit(1)
|
||||
|
@ -59,4 +59,8 @@ struct cw_StrListElem dot11_names[]={
|
||||
};
|
||||
|
||||
|
||||
int dot11_init_assoc_resp(uint8_t * dst)
|
||||
{
|
||||
dst[0]=0;
|
||||
|
||||
}
|
||||
|
@ -110,11 +110,19 @@
|
||||
* @defgroup DOT11_ELEMS
|
||||
* @{
|
||||
*/
|
||||
#define DOT11_ELEM_SSID 0
|
||||
#define DOT11_ELEM_SUPPORTED_RATES 1
|
||||
#define DOT11_ELEM_FH_PARAM_SET 2
|
||||
#define DOT11_ELEM_DSSS_PARAM_SET 3
|
||||
#define DOT11_ELEM_CF_PARAM_SET 4
|
||||
#define DOT11_ELEM_SSID 0
|
||||
#define DOT11_ELEM_SUPPORTED_RATES 1
|
||||
#define DOT11_ELEM_FH_PARAM_SET 2
|
||||
#define DOT11_ELEM_DSSS_PARAM_SET 3
|
||||
#define DOT11_ELEM_CF_PARAM_SET 4
|
||||
#define DOT11_ELEM_POWER_CAPABILITY 33
|
||||
#define DOT11_ELEM_SUPPORTED_CHANNELS 36
|
||||
#define DOT11_ELEM_EXTENDED_SUPPORTED_RATES 50
|
||||
#define DOT11_ELEM_AP_CHANNEL_REPORT 51
|
||||
#define DOT11_ELEM_SUPPORTED_OPERATING_CLASSES 59
|
||||
#define DOT11_ELEM_VENDOR_SPECIFIC 221
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -131,15 +139,16 @@ extern const uint8_t dot11_tab_br[256];
|
||||
#define dot11_put_dword(dst,v) ((*((uint32_t*)(dst))=htobe32(v)),4)
|
||||
#define dot11_put_qword(dst,v) ((*((uint64_t*)(dst))=htobe64(v)),8)
|
||||
|
||||
#define dot11_set_byte(ptr,b) (*(ptr) = b)
|
||||
|
||||
uint16_t dot11_get_word(uint8_t * ptr);
|
||||
|
||||
|
||||
|
||||
#define cw_dot11_get_version(frame) ( (frame)[1] & 0x03)
|
||||
#define cw_dot11_get_type(frame) ( ((frame)[1] & 0x0c) >> 2)
|
||||
#define cw_dot11_get_subtype(frame) ( (frame)[1] >> 4 )
|
||||
|
||||
#define dot11_get_version(frame) ( (frame)[1] & 0x03)
|
||||
#define dot11_get_type(frame) ( ((frame)[1] & 0x0c) >> 2)
|
||||
#define dot11_get_subtype(frame) ( (frame)[1] >> 4 )
|
||||
#define dot11_get_type_and_subtype( frame) ((frame)[1])
|
||||
|
||||
/**
|
||||
* Get Frame Control field
|
||||
@ -242,6 +251,24 @@ extern struct cw_StrListElem dot11_names[];
|
||||
|
||||
#define dot11_get_frame_name(data) cw_strlist_get_str(dot11_names,(data)[1])
|
||||
|
||||
#define dot11_get_da(frame) ((frame)+2+2)
|
||||
#define dot11_get_sa(frame) ((frame)+2+2+6)
|
||||
#define dot11_get_bssid(frame) ((frame)+2+2+12)
|
||||
#define dot11_get_seq(frame) dot11_get_word((frame)+2+2+12+6)
|
||||
|
||||
#define dot11_assoc_req_get_cap(frame) \
|
||||
dot11_get_word((frame)+2+2+12+6+2)
|
||||
#define dot11_assoc_req_get_listen_interval(frame) \
|
||||
dot11_get_word((frame)+2+2+12+6+4)
|
||||
|
||||
|
||||
#define dot11_assoc_req_get_ssid_len(frame)\
|
||||
((frame)[29])
|
||||
#define dot11_assoc_req_get_ssid(frame)\
|
||||
(frame+30)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -31,8 +31,6 @@ uint64_t dot11_timer_get()
|
||||
return 1000000 * tv.tv_sec + tv.tv_usec - dot11_timer_offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void dot11_timer_set(uint64_t val)
|
||||
{
|
||||
struct timeval tv;
|
||||
@ -41,11 +39,10 @@ void dot11_timer_set(uint64_t val)
|
||||
}
|
||||
|
||||
int dot11_put_ssid(uint8_t *dst,uint8_t * ssid,int len){
|
||||
dot11_put_byte(dst,DOT11_ELEM_SSID);
|
||||
dot11_put_byte(dst+1,len);
|
||||
dot11_set_byte(dst,DOT11_ELEM_SSID);
|
||||
dot11_set_byte(dst+1,len);
|
||||
memcpy(dst+2,ssid,len);
|
||||
return len;
|
||||
|
||||
}
|
||||
|
||||
int dot11_put_supported_rates(uint8_t *dst, float *basic, float *rates){
|
||||
@ -67,9 +64,9 @@ int dot11_put_supported_rates(uint8_t *dst, float *basic, float *rates){
|
||||
|
||||
int dot11_put_dsss_param_set(uint8_t *dst,int ch) {
|
||||
|
||||
dot11_put_byte(dst,DOT11_ELEM_DSSS_PARAM_SET);
|
||||
dot11_put_byte(dst+1,1);
|
||||
dot11_put_byte(dst+2,ch);
|
||||
dot11_set_byte(dst,DOT11_ELEM_DSSS_PARAM_SET);
|
||||
dot11_set_byte(dst+1,1);
|
||||
dot11_set_byte(dst+2,ch);
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
129
src/cw/format.c
129
src/cw/format.c
@ -27,6 +27,8 @@
|
||||
|
||||
#include "cw.h"
|
||||
|
||||
#include "format.h"
|
||||
|
||||
#include "capwap80211.h"
|
||||
|
||||
/**
|
||||
@ -104,3 +106,130 @@ char * cw_format_radio_information(char * dst, int ri)
|
||||
*d=0;
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
static int cw_format_pkt_hdr0(char *dst, int incomming, uint8_t * packet, int len,
|
||||
struct sockaddr *from, int draft7)
|
||||
{
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
int preamble;
|
||||
char *s;
|
||||
int hlen, rid, wbid;
|
||||
int frag_id,frag_offs;
|
||||
|
||||
s = dst;
|
||||
|
||||
if (incomming){
|
||||
if (cw_get_hdr_flag_f(packet)) {
|
||||
s += sprintf(s, "Fragment from %s",
|
||||
sock_addr2str_p(from,sock_buf));
|
||||
} else {
|
||||
s += sprintf(s, "From %s", sock_addr2str_p(from,sock_buf));
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (cw_get_hdr_flag_f(packet)) {
|
||||
s += sprintf(s, "Fragment to %s", sock_addr2str(from,sock_buf));
|
||||
} else {
|
||||
s += sprintf(s, "To %s", sock_addr2str(from,sock_buf));
|
||||
}
|
||||
}
|
||||
s += sprintf(s, " l=%d: ", len);
|
||||
|
||||
preamble = cw_get_hdr_preamble(packet);
|
||||
if (preamble == 01) {
|
||||
s += sprintf(s, " (encrypted)");
|
||||
return s - dst;
|
||||
}
|
||||
|
||||
if (len < 4)
|
||||
goto abort;
|
||||
|
||||
hlen = cw_get_hdr_hlen(packet);
|
||||
rid = cw_get_hdr_rid(packet);
|
||||
wbid = cw_get_hdr_wbid(packet);
|
||||
s += sprintf(s, " H:%d R:%02d W:%02d", hlen, rid, wbid);
|
||||
|
||||
|
||||
s += sprintf(s, " Flgs:");
|
||||
s += format_hdr_flags(s, packet);
|
||||
|
||||
if (len < 8)
|
||||
goto abort;
|
||||
frag_id = cw_get_hdr_fragid(packet);
|
||||
frag_offs = cw_get_hdr_fragoffset(packet);
|
||||
s += sprintf(s, " Frag/Offs:%d/%d", frag_id, frag_offs);
|
||||
|
||||
|
||||
if (cw_get_hdr_flag_m(packet)) {
|
||||
/* rmac is present, print the rmac */
|
||||
int rmac_len = cw_get_hdr_rmac_len(packet);
|
||||
int plen = rmac_len;
|
||||
if (rmac_len + 8 > len)
|
||||
plen = len - 8;
|
||||
if (rmac_len > 10)
|
||||
plen = 10;
|
||||
|
||||
s += sprintf(s, " R-MAC:");
|
||||
s += format_mac(s, cw_get_hdr_rmac_data(packet), plen);
|
||||
if (rmac_len > 10) {
|
||||
s += sprintf(s, " ... (len=%d)", rmac_len);
|
||||
}
|
||||
}
|
||||
|
||||
if (cw_get_hdr_flag_w(packet)) {
|
||||
if (!draft7){
|
||||
/* print wireless specific info */
|
||||
int ws_len = cw_get_hdr_ws_len(packet);
|
||||
int plen = ws_len > 20 ? 20 : ws_len;
|
||||
s += sprintf(s, " WS:");
|
||||
s += format_hexu(s, cw_get_hdr_ws_data(packet), plen);
|
||||
if (ws_len > 20) {
|
||||
s += sprintf(s, " ... (len=%d)", ws_len);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int ws_len = cw_get_hdr_ws_len_7(packet);
|
||||
int plen = ws_len > 20 ? 20 : ws_len;
|
||||
s += sprintf(s, " WS:");
|
||||
s += format_hexu(s, cw_get_hdr_ws_data_7(packet), plen);
|
||||
if (ws_len > 20) {
|
||||
s += sprintf(s, " ... (len=%d)", ws_len);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return s - dst;
|
||||
|
||||
abort:
|
||||
s += sprintf(s, " Incomplete...");
|
||||
return s - dst;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Format a packet header for debugging purposes
|
||||
* @param dst Destination buffer
|
||||
* @param incomming True if the packet is an incomming packet, otherweise 0
|
||||
* @param packet packet data
|
||||
* @param len length of packet data
|
||||
* @param from Address from where the packet was received
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
int cw_format_pkt_hdr(char *dst, int incomming, uint8_t * packet, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
return cw_format_pkt_hdr0(dst, incomming, packet, len,
|
||||
from, 0);
|
||||
|
||||
}
|
||||
|
||||
int cw_format_pkt_hdr_7(char *dst, int incomming, uint8_t * packet, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
return cw_format_pkt_hdr0(dst, incomming, packet, len,
|
||||
from, 1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -109,9 +109,14 @@ char *cw_format_dump(const uint8_t * data, int len,
|
||||
void cw_format_get_dump_defaults(struct cw_FormatDumpSettings * settings);
|
||||
int cw_format_pkt_hdr(char *dst, int incomming, uint8_t * packet, int len,
|
||||
struct sockaddr *from);
|
||||
int cw_format_pkt_hdr_7(char *dst, int incomming, uint8_t * packet, int len,
|
||||
struct sockaddr *from);
|
||||
|
||||
int cw_format_version(char *s, const uint8_t * version, int len);
|
||||
|
||||
char * cw_format_radio_information(char * dst, int ri);
|
||||
int cw_format_dot11_hdr(char * dst, uint8_t *packet, int len);
|
||||
int cw_format_dot11_elem(char *dst, uint8_t id, const uint8_t *src, int len);
|
||||
|
||||
|
||||
/**@}*/
|
||||
|
@ -72,6 +72,9 @@ struct cw_MsgSet {
|
||||
mavl_t statemachine_states;
|
||||
int (*write_header)(struct cw_ElemHandler * handler, uint8_t * dst, int len);
|
||||
int (*header_len)(struct cw_ElemHandler *handler);
|
||||
int (*format_pkt_hdr)(char *dst, int incomming, uint8_t * packet, int len,
|
||||
struct sockaddr *from);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "cw/msgset.h"
|
||||
#include "cw/keys.h"
|
||||
#include "cw/format.h"
|
||||
|
||||
#include "mod_capwap.h"
|
||||
|
||||
@ -941,6 +942,7 @@ struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
||||
|
||||
set->write_header = write_header;
|
||||
set->header_len = header_len;
|
||||
set->format_pkt_hdr = cw_format_pkt_hdr;
|
||||
|
||||
cw_dbg(DBG_INFO,"CAPWAP: Done register messages");
|
||||
return set;
|
||||
|
@ -3362,6 +3362,7 @@ static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
||||
|
||||
set->write_header = write_header;
|
||||
set->header_len = header_len;
|
||||
set->format_pkt_hdr = cw_format_pkt_hdr_7;
|
||||
break;
|
||||
}
|
||||
case CW_MOD_MODE_BINDINGS:
|
||||
|
@ -7,7 +7,7 @@ LIBARCHDIR := $(LIBDIR)/$(KERNEL)/$(ARCH)
|
||||
|
||||
CFLAGS+=-I../ -DUSE_OPENSSL -I../../include
|
||||
LDFLAGS+=-L$(LIBARCHDIR) -L/usr/local/lib
|
||||
LIBS+=-lcw -lnettle -lssl -lcrypto -ldl -lpthread -lmavl
|
||||
LIBS+=-lcw -lnettle -lssl -lcrypto -ldl -lpthread -lmavl -lwifi
|
||||
|
||||
SOURCES=\
|
||||
wtp_main.c\
|
||||
|
@ -98,23 +98,35 @@ int test()
|
||||
int rc;
|
||||
char *f;
|
||||
size_t len;
|
||||
f=cw_load_file("wificap-005",&len);
|
||||
f=cw_load_file("wificap-002",&len);
|
||||
cw_dbg(DBG_X, "Loaded %d bytes",len);
|
||||
|
||||
// static int got_radiotap = 0;
|
||||
// struct libwifi_frame frame = {0};
|
||||
// rc = libwifi_get_wifi_frame(&frame, (unsigned char*)(f+16), len-16, got_radiotap);
|
||||
struct libwifi_frame frame = {0};
|
||||
rc = libwifi_get_wifi_frame(&frame, (unsigned char*)(f+16+1), len-16-1, 0);
|
||||
|
||||
struct libwifi_frame_ctrl *frame_control = (struct libwifi_frame_ctrl *) (f+16);
|
||||
printf("SO: %d\n",frame_control->type);
|
||||
|
||||
if (rc != 0) {
|
||||
printf("[!] Error getting libwifi_frame: %d\n", rc);
|
||||
}
|
||||
|
||||
// if (rc != 0) {
|
||||
// printf("[!] Error getting libwifi_frame: %d\n", rc);
|
||||
// }
|
||||
cw_dbg(DBG_X,"Frame CTL:%d,%d",frame.frame_control.type, frame.frame_control.subtype);
|
||||
|
||||
// cw_dbg(DBG_X,"Frame CTL:%d,%d",frame.frame_control.type, frame.frame_control.subtype);
|
||||
// cw_dbg(DBG_X,"MY RESULT: Type %d, SubType %d",cw_dot11_get_type(f+16), cw_dot11_get_subtype(f+16));
|
||||
// cw_dbg(DBG_X,"FRAME: %s",dot11_get_frame_name(f+16+1));
|
||||
|
||||
|
||||
cw_dbg(DBG_X,"MY RESULT: Type %d, SubType %d",cw_dot11_get_type(f+16), cw_dot11_get_subtype(f+16));
|
||||
cw_dbg(DBG_X,"FRAME: %s",dot11_get_frame_name(f+16+1));
|
||||
cw_dbg(DBG_X,"%04x",dot11_get_word((uint8_t*)(f)+16));
|
||||
|
||||
char dstr[2048];
|
||||
|
||||
cw_format_dot11_hdr(dstr,f+16,len-16);
|
||||
|
||||
cw_dbg(DBG_X,"R:\n%s",dstr);
|
||||
|
||||
cw_dbg_dot11_frame(f+16,len-16);
|
||||
|
||||
free(f);
|
||||
return 0;
|
||||
@ -170,8 +182,8 @@ int main (int argc, char **argv)
|
||||
bootcfg.nmods=2;
|
||||
}
|
||||
|
||||
// test();
|
||||
// stop();
|
||||
test();
|
||||
stop();
|
||||
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user