Work on mods.
FossilOrigin-Name: 2933314d1c705fae5022e022409b5f77a878656baead522ceb629b7f648c8307
This commit is contained in:
parent
8f325f2f6f
commit
a704463acf
@ -15,6 +15,7 @@ CFLAGS += -Werror -g -O0 -D_REENTRANT -DIPV6 -I/usr/local/include -I../ -DSYS_AR
|
||||
|
||||
|
||||
LIBS+=-lcapwap
|
||||
LIBS+=-lcisco
|
||||
LIBS+=-lcipwap
|
||||
LIBS+=-lcw
|
||||
LIBS+=-lrt
|
||||
|
@ -144,7 +144,8 @@ static int init_mods()
|
||||
|
||||
conf_mods[0]=modload_ac("cipwap");
|
||||
conf_mods[1]=modload_ac("capwap");
|
||||
conf_mods[2]=NULL;
|
||||
conf_mods[2]=modload_ac("cisco");
|
||||
conf_mods[3]=NULL;
|
||||
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ UTILOBJS= \
|
||||
stravltree.o \
|
||||
intavltree.o \
|
||||
cw_util.o \
|
||||
send.o
|
||||
send.o \
|
||||
|
||||
MAVLOBJS= \
|
||||
mavl_del.o \
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include "intavltree.h"
|
||||
#include "item.h"
|
||||
|
||||
|
||||
|
||||
struct conn;
|
||||
|
||||
/* Generic functions and structs */
|
||||
void * cw_actionlist_add(struct avltree *t, void *a, size_t s);
|
||||
|
@ -170,13 +170,16 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
|
||||
|
||||
if (!conn->detected) {
|
||||
if (conn->mods){
|
||||
struct mod_ac ** mods = (struct mod_ac **)conn->mods;
|
||||
if (conn->mods) {
|
||||
struct mod_ac **mods = (struct mod_ac **) conn->mods;
|
||||
int i;
|
||||
for (i=0; mods[i]; i++){
|
||||
if (mods[i]->detect){
|
||||
if (mods[i]->detect(conn,rawmsg,len,from)){
|
||||
cw_dbg(DBG_INFO,"Using mod '%s' to handle connection from %s",mods[i]->name,sock_addr2str(from));
|
||||
for (i = 0; mods[i]; i++) {
|
||||
if (mods[i]->detect) {
|
||||
if (mods[i]->detect(conn, rawmsg, len, from)) {
|
||||
cw_dbg(DBG_INFO,
|
||||
"Using mod '%s' to handle connection from %s",
|
||||
mods[i]->name,
|
||||
sock_addr2str(from));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -184,11 +187,12 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
}
|
||||
}
|
||||
|
||||
if (!conn->detected){
|
||||
cw_dbg(DBG_INFO,"Cant't detect capwap, discarding message from %s",sock_addr2str(from));
|
||||
errno=EAGAIN;
|
||||
if (!conn->detected) {
|
||||
cw_dbg(DBG_INFO, "Cant't detect capwap, discarding message from %s",
|
||||
sock_addr2str(from));
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -328,7 +332,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
|
||||
|
||||
int process_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
||||
struct sockaddr *from)
|
||||
struct sockaddr *from)
|
||||
{
|
||||
uint8_t *msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg);
|
||||
|
||||
|
@ -6,6 +6,9 @@
|
||||
|
||||
#include "capwap/sock.h"
|
||||
#include "capwap/conn.h"
|
||||
#include "action.h"
|
||||
|
||||
struct cw_actiondef;
|
||||
|
||||
struct mod_ac
|
||||
{
|
||||
@ -21,6 +24,9 @@ struct mod_ac
|
||||
|
||||
/** used for private data */
|
||||
void *data;
|
||||
|
||||
int (*register_actions)(struct cw_actiondef *def);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
include ../../Macros.mak
|
||||
include ../../Config.mak
|
||||
|
||||
OBJS=\
|
||||
mod_capwap_ac.o \
|
||||
@ -7,30 +5,9 @@ OBJS=\
|
||||
capwap_in_wtp_descriptor.o \
|
||||
capwap_in_wtp_board_data.o
|
||||
|
||||
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
||||
|
||||
|
||||
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I ../../ -I../
|
||||
|
||||
NAME=libcapwap.a
|
||||
LIBDIR=../../lib/$(ARCH)
|
||||
|
||||
SRCS = $(OBJS:.o=.c)
|
||||
|
||||
$(ARCH)/%.o:%.c
|
||||
@mkdir -p $(ARCH)
|
||||
@echo " CC "$<
|
||||
@$(CC) -c $(CFLAGS) $< -o $@
|
||||
include ../Mod.mak
|
||||
|
||||
|
||||
$(LIBDIR)/$(NAME) : $(OBJS) $(MODOBJS)
|
||||
@mkdir -p $(LIBDIR)
|
||||
@echo " AR $(LIBDIR)/$(NAME)"
|
||||
@$(AR) rcs $(LIBDIR)/$(NAME) $(OBJS) $(MODOBJS)
|
||||
|
||||
|
||||
all: $(LIBDIR)/$(NAME)
|
||||
|
||||
clean:
|
||||
rm -rf $(ARCH)
|
||||
rm -f $(LIBDIR)/$(NAME)
|
||||
|
@ -156,9 +156,11 @@ static int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
||||
int capwap_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len, struct sockaddr *from)
|
||||
{
|
||||
|
||||
mbag_t mbag = conn->incomming;
|
||||
|
||||
return cw_read_wtp_descriptor(mbag, conn, a, data, len, 0);
|
||||
int rc =cw_read_wtp_descriptor(mbag, conn, a, data, len, 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#include "mod.h"
|
||||
#include "capwap/mod.h"
|
||||
#include "capwap/log.h"
|
||||
#include "capwap/dbg.h"
|
||||
|
||||
@ -35,7 +35,8 @@ static int detect(struct conn *conn,const uint8_t *rawmsg, int rawlen,struct soc
|
||||
static struct mod_ac capwap_ac = {
|
||||
.name ="capwap",
|
||||
.init = init,
|
||||
.detect = detect
|
||||
.detect = detect,
|
||||
.register_actions = capwap_register_actions_ac
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,32 +1,8 @@
|
||||
include ../../Macros.mak
|
||||
include ../../Config.mak
|
||||
|
||||
OBJS=\
|
||||
mod_cipwap_ac.o
|
||||
|
||||
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
||||
|
||||
|
||||
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I ../../ -I../
|
||||
|
||||
|
||||
NAME=libcipwap.a
|
||||
LIBDIR=../../lib/$(ARCH)
|
||||
|
||||
SRCS = $(OBJS:.o=.c)
|
||||
include ../Mod.mak
|
||||
|
||||
$(ARCH)/%.o:%.c
|
||||
@mkdir -p $(ARCH)
|
||||
@echo " CC "$<
|
||||
@$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(LIBDIR)/$(NAME) : $(OBJS) $(MODOBJS)
|
||||
@mkdir -p $(LIBDIR)
|
||||
@echo " AR $(LIBDIR)/$(NAME)"
|
||||
@$(AR) rcs $(LIBDIR)/$(NAME) $(OBJS) $(MODOBJS)
|
||||
|
||||
|
||||
all: $(LIBDIR)/$(NAME)
|
||||
|
||||
clean:
|
||||
rm -rf $(ARCH)
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#include "mod.h"
|
||||
#include "capwap/mod.h"
|
||||
#include "capwap/log.h"
|
||||
|
||||
#include "mod_cipwap.h"
|
||||
|
Loading…
Reference in New Issue
Block a user