Initial commit
FossilOrigin-Name: c53d95729c009f8f80a7d63847cef7668ff73f8af0523ab65f7734696f85399c
This commit is contained in:
77
src/wtp/Makefile
Normal file
77
src/wtp/Makefile
Normal file
@ -0,0 +1,77 @@
|
||||
ifndef CC
|
||||
CC=gcc
|
||||
endif
|
||||
|
||||
CFLAGS+=-DWITH_RMAC_SUPPORT
|
||||
CFLAGS+=-DWITH_IPV6
|
||||
CFLAGS+=-DWITH_CW_LOG
|
||||
CFLAGS+=-DWITH_CW_LOG_DEBUG
|
||||
CFLAGS+=-DWITH_DTLS
|
||||
|
||||
|
||||
SYSARCH := $(shell uname -m)
|
||||
ifndef ARCH
|
||||
ARCH=$(SYSARCH)
|
||||
endif
|
||||
|
||||
X=$(shell echo $(ARCH))
|
||||
|
||||
#ifndef CFLAGS
|
||||
CFLAGS += -O2 -Wall -g
|
||||
#endif
|
||||
|
||||
LDFLAGS += -L../../src/capwap/$(ARCH)
|
||||
LDFLAGS += -L/usr/local/lib
|
||||
#LDFLAGS += -lpthread
|
||||
#LDFLAGS += -lrt
|
||||
|
||||
LIBS+=-lcapwap
|
||||
#LIBS+=-liw
|
||||
LIBS+=-lssl
|
||||
LIBS+=-lcrypto
|
||||
LIBS+=-lpthread
|
||||
LIBS+=-lrt
|
||||
LIBS+=-lconfuse
|
||||
|
||||
|
||||
CFLAGS += -I../src
|
||||
CFLAGS += -I../src/utils
|
||||
CFLAGS += -I../../src
|
||||
CFLAGS += -I/usr/local/include
|
||||
|
||||
OBJS += wtp_main.o
|
||||
OBJS += wtp_conf.o
|
||||
OBJS += discovery.o
|
||||
OBJS += wtp_interface.o
|
||||
OBJS += wtpdrv.o
|
||||
OBJS += join.o
|
||||
OBJS += run.o
|
||||
OBJS += sulking.o
|
||||
|
||||
ALL=wtp
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
Q=@
|
||||
E=echo
|
||||
ifeq ($(V), 1)
|
||||
Q=
|
||||
E=true
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
||||
@$(E) " CC " $<
|
||||
|
||||
|
||||
wtp: $(BCHECK) $(OBJS)
|
||||
$(Q)$(CC) $(LDFLAGS) -o wtp $(OBJS) $(LIBS)
|
||||
|
||||
@$(E) " LD " $@
|
||||
|
||||
clean:
|
||||
# $(MAKE) -C ../src clean
|
||||
rm -f *.o
|
||||
rm -f *.d
|
||||
|
||||
-include $(OBJS:%.o=%.d)
|
315
src/wtp/discovery.c
Normal file
315
src/wtp/discovery.c
Normal file
@ -0,0 +1,315 @@
|
||||
/*
|
||||
This file is part of libcapwap.
|
||||
|
||||
libcapwap 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
libcapwap 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/cw_log.h"
|
||||
#include "capwap/wtpinfo.h"
|
||||
#include "capwap/acinfo.h"
|
||||
#include "capwap/sock.h"
|
||||
#include "capwap/cw_util.h"
|
||||
|
||||
#include "wtp.h"
|
||||
#include "wtp_conf.h"
|
||||
#include "wtp_interface.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct discovery_info{
|
||||
ACIPLIST * aciplist;
|
||||
struct conn * conn;
|
||||
int response_count;
|
||||
};
|
||||
|
||||
static int acprint(void *p,void*d) //,int ctr)
|
||||
{
|
||||
|
||||
|
||||
ACIP * ip = (ACIP*)d;
|
||||
char str[100];
|
||||
sock_addrtostr((struct sockaddr*)&ip->ip,str,100);
|
||||
// printf("ACIP: %s\n",str);
|
||||
// printf("CTR: %i\n",ip->wtp_count);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int msg_cb(void *priv,struct cwrmsg * cwrmsg)
|
||||
{
|
||||
if (cwrmsg->type != CWMSG_DISCOVERY_RESPONSE){
|
||||
cw_log_debug0("Expected discovery response, but received %i",cwrmsg->type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct discovery_info * di = (struct discovery_info*)priv;
|
||||
|
||||
if (di->conn->seqnum != cwrmsg->seqnum){
|
||||
cw_log_debug0("Ignoring discovery respone, seqnum=%i, expected seqnum %i",cwrmsg->seqnum,di->conn->seqnum);
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct ac_info acinfo;
|
||||
memset(&acinfo,0,sizeof(acinfo));
|
||||
|
||||
acinfo.aciplist = di->aciplist;
|
||||
|
||||
cwread_discovery_response(&acinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
||||
|
||||
/*
|
||||
printf("AC NAME %s\n",acinfo.ac_name);
|
||||
printf("AC Software version %s\n",acinfo.software_version);
|
||||
printf("AC Hardwareversion %s\n",acinfo.hardware_version);
|
||||
|
||||
printf("Active wtps: %i\n",acinfo.active_wtps);
|
||||
printf("Active max wtps: %i\n",acinfo.max_wtps);
|
||||
|
||||
|
||||
printf("Got Discovery response\n");
|
||||
|
||||
printf("ACL COUNT: %i\n",acinfo.aciplist->count);
|
||||
*/
|
||||
aciplist_foreach(acinfo.aciplist,acprint,0);
|
||||
|
||||
// responses++;
|
||||
//
|
||||
di->response_count++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void rand_sleep(int seconds)
|
||||
{
|
||||
int usecs = seconds * 1000;
|
||||
uint16_t rnd;
|
||||
cw_rand((uint8_t*)&rnd,sizeof(rnd));
|
||||
uint16_t max = 0-1;
|
||||
int r = (rnd * usecs) / max;
|
||||
cw_log_debug0("Sleeping for %u milliseconds\n",r);
|
||||
usleep(r*1000);
|
||||
}
|
||||
|
||||
|
||||
static int do_discover_conn(struct conn * conn,struct discovery_info * di)
|
||||
{
|
||||
rand_sleep(conf_max_discovery_interval);
|
||||
|
||||
|
||||
struct wtpinfo * wtpinfo;
|
||||
wtpinfo = get_wtpinfo();
|
||||
// wtpinfo_print(wtpinfo);
|
||||
|
||||
|
||||
// struct timespec tstart,tcur;
|
||||
struct radioinfo ri;
|
||||
memset(&ri,0,sizeof(ri));
|
||||
|
||||
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
char str[100];
|
||||
sock_addrtostr((struct sockaddr*)&conn->addr,str,100);
|
||||
cw_log_debug0("Sending discovery request to %s",str);
|
||||
#endif
|
||||
|
||||
int rc;
|
||||
|
||||
do {
|
||||
rc = cwsend_discovery_request(conn,&ri,wtpinfo);
|
||||
if (rc<0){
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
if (errno == EMSGSIZE){
|
||||
conn->mtu-=4;
|
||||
cw_log_debug2("Setting mtu to %i",conn->mtu);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}while (rc<0);
|
||||
|
||||
|
||||
if (rc < 0 )
|
||||
{
|
||||
char str[100];
|
||||
sock_addrtostr((struct sockaddr*)&conn->addr,str,100);
|
||||
cw_log(LOG_ERR,"Error sending discovery request to %s: %s",str,strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct connlist * connlist;
|
||||
connlist = connlist_create(30);
|
||||
|
||||
// clock_gettime(CLOCK_REALTIME,&tstart);
|
||||
//
|
||||
int tstart = time(0);
|
||||
int treset = 0;
|
||||
do {
|
||||
char buf[2048];
|
||||
int buflen=2048;
|
||||
struct sockaddr_storage sa;
|
||||
socklen_t fromlen=sizeof(struct sockaddr_storage);
|
||||
rc = recvfrom(conn->sock,buf,buflen,0,(struct sockaddr*)&sa,&fromlen);
|
||||
if (rc<0){
|
||||
if (errno==EINTR)
|
||||
rc=0;
|
||||
if (errno==EAGAIN)
|
||||
rc=0;
|
||||
if (errno==EWOULDBLOCK)
|
||||
rc=0;
|
||||
}
|
||||
if (rc>0) {
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
char str[100];
|
||||
sock_addrtostr((struct sockaddr*)&sa,str,100);
|
||||
cw_log_debug0("Received packet from %s",str);
|
||||
#endif
|
||||
|
||||
struct conn * rconn;
|
||||
rconn = connlist_get(connlist,(struct sockaddr*)&sa);
|
||||
|
||||
if (!rconn){
|
||||
rconn = conn_create(conn->sock,(struct sockaddr*)&sa,0); //msg_cb,NULL,0);
|
||||
// rconn->pmsgarg=conn->pmsgarg;
|
||||
rconn->mtu = conn->mtu;
|
||||
rconn->seqnum=conn->seqnum;
|
||||
connlist_add(connlist,rconn);
|
||||
}
|
||||
|
||||
conn_process_packet(rconn,(uint8_t*)buf,rc,msg_cb,di);
|
||||
}
|
||||
|
||||
/* reset discovery timer after we have received the first response */
|
||||
if ( di->response_count == 1 && !treset ){
|
||||
tstart=time(0);
|
||||
treset=1;
|
||||
}
|
||||
|
||||
//clock_gettime(CLOCK_REALTIME,&tcur);
|
||||
// printf("TTSub: %i %i\n",time(0)-tstart, conf_discovery_interval);
|
||||
}while(time(0)-tstart < conf_discovery_interval && rc>=0 );
|
||||
|
||||
|
||||
if (rc <0){
|
||||
char str[100];
|
||||
sock_addrtostr((struct sockaddr*)&conn->addr,str,100);
|
||||
cw_log(LOG_ERR,"Error sendings discovery request to %s: %s",str,strerror(errno));
|
||||
}
|
||||
|
||||
connlist_destroy(connlist);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int discovery_count;
|
||||
|
||||
ACIPLIST * do_discovery(const char *acaddr)
|
||||
{
|
||||
|
||||
/* get an partially intialized connection object
|
||||
* (seqnum should be set)
|
||||
* */
|
||||
struct conn * conn = get_conn();
|
||||
if (!conn){
|
||||
cw_log(LOG_ERR,"Can't create conn for %s: %s",acaddr,strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* get addr of destination */
|
||||
struct addrinfo hints;
|
||||
struct addrinfo * res,*res0;
|
||||
memset(&hints,0,sizeof(hints));
|
||||
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
|
||||
int rc = getaddrinfo(acaddr,conf_control_port,&hints,&res0);
|
||||
if(rc){
|
||||
cw_log(LOG_ERR,"Can't connect to AC %s: %s",acaddr,gai_strerror(rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct discovery_info di;
|
||||
memset (&di,0,sizeof(struct discovery_info));
|
||||
di.aciplist = aciplist_create();
|
||||
di.response_count=0;
|
||||
|
||||
|
||||
for(res=res0; res; res=res->ai_next)
|
||||
{
|
||||
if ( discovery_count >= conf_max_discoveries){
|
||||
sulking_state();
|
||||
discovery_count=0;
|
||||
cw_log_debug0("Entering discovery state");
|
||||
}
|
||||
discovery_count++;
|
||||
|
||||
|
||||
/* create socket */
|
||||
int sockfd;
|
||||
int opt;
|
||||
sockfd=socket(res->ai_family,SOCK_DGRAM,0);
|
||||
if (sockfd == -1){
|
||||
cw_log(LOG_ERR,"Can't create socket for %s: %s",acaddr,strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
opt = 1;
|
||||
if (setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &opt, sizeof(opt))<0){
|
||||
cw_log(LOG_ERR,"Cant set broadcast sockopt");
|
||||
}
|
||||
sock_set_recvtimeout(sockfd,1);
|
||||
|
||||
sock_set_dontfrag(sockfd,0);
|
||||
|
||||
di.conn=conn;
|
||||
|
||||
sock_copyaddr(&conn->addr,res->ai_addr);
|
||||
conn->sock=sockfd;
|
||||
|
||||
do_discover_conn(conn,&di);
|
||||
|
||||
close(sockfd);
|
||||
|
||||
if ( di.aciplist->count != 0)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
freeaddrinfo(res0);
|
||||
|
||||
if (di.aciplist->count){
|
||||
cw_log_debug2("Discover responses received: %i\n",di.response_count);
|
||||
return di.aciplist;
|
||||
|
||||
}
|
||||
|
||||
aciplist_destroy(di.aciplist);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
127
src/wtp/join.c
Normal file
127
src/wtp/join.c
Normal file
@ -0,0 +1,127 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "wtp_interface.h"
|
||||
#include "wtp_conf.h"
|
||||
|
||||
#include "capwap/dtls.h"
|
||||
#include "capwap/cw_log.h"
|
||||
#include "capwap/sock.h"
|
||||
#include "capwap/dtls.h"
|
||||
|
||||
|
||||
#define acinfo_log acinfo_log_
|
||||
|
||||
void acinfo_log_(int level,const struct ac_info *acinfo,const char * xstr)
|
||||
{
|
||||
char str[8192];
|
||||
acinfo_print(str,acinfo);
|
||||
cw_log_debug(level,"%s\n%s",xstr,str);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int join_state(struct conn * conn)
|
||||
{
|
||||
struct wtpinfo * wtpinfo = get_wtpinfo();
|
||||
|
||||
struct radioinfo ri;
|
||||
memset(&ri,0,sizeof(ri));
|
||||
int rc;
|
||||
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
char str[64];
|
||||
sock_addrtostr(&conn->addr,str,64);
|
||||
cw_log_debug0("Sending join request to %s",str);
|
||||
#endif
|
||||
printf("Seqnum before = %i\n",conn->seqnum);
|
||||
rc = cwsend_join_request(conn,&ri,wtpinfo);
|
||||
printf("Seqnum after = %i\n",conn->seqnum);
|
||||
|
||||
struct cwrmsg * cwrmsg = conn_get_message(conn);
|
||||
|
||||
cw_log_debug0("Receiveid message %i",cwrmsg->seqnum);
|
||||
|
||||
if (cwrmsg->type != CWMSG_JOIN_RESPONSE || cwrmsg->seqnum != conn->seqnum){
|
||||
printf("Wrong message\n");
|
||||
}
|
||||
|
||||
struct ac_info acinfo;
|
||||
memset(&acinfo,0,sizeof(acinfo));
|
||||
|
||||
cwread_join_response(&acinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
||||
acinfo_log(0,&acinfo,"Connectet to the following AC");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int join(struct sockaddr *sa)
|
||||
{
|
||||
int sockfd;
|
||||
int rc;
|
||||
|
||||
sockfd = socket(AF_INET,SOCK_DGRAM,0);
|
||||
if (sockfd==-1){
|
||||
cw_log(LOG_ERR,"Can't create socket: %s\n",strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
sock_set_recvtimeout(sockfd,1);
|
||||
|
||||
rc = connect(sockfd,(struct sockaddr*)sa,sock_addrlen((struct sockaddr*)sa));
|
||||
if (rc<0){
|
||||
char str[100];
|
||||
sock_addrtostr(sa,str,100);
|
||||
cw_log(LOG_ERR,"Can't connect to %s: %s\n",str,strerror(errno));
|
||||
close(sockfd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct conn * conn = get_conn();
|
||||
conn->sock=sockfd;
|
||||
sock_copyaddr(&conn->addr,sa);
|
||||
|
||||
|
||||
#ifdef WITH_DTLS
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
{
|
||||
char str[100];
|
||||
sock_addrtostr(sa,str,100);
|
||||
cw_log_debug0("Establishing DTLS connection to %s",str);
|
||||
}
|
||||
#endif
|
||||
|
||||
conn->dtls_psk=conf_dtls_psk;
|
||||
conn->dtls_psk_len=strlen(conn->dtls_psk);
|
||||
conn->dtls_cipher=conf_dtls_cipher;
|
||||
|
||||
rc = dtls_connect(conn);
|
||||
if (rc!=1){
|
||||
dtls_shutdown(conn);
|
||||
char str[100];
|
||||
sock_addrtostr(sa,str,100);
|
||||
cw_log(LOG_ERR,"Cant establish DTLS connection to %s",str);
|
||||
close(sockfd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
{
|
||||
char str[100];
|
||||
sock_addrtostr(sa,str,100);
|
||||
cw_log_debug0("DTLS connection to %s established",str);
|
||||
}
|
||||
#endif
|
||||
|
||||
join_state(conn);
|
||||
|
||||
return 1;
|
||||
}
|
98
src/wtp/run.c
Normal file
98
src/wtp/run.c
Normal file
@ -0,0 +1,98 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/conn.h"
|
||||
#include "capwap/radioinfo.h"
|
||||
#include "capwap/cw_log.h"
|
||||
#include "capwap/dtls.h"
|
||||
|
||||
|
||||
#include "wtp_conf.h"
|
||||
|
||||
static int echo_interval_timer;
|
||||
|
||||
struct cwrmsg * get_response(struct conn * conn, int type,int seqnum)
|
||||
{
|
||||
struct cwrmsg * cwrmsg;
|
||||
int i;
|
||||
for(i=0; i<conf_retransmit_interval; i++){
|
||||
cwrmsg = conn_get_message(conn);
|
||||
if ( cwrmsg==0){
|
||||
//printf("null message \n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cwrmsg->type==type && cwrmsg->seqnum==seqnum)
|
||||
return cwrmsg;
|
||||
printf("another message was detected %i %i\n",cwrmsg->type,cwrmsg->seqnum);
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct cwrmsg * send_request(struct conn * conn,struct cwmsg *cwmsg)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<conf_max_retransmit; i++){
|
||||
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
if (i>0){
|
||||
cw_log_debug1("Retransmitting request, type=%i,seqnum=%i",cwmsg->type,cwmsg->seqnum);
|
||||
}
|
||||
#endif
|
||||
|
||||
int rc = conn_send_cwmsg(conn,cwmsg);
|
||||
if (rc<0){
|
||||
cw_log_debug1("Error sending request, type=%i, seqnum %i, %s",cwmsg->type,cwmsg->seqnum,strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
struct cwrmsg * r = get_response(conn,cwmsg->type+1,cwmsg->seqnum);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int run(struct conn * conn)
|
||||
{
|
||||
struct radioinfo radioinfo;
|
||||
memset(&radioinfo,0,sizeof(radioinfo));
|
||||
|
||||
echo_interval_timer=time(NULL);
|
||||
while (1){
|
||||
if (time(NULL)-echo_interval_timer >= conf_echo_interval)
|
||||
{
|
||||
struct cwmsg cwmsg;
|
||||
uint8_t buffer[CWMSG_MAX_SIZE];
|
||||
|
||||
// cwsend_echo_request(conn,&radioinfo);
|
||||
|
||||
cw_log_debug1("Sending echo request");
|
||||
cwmsg_init_echo_request(&cwmsg,buffer,conn,&radioinfo);
|
||||
struct cwrmsg * rc = send_request(conn,&cwmsg);
|
||||
|
||||
// printf("conn->seqnum %i\n",conn->seqnum);
|
||||
// struct cwrmsg * rc = get_response(conn,CWMSG_ECHO_RESPONSE,conn->seqnum);
|
||||
if (rc==0){
|
||||
|
||||
dtls_shutdown(conn);
|
||||
cw_log_debug1("Connection lost, no echo response");
|
||||
return 0;
|
||||
}
|
||||
echo_interval_timer=time(NULL);
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
15
src/wtp/sulking.c
Normal file
15
src/wtp/sulking.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "capwap/cw_log.h"
|
||||
|
||||
#include "wtp.h"
|
||||
#include "wtp_conf.h"
|
||||
|
||||
int sulking_state()
|
||||
{
|
||||
cw_log_debug0("Entering Sulking state");
|
||||
cw_log_debug0("Sleeping for %i seconds",conf_silent_interval);
|
||||
sleep(conf_silent_interval);
|
||||
return 1;
|
||||
}
|
||||
|
81
src/wtp/wtp.defaul.conf
Normal file
81
src/wtp/wtp.defaul.conf
Normal file
@ -0,0 +1,81 @@
|
||||
#
|
||||
|
||||
dtls_psk = Tube
|
||||
wtp_name = "tabbe"
|
||||
|
||||
|
||||
#primary_if = eth0
|
||||
|
||||
preferred_ac = 192.168.0.15
|
||||
|
||||
|
||||
# ac_list
|
||||
# list of ACs where to send discovery requests
|
||||
#
|
||||
# default:
|
||||
# ac_list =
|
||||
|
||||
|
||||
# conf_control_port
|
||||
#
|
||||
# default:
|
||||
# control_port = 5246
|
||||
|
||||
# max_discovery_interval
|
||||
# before sending a discovery request the wtp
|
||||
# will sleep for a randomly selected time not
|
||||
# greater than max_discovery_interval
|
||||
#
|
||||
# deault:
|
||||
# max_discovery_interval = 20
|
||||
max_discovery_interval = 2
|
||||
|
||||
|
||||
# discovery_interval
|
||||
# the number of seconds the wtp will wait after
|
||||
# receiving a discovery response to get eventually
|
||||
# discovery response messages from other ACs.
|
||||
#
|
||||
# default:
|
||||
# discovery_interval = 5
|
||||
discovery_interval = 1
|
||||
|
||||
# max_discoveries
|
||||
# the number of discovery request sent by the wtp
|
||||
# before the wtp enters suking state
|
||||
#
|
||||
# default:
|
||||
# max_discoveries = 10
|
||||
max_discoveries = 3
|
||||
|
||||
|
||||
# silent_interval
|
||||
# number of seconds to sleep in sulking state
|
||||
#
|
||||
# default:
|
||||
# silent_interval = 30
|
||||
|
||||
silent_interval = 4
|
||||
|
||||
# dtls_cipher
|
||||
# supported ciphers
|
||||
#
|
||||
# default:
|
||||
# dtls_cipher = "PSK-AES128-CBC-SHA"
|
||||
|
||||
# debug_level
|
||||
# debug level
|
||||
#
|
||||
# default:
|
||||
# debug_level =
|
||||
|
||||
# max_retransmit
|
||||
# maximum number of retransmissions for capwap packets
|
||||
# default:
|
||||
# max_retransmit = 5
|
||||
|
||||
# echo_interval
|
||||
# default:
|
||||
# echo_interval = 30
|
||||
|
||||
|
7
src/wtp/wtp.h
Normal file
7
src/wtp/wtp.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef __WTP_H
|
||||
#define __WTP_H
|
||||
|
||||
extern int sulking_state();
|
||||
extern int join();
|
||||
|
||||
#endif
|
254
src/wtp/wtp_conf.c
Normal file
254
src/wtp/wtp_conf.c
Normal file
@ -0,0 +1,254 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <confuse.h>
|
||||
#include <sys/types.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
|
||||
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/cw_log.h"
|
||||
#include "wtp_conf.h"
|
||||
|
||||
char * conf_primary_if=0;
|
||||
char * conf_wtpname=0;
|
||||
char * conf_dtls_psk=0;
|
||||
char * conf_preferred_ac=0;
|
||||
char * conf_dtls_cipher=0;
|
||||
|
||||
|
||||
struct sockaddr_storage * conf_preferred_ac_sa=0;
|
||||
|
||||
|
||||
char ** conf_ac_list;
|
||||
int conf_ac_list_len;
|
||||
char * conf_control_port=0;
|
||||
uint8_t conf_macaddress[12];
|
||||
uint8_t conf_macaddress_len=0;
|
||||
|
||||
long conf_max_discovery_interval=CONF_DEFAULT_MAX_DISCOVERY_INTERVAL;
|
||||
long conf_discovery_interval=CONF_DEFAULT_DISCOVERY_INTERVAL;
|
||||
long conf_silent_interval=CONF_DEFAULT_SILENT_INTERVAL;
|
||||
long conf_max_discoveries=CONF_DEFAULT_MAX_DISCOVERIES;
|
||||
long conf_echo_interval=CONF_DEFAULT_ECHO_INTERVAL;
|
||||
long conf_max_retransmit=CONF_DEFAULT_MAX_RETRANSMIT;
|
||||
long conf_retransmit_interval=CONF_DEFAULT_RETRANSMIT_INTERVAL;
|
||||
|
||||
long conf_debug_level=CONF_DEFAULT_DEBUG_LEVEL;
|
||||
|
||||
|
||||
int wtpconf_init()
|
||||
{
|
||||
|
||||
|
||||
if (conf_preferred_ac){
|
||||
conf_preferred_ac_sa=malloc(sizeof(struct sockaddr_storage));
|
||||
if (sock_strtoaddr(conf_preferred_ac,conf_preferred_ac_sa)!=1)
|
||||
{
|
||||
cw_log(LOG_ERR,"Preferred AC, invalid address: %s",conf_preferred_ac);
|
||||
free(conf_preferred_ac_sa);
|
||||
conf_preferred_ac_sa=0;
|
||||
}
|
||||
else{
|
||||
if (sock_getport(conf_preferred_ac_sa)==0){
|
||||
sock_setport(conf_preferred_ac_sa,conf_control_port);
|
||||
}
|
||||
}
|
||||
if (conf_preferred_ac_sa!=0){
|
||||
char str[100];
|
||||
sock_addrtostr(conf_preferred_ac_sa,str,100);
|
||||
cw_log(LOG_INFO,"Preferred AC: %s\n",str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
char * get_prim(int family)
|
||||
{
|
||||
struct ifaddrs *ifap,*ifa;
|
||||
char * r = 0;
|
||||
|
||||
getifaddrs(&ifap);
|
||||
|
||||
for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
if (ifa->ifa_flags & IFF_LOOPBACK){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ifa->ifa_addr->sa_family != family)
|
||||
continue;
|
||||
|
||||
r = malloc(strlen(ifa->ifa_name)+1);
|
||||
if (r)
|
||||
strcpy(r,ifa->ifa_name);
|
||||
break;
|
||||
|
||||
}
|
||||
freeifaddrs(ifap);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
wtpconf_primary_if()
|
||||
{
|
||||
if (!conf_primary_if){
|
||||
|
||||
#ifdef WITH_IPV6
|
||||
conf_primary_if = get_prim(AF_INET6);
|
||||
if (!conf_primary_if)
|
||||
conf_primary_if = get_prim(AF_INET);
|
||||
#else
|
||||
conf_primary_if = get_prim(AF_INET);
|
||||
#endif
|
||||
if (!conf_primary_if){
|
||||
cw_log(LOG_ERR,"Fatal: Unable to detect primary interface");
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
if (!sock_getifhwaddr(conf_primary_if,conf_macaddress,&conf_macaddress_len)){
|
||||
cw_log(LOG_ERR,"Fatal: Unable to detect link layer address for %s\n",conf_primary_if);
|
||||
return 0;
|
||||
};
|
||||
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
char str[128];
|
||||
sock_hwaddrtostr(conf_macaddress,conf_macaddress_len,str);
|
||||
cw_log_debug0("Using primary interface: %s",conf_primary_if);
|
||||
cw_log_debug0("Using primary mac address: %s",str);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char * default_ac_list[] = {
|
||||
"255.255.255.255",
|
||||
"224.0.1.140",
|
||||
};
|
||||
|
||||
wtpconf_ac_list()
|
||||
{
|
||||
if (conf_ac_list)
|
||||
return 1;
|
||||
|
||||
int i;
|
||||
int len=0;
|
||||
int bcrc;
|
||||
struct sockaddr_storage bcaddr;
|
||||
|
||||
bcrc = sock_getifaddr(conf_primary_if,AF_INET,IFF_BROADCAST,&bcaddr);
|
||||
if (bcrc)
|
||||
len++;
|
||||
|
||||
int deflen = sizeof(default_ac_list)/sizeof(char*);
|
||||
|
||||
len += deflen;
|
||||
conf_ac_list = malloc(len*sizeof(char*));
|
||||
if (!conf_ac_list)
|
||||
return 0;
|
||||
|
||||
for (i=0; i<deflen; i++){
|
||||
conf_ac_list[i]=strdup(default_ac_list[i]);
|
||||
if (!conf_ac_list[i])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bcrc){
|
||||
char bcstr[100];
|
||||
sock_addrtostr(&bcaddr,bcstr,100);
|
||||
char * c = strchr(bcstr,':');
|
||||
*c=0;
|
||||
conf_ac_list[i]=strdup(bcstr);
|
||||
}
|
||||
|
||||
conf_ac_list_len=len;
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
for (i=0; i<conf_ac_list_len; i++){
|
||||
cw_log_debug0("Using AC: %s\n",conf_ac_list[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read_config(const char * filename){
|
||||
int i,n;
|
||||
|
||||
|
||||
conf_control_port=strdup(CAPWAP_CONTROL_PORT_STR);
|
||||
conf_dtls_cipher=strdup(CONF_DEFAULT_DTLS_CIPHER);
|
||||
|
||||
cfg_opt_t opts[] = {
|
||||
CFG_SIMPLE_STR("wtp_name",&conf_wtpname),
|
||||
CFG_SIMPLE_STR("dtls_psk",&conf_dtls_psk),
|
||||
CFG_SIMPLE_STR("preferred_ac",&conf_preferred_ac),
|
||||
CFG_SIMPLE_STR("primary_if",&conf_primary_if),
|
||||
CFG_SIMPLE_STR("dtls_cipher",&conf_dtls_cipher),
|
||||
CFG_STR_LIST("ac_list", "{}", CFGF_NONE),
|
||||
CFG_SIMPLE_STR("control_port",&conf_control_port),
|
||||
CFG_SIMPLE_INT("discovery_interval",&conf_discovery_interval),
|
||||
CFG_SIMPLE_INT("max_discovery_interval",&conf_max_discovery_interval),
|
||||
CFG_SIMPLE_INT("max_discoveries",&conf_max_discoveries),
|
||||
CFG_SIMPLE_INT("silent_interval",&conf_silent_interval),
|
||||
CFG_SIMPLE_INT("debug_level",&conf_debug_level),
|
||||
CFG_SIMPLE_INT("max_retransmit",&conf_max_retransmit),
|
||||
CFG_SIMPLE_INT("retransmit_interval",&conf_retransmit_interval),
|
||||
CFG_SIMPLE_INT("echo_interval",&conf_echo_interval),
|
||||
|
||||
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
cfg_t *cfg;
|
||||
cfg = cfg_init(opts, 0);
|
||||
|
||||
cfg_parse(cfg, filename);
|
||||
|
||||
|
||||
n = cfg_size(cfg, "ac_list");
|
||||
if (n>0)
|
||||
{
|
||||
conf_ac_list=malloc(sizeof(char*)*n);
|
||||
if (!conf_ac_list)
|
||||
goto errX;
|
||||
|
||||
conf_ac_list_len=0;
|
||||
for (i=0; i<n; i++){
|
||||
char * str = cfg_getnstr(cfg,"ac_list",i);
|
||||
conf_ac_list[conf_ac_list_len]=malloc(strlen(str)+1);
|
||||
if(conf_ac_list) {
|
||||
strcpy(conf_ac_list[conf_ac_list_len],str);
|
||||
conf_ac_list_len++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!wtpconf_primary_if())
|
||||
goto errX;
|
||||
|
||||
if (!wtpconf_ac_list()){
|
||||
printf("ac list error\n");
|
||||
goto errX;
|
||||
}
|
||||
|
||||
|
||||
// wtpconf_init();
|
||||
return 1;
|
||||
|
||||
errX:
|
||||
cfg_free(cfg);
|
||||
return 0;
|
||||
|
||||
}
|
62
src/wtp/wtp_conf.h
Normal file
62
src/wtp/wtp_conf.h
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef __WTP_CONF_H
|
||||
#define __WTP_CONF_H
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "capwap/capwap.h"
|
||||
|
||||
extern int read_config(const char * filename);
|
||||
extern char * conf_wtpname;
|
||||
extern char * conf_dtls_psk;
|
||||
extern struct sockaddr_storage * conf_preffered_ac_sa;
|
||||
extern char * conf_primary_if;
|
||||
|
||||
extern char ** conf_ac_list;
|
||||
|
||||
extern int conf_ac_list_len;
|
||||
extern char * conf_control_port;
|
||||
|
||||
extern uint8_t conf_macaddress[12];
|
||||
extern uint8_t conf_macaddress_len;
|
||||
|
||||
|
||||
|
||||
#ifndef CONF_DEFAULT_MAX_DISCOVERY_INTERVAL
|
||||
#define CONF_DEFAULT_MAX_DISCOVERY_INTERVAL CAPWAP_MAX_DISCOVERY_INTERVAL
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_SILENT_INTERVAL
|
||||
#define CONF_DEFAULT_SILENT_INTERVAL CAPWAP_SILENT_INTERVAL
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_DISCOVERY_INTERVAL
|
||||
#define CONF_DEFAULT_DISCOVERY_INTERVAL CAPWAP_DISCOVERY_INTERVAL
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_MAX_DISCOVERIES
|
||||
#define CONF_DEFAULT_MAX_DISCOVERIES CAPWAP_MAX_DISCOVERIES
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_DTLS_CIPHER
|
||||
#define CONF_DEFAULT_DTLS_CIPHER CAPWAP_CIPHER
|
||||
#endif
|
||||
|
||||
#define CONF_DEFAULT_ECHO_INTERVAL CAPWAP_ECHO_INTERVAL
|
||||
#define CONF_DEFAULT_MAX_RETRANSMIT CAPWAP_MAX_RETRANSMIT
|
||||
#define CONF_DEFAULT_RETRANSMIT_INTERVAL CAPWAP_RETRANSMIT_INTERVAL
|
||||
|
||||
#define CONF_DEFAULT_DEBUG_LEVEL -1
|
||||
|
||||
|
||||
extern long conf_max_discovery_interval;
|
||||
extern long conf_discovery_interval;
|
||||
extern long conf_silent_interval;
|
||||
extern long conf_max_discoveries;
|
||||
extern char * conf_dtls_cipher;
|
||||
extern long conf_echo_interval;
|
||||
extern long conf_max_retransmit;
|
||||
extern long conf_retransmit_interval;
|
||||
|
||||
extern long conf_debug_level;
|
||||
|
||||
#endif
|
80
src/wtp/wtp_interface.c
Normal file
80
src/wtp/wtp_interface.c
Normal file
@ -0,0 +1,80 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "capwap/wtpinfo.h"
|
||||
#include "capwap/acinfo.h"
|
||||
#include "capwap/conn.h"
|
||||
|
||||
#include "wtp_conf.h"
|
||||
#include "wtp_interface.h"
|
||||
|
||||
|
||||
struct wtpinfo * get_wtpinfo()
|
||||
{
|
||||
struct wtpinfo * wtpinfo;
|
||||
wtpinfo=malloc(sizeof(struct wtpinfo));
|
||||
memset(wtpinfo,0,sizeof(struct wtpinfo));
|
||||
|
||||
wtpinfo->name = (uint8_t*)"wtp";
|
||||
wtpinfo->location = (uint8_t*)"Unknown";
|
||||
|
||||
wtpinfo->max_radios=wtpdrv_get_num_radios();
|
||||
/* int i;
|
||||
for (i=0; i<wtpdrv_get_num_radios(); i++){
|
||||
wtpdrv_get_radioinfo(i+1,&wtpinfo.radioinfo[i+1]);
|
||||
|
||||
}
|
||||
*/
|
||||
wtpinfo->serial_no="123456789";
|
||||
wtpinfo->vendor_id=909090;
|
||||
|
||||
wtpinfo->model_no="WNDR 3700";
|
||||
|
||||
wtpinfo->bootloader_version="1.0";
|
||||
wtpinfo->bootloader_vendor_id=12345;
|
||||
|
||||
wtpinfo->hardware_version="2.5";
|
||||
wtpinfo->hardware_vendor_id=909090;
|
||||
|
||||
wtpinfo->software_version="2.0";
|
||||
wtpinfo->software_vendor_id=109090;
|
||||
|
||||
wtpinfo->macaddress=conf_macaddress;
|
||||
wtpinfo->macaddress_len=conf_macaddress_len;
|
||||
|
||||
wtpinfo->mac_type=1;
|
||||
|
||||
|
||||
wtpinfo->session_id = malloc(8);
|
||||
wtpinfo->session_id_len = cw_rand(wtpinfo->session_id,8);
|
||||
|
||||
|
||||
wtpinfo->frame_tunnel_mode=0;
|
||||
return wtpinfo;
|
||||
}
|
||||
|
||||
void destroy_wtpinfo(struct wtpinfo* wtpinfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
ACIPLIST * order_aciplist(ACIPLIST *aciplistin)
|
||||
{
|
||||
// ACIPLIST * aciplist = aciplist_create();
|
||||
|
||||
// aciplist_foreach(aciplistin);
|
||||
|
||||
return aciplistin;
|
||||
}
|
||||
|
||||
|
||||
static struct conn * conn=0;
|
||||
struct conn * get_conn()
|
||||
{
|
||||
if (!conn){
|
||||
conn = conn_create(-1,0,0);
|
||||
}
|
||||
return conn;
|
||||
}
|
9
src/wtp/wtp_interface.h
Normal file
9
src/wtp/wtp_interface.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef __WTP_INTERFACE_H
|
||||
#define __WTP_INTERFACE_H
|
||||
|
||||
#include "capwap/wtpinfo.h"
|
||||
extern struct wtpinfo * get_wtpinfo();
|
||||
extern struct conn * get_conn();
|
||||
|
||||
#endif
|
||||
|
130
src/wtp/wtp_main.c
Normal file
130
src/wtp/wtp_main.c
Normal file
@ -0,0 +1,130 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
//#include <iwlib.h>
|
||||
|
||||
#include "capwap/sock.h"
|
||||
#include "capwap/conn.h"
|
||||
#include "capwap/dtls.h"
|
||||
#include "capwap/avltree.h"
|
||||
#include "capwap/cw_log.h"
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/cw_util.h"
|
||||
#include "capwap/wtpinfo.h"
|
||||
|
||||
#include "wtp.h"
|
||||
#include "wtp_conf.h"
|
||||
|
||||
|
||||
|
||||
struct wtpinfo wtpinfo;
|
||||
|
||||
//int conf_rids[2];
|
||||
//int conf_rids_len[2];
|
||||
|
||||
//int responses = 0;
|
||||
|
||||
struct avltree * aclist =0;
|
||||
|
||||
|
||||
extern struct wpa_driver_ops *wpa_drivers[];
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
//struct sockaddr conf_preferred_ac;
|
||||
|
||||
|
||||
|
||||
static void * drv_priv[2];
|
||||
static void * drv_glob[2];
|
||||
|
||||
const char * interfaces[]={
|
||||
"wlan0",
|
||||
"wlan1-1"
|
||||
};
|
||||
|
||||
/*static int drv_init()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
wtp_main();
|
||||
}
|
||||
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
//#include <openssl/ssl.h>
|
||||
|
||||
int do_connect(void *priv,void *data)
|
||||
{
|
||||
ACIP * ip = (ACIP*)data;
|
||||
// char str[100];
|
||||
// sock_addrtostr((struct sockaddr*)&ip->ip,str,100);
|
||||
|
||||
sock_setport(&ip->ip,atoi(conf_control_port));
|
||||
// printf("Would connect to %s\n",str);
|
||||
|
||||
int rc =join(&ip->ip);
|
||||
if (!rc)
|
||||
return 1;
|
||||
|
||||
run (get_conn());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wtp_main(const char *ad)
|
||||
{
|
||||
if (!read_config("wtp.conf")){
|
||||
return 1;
|
||||
}
|
||||
cw_log_debug_level=conf_debug_level;
|
||||
|
||||
#ifdef WITH_DTLS
|
||||
dtls_init();
|
||||
#endif
|
||||
|
||||
//drv_init();
|
||||
|
||||
|
||||
while (1){
|
||||
ACIPLIST * aciplist=0;
|
||||
int i;
|
||||
|
||||
cw_log_debug0("Entering discovery state");
|
||||
|
||||
do {
|
||||
for (i=0; i<conf_ac_list_len; i++){
|
||||
if ((aciplist = do_discovery(conf_ac_list[i])))
|
||||
break;
|
||||
}
|
||||
}while (!aciplist);
|
||||
|
||||
cw_log_debug0("Entering join state");
|
||||
if (!aciplist){
|
||||
cw_log_debug0("Don't got any discovery response");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
aciplist_foreach(aciplist,do_connect,0);
|
||||
|
||||
aciplist_destroy(aciplist);
|
||||
|
||||
|
||||
}
|
||||
exit(0);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
72
src/wtp/wtpdrv.c
Normal file
72
src/wtp/wtpdrv.c
Normal file
@ -0,0 +1,72 @@
|
||||
#include "wtpdrv.h"
|
||||
|
||||
|
||||
int wtpdrv_get_num_radios()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
static int wtpdrv_get_radioinfo(int rid,struct radioinfo * radioinfo)
|
||||
{
|
||||
struct wpa_driver_ops * drv = wpa_drivers[0];
|
||||
|
||||
struct hostapd_hw_modes * hwm;
|
||||
uint16_t nummodes;
|
||||
uint16_t fl;
|
||||
|
||||
radioinfo->rid=rid;
|
||||
|
||||
hwm = drv->get_hw_feature_data(drv_priv[rid-1],&nummodes,&fl);
|
||||
|
||||
int i;
|
||||
for (i=0; i<nummodes; i++){
|
||||
printf ("Mode %d\n",i);
|
||||
printf ("------------------------\n");
|
||||
printf ("Num channels: %d\n",hwm[i].num_channels);
|
||||
|
||||
|
||||
|
||||
printf ("Hwmod: %d\n",hwm[i].mode);
|
||||
|
||||
int mode = hwm[i].mode;
|
||||
switch(mode){
|
||||
case HOSTAPD_MODE_IEEE80211B:
|
||||
radioinfo->type|=CWRADIO_TYPE_B;
|
||||
printf("Mode B\n");
|
||||
break;
|
||||
case HOSTAPD_MODE_IEEE80211G:
|
||||
radioinfo->type|=CWRADIO_TYPE_G;
|
||||
printf("Mode G\n");
|
||||
break;
|
||||
case HOSTAPD_MODE_IEEE80211A:
|
||||
radioinfo->type|=CWRADIO_TYPE_A;
|
||||
printf("Mode A\n");
|
||||
break;
|
||||
case NUM_HOSTAPD_MODES:
|
||||
printf("NIMA AP MODES\n");
|
||||
break;
|
||||
|
||||
}
|
||||
if (hwm[i].ht_capab)
|
||||
radioinfo->type|=CWRADIO_TYPE_N;
|
||||
|
||||
printf ("ht_capab: %d\n",hwm[i].ht_capab);
|
||||
printf ("flags: %d\n",hwm[i].flags);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////// printf("hem %p\n",hwm);
|
||||
|
||||
// drv
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
4
src/wtp/wtpdrv.h
Normal file
4
src/wtp/wtpdrv.h
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
int wtpdrv_get_num_radios();
|
||||
|
Reference in New Issue
Block a user