Working on mods...
FossilOrigin-Name: 38c2ad1dd0ad8734bd1c30721f63fecfc6f011c32163b750757ef50a961c131d
This commit is contained in:
parent
ffad4eb8a9
commit
b2710dc698
@ -86,11 +86,12 @@ extern struct mod_ac * cw_get_mod_ac(const char *name);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int rc = 0;
|
||||
/*
|
||||
struct mod_ac *m = cw_get_mod_ac("cipwap");
|
||||
printf("Ptr: %p\n",m);
|
||||
|
||||
//struct mod_ac *m = cw_get_mod_ac("capwap");
|
||||
//m->init();
|
||||
//exit(0);
|
||||
|
||||
m->init();
|
||||
*/
|
||||
|
||||
/* parse arguments */
|
||||
parse_args(argc, argv);
|
||||
|
@ -134,6 +134,20 @@ static int init_acname()
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include "capwap/mod.h"
|
||||
|
||||
|
||||
struct mod_ac * conf_mods[10];
|
||||
|
||||
static int init_mods()
|
||||
{
|
||||
|
||||
conf_mods[0]=cw_get_mod_ac("cipwap");
|
||||
conf_mods[1]=NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_acid()
|
||||
{
|
||||
|
||||
@ -811,6 +825,8 @@ int read_config(const char *filename)
|
||||
if (!conf_image_dir)
|
||||
conf_image_dir = CONF_DEFAULT_IMAGE_DIR;
|
||||
|
||||
init_mods();
|
||||
|
||||
conf_init_capwap_mode();
|
||||
|
||||
|
||||
|
@ -29,6 +29,10 @@
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/lwapp.h"
|
||||
#include "capwap/bstr.h"
|
||||
#include "capwap/mod.h"
|
||||
|
||||
|
||||
extern struct mod_ac * conf_mods[10];
|
||||
|
||||
#ifndef CONF_DEFAULT_ACNAME
|
||||
#define CONF_DEFAULT_ACNAME "AC"
|
||||
|
@ -77,7 +77,6 @@ void socklist_destroy()
|
||||
free(socklist);
|
||||
socklist = 0;
|
||||
pthread_mutex_destroy(&socklist_mutex);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -510,8 +510,6 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr)
|
||||
replyfd = socklist[socklistindex].sockfd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int sockfd = replyfd; //socklist[socklistindex].reply_sockfd;
|
||||
|
||||
|
||||
@ -519,7 +517,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr)
|
||||
socklen_t dbgaddrl=sizeof(dbgaddr);
|
||||
getsockname(sockfd,&dbgaddr,&dbgaddrl);
|
||||
|
||||
cw_dbg(DBG_INFO,"Creating wtpman with socket %d, %s:%d",sockfd,sock_addr2str(&dbgaddr),sock_getport(&dbgaddr));
|
||||
cw_dbg(DBG_INFO,"Creating wtpman on socket %d, %s:%d",sockfd,sock_addr2str(&dbgaddr),sock_getport(&dbgaddr));
|
||||
|
||||
wtpman->conn = conn_create(sockfd, srcaddr, 100);
|
||||
if (!wtpman->conn) {
|
||||
|
@ -47,7 +47,7 @@ LOGOBJS=log.o \
|
||||
log_file.o \
|
||||
dbg_strings.o\
|
||||
dbg.o \
|
||||
cw_get_mods.o
|
||||
cw_get_mod_ac.o
|
||||
|
||||
|
||||
WTPINFOOBJS =\
|
||||
@ -290,6 +290,7 @@ CFLAGS += $(GNUTLS_CFLAGS) \
|
||||
|
||||
|
||||
#SRCS = $(OBJS:.o=.c)
|
||||
MODOBJS=$(wildcard ./mod/cipwap/$(ARCH)/*.o)
|
||||
|
||||
$(ARCH)/%.o:%.c
|
||||
@mkdir -p $(ARCH)
|
||||
@ -297,7 +298,7 @@ $(ARCH)/%.o:%.c
|
||||
@$(CC) -c $(CFLAGS) $< -o $@
|
||||
# @$(CC) -MM $(CFLAGS) $< > $*.d
|
||||
|
||||
$(ARCH)/$(NAME) : $(OBJS)
|
||||
$(ARCH)/$(NAME) : $(OBJS) $(MODOBJS)
|
||||
@echo " AR $(ARCH)/$(NAME)"
|
||||
@$(AR) rcs $(ARCH)/$(NAME) $(OBJS) $(MODOBJS)
|
||||
|
||||
@ -305,17 +306,23 @@ $(ARCH)/$(NAME) : $(OBJS)
|
||||
SRCS = $(OBJS:.o=.c)
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
mod_cipwap:
|
||||
$(MAKE) -C mod/cipwap
|
||||
|
||||
|
||||
.PHONY: deps clean clean_libs libs
|
||||
|
||||
|
||||
# top-level rule, to compile everything.
|
||||
all: $(ARCH)/$(NAME)
|
||||
all:
|
||||
$(MAKE) mod_cipwap
|
||||
$(MAKE) capwap
|
||||
|
||||
|
||||
capwap: $(ARCH)/$(NAME)
|
||||
|
||||
|
||||
|
||||
|
||||
mod_cipwap:
|
||||
$(MAKE) -C mod/cipwap
|
||||
|
||||
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "intavltree.h"
|
||||
|
||||
#include "mbag.h"
|
||||
#include "mod.h"
|
||||
|
||||
/**
|
||||
* Connection Object
|
||||
@ -181,8 +182,10 @@ struct conn {
|
||||
int (*process_packet)(struct conn *conn, uint8_t * packet, int len,struct sockaddr *from);
|
||||
int (*process_message)(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
||||
struct sockaddr *from);
|
||||
|
||||
|
||||
|
||||
void * mods;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "mod.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
struct mod_ac *(*mods_ac[])() = MODS_AC;
|
||||
|
||||
@ -11,11 +14,10 @@ struct mod_ac * cw_get_mod_ac(const char *name)
|
||||
{
|
||||
int i;
|
||||
for (i=0; mods_ac[i];i++){
|
||||
|
||||
struct mod_ac * m = mods_ac[i]();
|
||||
if (strcmp(m->name,name)==0)
|
||||
return m;
|
||||
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
@ -3,12 +3,20 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "sock.h"
|
||||
#include "conn.h"
|
||||
|
||||
struct mod_ac
|
||||
{
|
||||
/** Name of the mod */
|
||||
const char *name;
|
||||
/** Initializion method */
|
||||
int (*init)();
|
||||
int (*detect_by_raw)(const char *msg, int len);
|
||||
int (*detect_by_discovery)(const char*);
|
||||
/** Detect capwap
|
||||
This function ifter receiving and disassembling a complete
|
||||
CAPWAP message. Either on Discovery Request or Join Request
|
||||
**/
|
||||
int (*detect)(struct conn *conn,const char *rawmsg, int rawlen,struct sockaddr *from);
|
||||
};
|
||||
|
||||
|
||||
@ -18,5 +26,6 @@ struct mod_ac
|
||||
#define MODS_AC { mod_cipwap_ac,NULL }
|
||||
|
||||
|
||||
extern struct mod_ac * cw_get_mod_ac(const char *name);
|
||||
|
||||
#endif
|
||||
|
@ -11,8 +11,8 @@ int cipwap_init()
|
||||
|
||||
|
||||
static struct mod_ac cipwap_ac = {
|
||||
// .init = cipwap_init()
|
||||
|
||||
.init = cipwap_init,
|
||||
.name ="cipwap"
|
||||
};
|
||||
|
||||
struct mod_ac * mod_cipwap_ac(){
|
||||
|
@ -12,6 +12,7 @@ cp libubox.so /usr/local/lib
|
||||
ldconfig
|
||||
cd ../..
|
||||
|
||||
|
||||
git clone git://nbd.name/uci.git uci
|
||||
cd uci
|
||||
mkdir build
|
||||
|
@ -22,33 +22,8 @@
|
||||
"radios":{
|
||||
"0":{
|
||||
"admin_state":"1",
|
||||
"aironet_ie":"0",
|
||||
"allow_aaa_override":"1",
|
||||
"bssid":".x123456789abc",
|
||||
"dot11e_data":".x0042435e0062322f000000000000000000000000000000000000000000000000",
|
||||
"dot11e_len":"0",
|
||||
"dtim_period":"241",
|
||||
"enc_capab":"1073",
|
||||
"enc_policy":"5",
|
||||
"key":".x210127bab42d5c063ae05a292ea01709d00a6347407e52d5f14d5a6ab82dae3a",
|
||||
"key_index":"1",
|
||||
"key_shared":"0",
|
||||
"max_clients":"17",
|
||||
"qos":"0",
|
||||
"radio_id":"0",
|
||||
"radio_type":"1",
|
||||
"reserved":".x000000000000000000000000000000000cdd0a00c0b9010000000801010000000000000000000000000000000000000000",
|
||||
"reserved2":".x00000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"rsn_data":".x0000000000000000000000000000001630140100000fac020100000fac040100000fac0229000000000000000000000000000000000000000000000000000000",
|
||||
"rsn_len":"0",
|
||||
"ssid":"Hotler",
|
||||
"ssid_broadcast":"1",
|
||||
"wlan_id":"1",
|
||||
"wlan_name":".x53757065726e6574776f726b3230313521212100000000000000000000000000",
|
||||
"wme_data":".x0000000000000000000000000000001add180050f2020101800003a4000027a4",
|
||||
"wme_len":"0",
|
||||
"wpa_data":".xdd1c0050f20101000050f20202000050f2020050f20401000050f20200000000",
|
||||
"wpa_len":"30"
|
||||
"radio_type":"1"
|
||||
},
|
||||
"1":{
|
||||
"admin_state":"1",
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define __NLT_H
|
||||
|
||||
#include "nl80211.h"
|
||||
#include <netlink/socket.h>
|
||||
|
||||
extern const char * nlt_attrnames[];
|
||||
extern const char * nlt_cmdnames[];
|
||||
|
Loading…
Reference in New Issue
Block a user