Compare commits
17 Commits
15d0205f89
...
a2e8e77468
Author | SHA1 | Date | |
---|---|---|---|
a2e8e77468 | |||
35813e2cae | |||
80ddc96b9e | |||
dbbdce72fe | |||
2e3035f354 | |||
1f572a2ac0 | |||
b881698d8b | |||
c0038c2dd6 | |||
f12d9060f9 | |||
2915110a8a | |||
d582503c78 | |||
ac58b6cc72 | |||
724260b664 | |||
985ef22917 | |||
7dab041047 | |||
51416668c4 | |||
9106f5a0a3 |
@ -1,5 +1,5 @@
|
||||
#include ../Config.default.mak
|
||||
-include ../Config.mak
|
||||
#-include ../Config.mak
|
||||
include ../Defs.mak
|
||||
|
||||
OBJS = \
|
||||
@ -23,10 +23,10 @@ LIBS+=-lconfuse
|
||||
LIBS+=-lsqlite3
|
||||
LIBS+=-lc
|
||||
LIBS+=-lnettle
|
||||
LIBS+=-lssl
|
||||
LIBS+=$(OPENSSL_LIBS)
|
||||
|
||||
|
||||
INCL_DIRS=-I../ -I/usr/local/include -I./ -I/home/tube/v/rsrch/libmavl/
|
||||
INCL_DIRS=-I../ -I/usr/local/include -I./ -I../../include
|
||||
#FLAGS=-DWITH_IPV6 -DWITH_OPENSSL -DSYS_ARCH="$(ARCH)" -DSYS_ARCH="XXX"
|
||||
FLAGS=-DWITH_IPV6 -DUSE_OPENSSL -DSYS_ARCH='"$(ARCH)"'
|
||||
|
||||
|
@ -197,31 +197,31 @@ ssl_cert="../../ssl/certs/ac-xcisco.pem"
|
||||
# dbg
|
||||
# Set debug level
|
||||
#
|
||||
dbg = info # Show all kind of infos
|
||||
# dbg = info # Show all kind of infos
|
||||
# dbg += all
|
||||
dbg += msg_in # Incomming CAPWAP messages
|
||||
dbg += msg_out # Outgoing CAPWAP messages
|
||||
dbg += msg_err # Be verbose about capwap message errors like re-transmission
|
||||
dbg += msg_dmp
|
||||
dbg += elem_in # CAPWAP message elements
|
||||
dbg += elem_out
|
||||
dbg += subelem #
|
||||
dbg += elem_err # Errors in message elements
|
||||
dbg += elem_dmp # Print hex dump for capwap messages elements
|
||||
dbg += rfc # Show warnings if CAPWAP messages don't conform to RFC
|
||||
dbg += pkt_in # CAPWAP packets received
|
||||
dbg += pkt_out # CAPWAP packets sent
|
||||
dbg += pkt # CAPWAP packets both sent and received
|
||||
dbg += pkt_dmp # Hex dump CAPWAP packets.
|
||||
dbg += pkt_err # Show messages about malformed packets when detected
|
||||
dbg += dtls # Messages concerning DTLS
|
||||
# dbg += msg_in # Incomming CAPWAP messages
|
||||
# dbg += msg_out # Outgoing CAPWAP messages
|
||||
# dbg += msg_err # Be verbose about capwap message errors like re-transmission
|
||||
# dbg += msg_dmp
|
||||
# dbg += elem_in # CAPWAP message elements
|
||||
# dbg += elem_out
|
||||
# dbg += subelem #
|
||||
# dbg += elem_err # Errors in message elements
|
||||
# dbg += elem_dmp # Print hex dump for capwap messages elements
|
||||
# dbg += rfc # Show warnings if CAPWAP messages don't conform to RFC
|
||||
# dbg += pkt_in # CAPWAP packets received
|
||||
# dbg += pkt_out # CAPWAP packets sent
|
||||
# dbg += pkt # CAPWAP packets both sent and received
|
||||
# dbg += pkt_dmp # Hex dump CAPWAP packets.
|
||||
# dbg += pkt_err # Show messages about malformed packets when detected
|
||||
# dbg += dtls # Messages concerning DTLS
|
||||
# dbg += dtls_detail # DTLS in more detail
|
||||
dbg += dtls_bio # DTLS BIO operations
|
||||
# dbg += dtls_bio # DTLS BIO operations
|
||||
# dbg += dtls_bio_dmp # HeXy dump data in BIO operations
|
||||
dbg += warn # misc warnings
|
||||
dbg += mod # Debugs specific to mod
|
||||
dbg += cfg_dmp
|
||||
dbg += state
|
||||
# dbg += warn # misc warnings
|
||||
# dbg = mod # Debugs specific to mod
|
||||
# dbg += cfg_dmp
|
||||
# dbg += state
|
||||
#
|
||||
# dbg += all # all of the above
|
||||
# dbg += err # Same as dbg_err and pkt_err
|
||||
@ -239,7 +239,7 @@ ssl_cert="../../ssl/certs/ac-xcisco.pem"
|
||||
#
|
||||
|
||||
#mods = { cisco, capwap }
|
||||
mods = { cisco, capwap, capwap80211 }
|
||||
mods = { cisco,capwap, capwap80211 }
|
||||
#, capwap80211 }
|
||||
|
||||
mods_dir = ../../lib/Linux/x86_64/
|
||||
|
144
src/ac/ac_main.c
144
src/ac/ac_main.c
@ -46,21 +46,11 @@
|
||||
|
||||
#include "dataman.h"
|
||||
|
||||
#include "cw/cfg.h"
|
||||
|
||||
int ac_run();
|
||||
|
||||
|
||||
static void *alive_thread (void *data)
|
||||
{
|
||||
/* Ping the database every 5 seconds */
|
||||
while (1) {
|
||||
sleep (5);
|
||||
db_ping();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
|
||||
@ -136,70 +126,6 @@ extern void test_sets();
|
||||
#include "cw/ktv.h"
|
||||
|
||||
|
||||
struct mykv {
|
||||
int key;
|
||||
int value;
|
||||
};
|
||||
|
||||
int mycmp (void *e1, void *e2)
|
||||
{
|
||||
struct mykv * k1 = e1;
|
||||
struct mykv * k2 = e2;
|
||||
|
||||
/*//printf("My CMP: %d and %d\n", k1->key, k2->key);
|
||||
*/
|
||||
if (k1->key > k2->key)
|
||||
return 1;
|
||||
|
||||
if (k1->key < k2->key)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
void mavl_walk (struct mavlnode * node)
|
||||
{
|
||||
struct mykv * kv;
|
||||
|
||||
if (!node) {
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
kv = mavlnode_dataptr (node);
|
||||
printf ("KV %d\n", kv->key);
|
||||
|
||||
printf ("go left:");
|
||||
mavl_walk (node->left);
|
||||
printf ("go right:");
|
||||
mavl_walk (node->right);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int stcmp (const void * sa1, const void *sa2)
|
||||
{
|
||||
const char **s1 = sa1;
|
||||
const char **s2 = sa2;
|
||||
int rc;
|
||||
rc = strcmp (*s1, *s2);
|
||||
|
||||
printf ("CMP %s, %s = %d\n", *s1, *s2, rc);
|
||||
return rc;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
static int ibcmp(const void *v1, const void *v2)
|
||||
{
|
||||
int *i1,*i2;
|
||||
i1=v1;i2=v2;
|
||||
|
||||
return *i1-*i2;
|
||||
}
|
||||
*/
|
||||
|
||||
#include "discovery_cache.h"
|
||||
void tester1()
|
||||
{
|
||||
@ -225,6 +151,44 @@ void tester1()
|
||||
}
|
||||
|
||||
|
||||
static void show_cfg (FILE *out, mavl_t ktv)
|
||||
{
|
||||
char value[500];
|
||||
struct cw_KTV * data;
|
||||
mavliter_t it;
|
||||
const struct cw_Type * type;
|
||||
|
||||
|
||||
mavliter_init(&it,ktv);
|
||||
|
||||
mavliter_foreach(&it){
|
||||
|
||||
data = mavliter_get(&it);
|
||||
type = data->type;
|
||||
type->to_str(data,value,0);
|
||||
|
||||
fprintf(out,"%s :%s: %s\n",data->key,type->get_type_name(data), value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
cw_Cfg_t * cfg;
|
||||
cfg=cw_cfg_create();
|
||||
|
||||
cw_cfg_load("tube.akv",cfg);
|
||||
|
||||
// cw_cfg_set(cfg,"cisco/tube","99");
|
||||
// cw_cfg_set(cfg,"Hello","30");
|
||||
|
||||
cw_cfg_dump(cfg);
|
||||
mavl_destroy(cfg);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int rc = 0;
|
||||
@ -232,7 +196,9 @@ int main (int argc, char *argv[])
|
||||
FILE * file;
|
||||
mavl_t types_tree, global_cfg;
|
||||
const cw_Type_t **ti;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* parse arguments */
|
||||
parse_args (argc, argv, &bootcfg);
|
||||
@ -245,6 +211,7 @@ int main (int argc, char *argv[])
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
/* create types tree with default types */
|
||||
types_tree = cw_ktv_create_types_tree();
|
||||
for (ti=CW_KTV_STD_TYPES;*ti;ti++){
|
||||
@ -261,28 +228,18 @@ int main (int argc, char *argv[])
|
||||
|
||||
fclose(file);
|
||||
|
||||
|
||||
actube_global_cfg = global_cfg;
|
||||
|
||||
/* cw_dbg_opt_level=0xffffffff;*/
|
||||
cw_dbg(DBG_INFO,"Hello world");
|
||||
|
||||
|
||||
cw_dbg_ktv_dump(global_cfg,DBG_INFO,NULL,"CFG:",NULL);
|
||||
|
||||
/* int idx;
|
||||
idx = cw_ktv_idx_get(global_cfg,"capwap-control-ip-address/address",0,CW_TYPE_IPADDRESS);
|
||||
printf("IDX: %d\n");
|
||||
|
||||
exit(0);
|
||||
*/
|
||||
|
||||
|
||||
cw_log_name = "AC-Tube";
|
||||
|
||||
if (!read_config ("ac.conf"))
|
||||
return 1;
|
||||
|
||||
start_shell();
|
||||
|
||||
start_shell();
|
||||
|
||||
|
||||
/* Show debug options if there are any set */
|
||||
@ -290,7 +247,7 @@ start_shell();
|
||||
cw_log (LOG_INFO, "Debug Options: %08X", cw_dbg_opt_level);
|
||||
|
||||
/* XXX Hard coded debug settigns, set it by config in the future */
|
||||
cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
|
||||
// cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
|
||||
|
||||
/* Warn, if the "secret" debugging feature for
|
||||
developers is turned on ;) */
|
||||
@ -317,12 +274,7 @@ start_shell();
|
||||
|
||||
db_ping();
|
||||
|
||||
|
||||
/* Start a database "pinger thread", which inserts
|
||||
every xx seconds a timestamp into the DB */
|
||||
pthread_t alth;
|
||||
pthread_create (&alth, NULL, alive_thread, NULL);
|
||||
|
||||
|
||||
/* Init DTLS library */
|
||||
dtls_init();
|
||||
|
||||
|
@ -197,48 +197,6 @@ static int init_vendor_id()
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
static int init_version()
|
||||
{
|
||||
|
||||
// Init hardware version
|
||||
if (!conf_hardware_version) {
|
||||
struct utsname u;
|
||||
int rc = uname(&u);
|
||||
if (rc < 0)
|
||||
conf_hardware_version =
|
||||
(bstr_t) strdup(CONF_DEFAULT_HARDWARE_VERSION);
|
||||
else {
|
||||
char str[265];
|
||||
sprintf(str, "%s / %s %s", u.machine, u.sysname, u.release);
|
||||
conf_hardware_version = (bstr_t) strdup(str);
|
||||
}
|
||||
|
||||
}
|
||||
bstr_replace(&conf_hardware_version,
|
||||
bstr_create_from_cfgstr((char *) conf_hardware_version));
|
||||
|
||||
// software version
|
||||
if (!conf_software_version)
|
||||
conf_software_version = (bstr_t) strdup(CONF_DEFAULT_SOFTWARE_VERSION);
|
||||
bstr_replace(&conf_software_version,
|
||||
bstr_create_from_cfgstr((char *) conf_software_version));
|
||||
|
||||
|
||||
// Cisco hardware version
|
||||
if (!conf_cisco_hardware_version)
|
||||
conf_cisco_hardware_version =
|
||||
(bstr_t) strdup(CONF_DEFAULT_CISCO_HARDWARE_VERSION);
|
||||
bstr_replace(&conf_cisco_hardware_version,
|
||||
bstr_create_from_cfgstr((char *) conf_cisco_hardware_version));
|
||||
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
static int init_control_port()
|
||||
{
|
||||
char str[30];
|
||||
@ -281,10 +239,8 @@ static int init_listen_addrs()
|
||||
|
||||
if (ifa->ifa_addr->sa_family == AF_INET && conf_ipv4)
|
||||
ctr++;
|
||||
#ifdef WITH_IPV6
|
||||
if (ifa->ifa_addr->sa_family == AF_INET6 && conf_ipv6)
|
||||
ctr++;
|
||||
#endif
|
||||
}
|
||||
|
||||
conf_listen_addrs = malloc(sizeof(char *) * ctr);
|
||||
@ -537,14 +493,6 @@ static int conf_read_strings(cfg_t * cfg, char *name, char ***dst, int *len)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
struct conf_dbg_level_names{
|
||||
const char *name;
|
||||
int level;
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
|
||||
static int conf_read_dbg_level(cfg_t * cfg)
|
||||
{
|
||||
@ -571,6 +519,7 @@ char *conf_mods_dir = NULL;
|
||||
* Read the module names from config file
|
||||
*/
|
||||
static int conf_read_mods(cfg_t *cfg){
|
||||
|
||||
int n, i;
|
||||
n = cfg_size(cfg,CFG_ENTRY_MODS);
|
||||
|
||||
@ -590,24 +539,6 @@ static int conf_read_mods(cfg_t *cfg){
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
void conf_init_capwap_mode()
|
||||
{
|
||||
if (conf_capwap_mode_str == NULL)
|
||||
return;
|
||||
|
||||
if (0 == strcmp(conf_capwap_mode_str, "cipwap")) {
|
||||
conf_capwap_mode = CW_MODE_CIPWAP;
|
||||
}
|
||||
|
||||
if (0 == strcmp(conf_capwap_mode_str, "capwap")) {
|
||||
conf_capwap_mode = CW_MODE_CAPWAP;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int conf_parse_listen_addr(const char *addrstr, char *saddr, char *port, int *proto)
|
||||
{
|
||||
@ -759,7 +690,7 @@ int read_config(const char *filename)
|
||||
cfg_t *cfg;
|
||||
|
||||
conf_mods_dir=cw_strdup("");
|
||||
|
||||
|
||||
if (!init_control_port())
|
||||
return 0;
|
||||
|
||||
@ -800,7 +731,8 @@ int read_config(const char *filename)
|
||||
perror(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!conf_read_mods(cfg)){
|
||||
cfg_free(cfg);
|
||||
return 0;
|
||||
|
@ -32,6 +32,7 @@ void ucfg_cmd(struct shelldata *sd, const char * cmd);
|
||||
void set_cmd(struct shelldata *sd, const char * cmd);
|
||||
void del_cmd(struct shelldata *sd, const char * cmd);
|
||||
void send_cmd(struct shelldata *sd, const char * cmd);
|
||||
void wlan0_cmd(struct shelldata *sd, const char * cmd);
|
||||
void show_cfg (FILE *out, mavl_t ktv);
|
||||
void show_aps (FILE *out);
|
||||
|
||||
@ -50,6 +51,7 @@ static struct command cmdlist[]={
|
||||
{"select", select_cmd },
|
||||
{"send", send_cmd},
|
||||
{"set", set_cmd },
|
||||
{"wlan0",wlan0_cmd},
|
||||
|
||||
|
||||
{NULL,NULL}
|
||||
@ -106,6 +108,25 @@ send_cmd(struct shelldata * sd, const char *cmd)
|
||||
wtplist_unlock();
|
||||
}
|
||||
|
||||
void
|
||||
wlan0_cmd(struct shelldata * sd, const char *cmd)
|
||||
{
|
||||
struct conn * conn;
|
||||
wtplist_lock();
|
||||
conn = find_ap(sd->prompt);
|
||||
if (conn==NULL){
|
||||
fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
|
||||
}
|
||||
else {
|
||||
FILE *f=fopen("wlan0.ktv","r");
|
||||
cw_ktv_read_file(f,sd->update_cfg,conn->msgset->types_tree);
|
||||
//conn->update_cfg=sd->update_cfg;
|
||||
fclose(f);
|
||||
}
|
||||
wtplist_unlock();
|
||||
|
||||
}
|
||||
|
||||
void set_cmd(struct shelldata *sd, const char *str)
|
||||
{
|
||||
struct conn * conn;
|
||||
@ -370,6 +391,7 @@ void shell_loop (FILE *file)
|
||||
{
|
||||
struct shelldata sd;
|
||||
int c;
|
||||
c=0;
|
||||
/* setvbuf(file,NULL,_IONBF,0);
|
||||
fflush(file);
|
||||
*/
|
||||
@ -404,9 +426,11 @@ void * run_shell (void * arg)
|
||||
const char * addr = "127.0.0.1:5000";
|
||||
int sockfd, clientsock;
|
||||
int yes;
|
||||
while(1){
|
||||
|
||||
|
||||
cw_dbg(DBG_INFO,"Staring shelli listening at: %s",addr);
|
||||
|
||||
|
||||
rc = sock_strtoaddr (addr, (struct sockaddr*) &server);
|
||||
|
||||
if (! rc) {
|
||||
@ -435,16 +459,17 @@ while(1){
|
||||
|
||||
|
||||
client_size = sizeof (client);
|
||||
while(1){
|
||||
|
||||
clientsock = accept (sockfd, (struct sockaddr*) &client, &client_size);
|
||||
|
||||
if (clientsock > 0) {
|
||||
sock_addr2str_p (&client, sockstr);
|
||||
cw_dbg (DBG_INFO, "Acceptiong session from %s", sockstr);
|
||||
printf("New shell lopp\n");
|
||||
cw_dbg (DBG_INFO, "Start shell");
|
||||
shell_loop (fdopen (clientsock, "a+"));
|
||||
printf("end shell lopp\n");
|
||||
cw_dbg (DBG_INFO, "Stop shell");
|
||||
close (clientsock);
|
||||
printf("close clsock\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,23 +114,6 @@ static void wtpman_run_discovery(void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
int xprocess_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
uint8_t *msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg);
|
||||
uint32_t type = cw_get_msg_type(msgptr);
|
||||
cw_log(LOG_ERR, "Hey: %d", type);
|
||||
if (type == CAPWAP_MSG_DISCOVERY_REQUEST)
|
||||
conn->capwap_state = CAPWAP_STATE_DISCOVERY;
|
||||
|
||||
|
||||
return process_message(conn, rawmsg, rawlen, from);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
static int wtpman_dtls_setup(void *arg)
|
||||
{
|
||||
char cipherstr[512];
|
||||
@ -386,62 +369,6 @@ static void * wtpman_main(void *arg)
|
||||
return NULL;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
switch (conn->capwap_transition){
|
||||
case CW_TRANSITION(CAPWAP_STATE_DTLS_SETUP, CAPWAP_STATE_JOIN):
|
||||
{
|
||||
|
||||
wait_join = cw_ktv_get_word(conn->global_cfg,"wait-join",CAPWAP_WAIT_JOIN);
|
||||
timer = cw_timer_start(wait_join);
|
||||
break;
|
||||
}
|
||||
case CW_TRANSITION(CAPWAP_STATE_JOIN, CAPWAP_STATE_JOIN):
|
||||
{
|
||||
char wtpname[CAPWAP_MAX_WTP_NAME_LEN];
|
||||
cw_KTV_t * result;
|
||||
result = cw_ktv_get(conn->remote_cfg,"wtp-name",NULL);
|
||||
result->type->to_str(result,wtpname,CAPWAP_MAX_WTP_NAME_LEN);
|
||||
cw_dbg(DBG_INFO, "WTP joined: '%s', IP %s.",
|
||||
wtpname,
|
||||
sock_addr2str(&conn->addr,sock_buf)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case CW_TRANSITION(CAPWAP_STATE_JOIN,CAPWAP_STATE_TIMEOUT):
|
||||
{
|
||||
cw_dbg(DBG_MSG_ERR, "No join request from %s after %d seconds, WTP died.",
|
||||
sock_addr2str(&wtpman->conn->addr,sock_buf), wait_join);
|
||||
wtpman_remove(wtpman);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
case CW_TRANSITION(CAPWAP_STATE_JOIN, CAPWAP_STATE_CONFIGURE):
|
||||
{
|
||||
|
||||
wait_change_state = cw_ktv_get_word(conn->global_cfg,
|
||||
"capwap-timers/change-state-pending-timer",
|
||||
CAPWAP_TIMER_CHANGE_STATE_PENDING_TIMER);
|
||||
break;
|
||||
}
|
||||
case CW_TRANSITION(CAPWAP_STATE_CONFIGURE,CAPWAP_STATE_TIMEOUT):
|
||||
{
|
||||
cw_dbg(DBG_MSG_ERR, "No Change State Event Request %s after %d seconds, WTP died.",
|
||||
sock_addr2str(&wtpman->conn->addr,sock_buf), wait_change_state);
|
||||
wtpman_remove(wtpman);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
while (!cw_timer_timeout(timer)) {
|
||||
if (conn->update_cfg != NULL){
|
||||
@ -451,7 +378,7 @@ static void * wtpman_main(void *arg)
|
||||
tmp = conn->local_cfg;
|
||||
|
||||
mavl_merge(conn->default_cfg, conn->local_cfg);
|
||||
mavl_merge(conn->default_cfg, conn->remote_cfg);
|
||||
/* mavl_merge(conn->default_cfg, conn->remote_cfg);*/
|
||||
|
||||
conn->local_cfg=conn->update_cfg;
|
||||
|
||||
@ -462,6 +389,8 @@ static void * wtpman_main(void *arg)
|
||||
cw_dbg(DBG_INFO, "Updating WTP %s",sock_addr2str(&conn->addr,sock_buf));
|
||||
|
||||
rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST);
|
||||
mavl_merge(conn->remote_cfg,conn->update_cfg);
|
||||
|
||||
conn->update_cfg=NULL;
|
||||
conn->local_cfg=tmp;
|
||||
}
|
||||
@ -578,7 +507,7 @@ cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"-------------dump------------","DMP",
|
||||
}
|
||||
|
||||
/*// cw_dbg(DBG_X, "Time left: %d",
|
||||
//*/
|
||||
// */
|
||||
/*cw_timer_timeleft(wtpman->echointerval_timer);*/
|
||||
|
||||
if (cw_timer_timeout(wtpman->echointerval_timer)) {
|
||||
|
@ -3,7 +3,6 @@ MFDEPS=../Defs.mak ../LocalDefs.mak
|
||||
|
||||
|
||||
CWSRC=\
|
||||
cw_write_header.c\
|
||||
cw_check_missing_mand.c\
|
||||
cw_clock_lap.c\
|
||||
cw_dbg_elem.c\
|
||||
@ -106,6 +105,8 @@ KTVSRC=\
|
||||
cw_ktv_base_exists.c\
|
||||
cw_ktv_save.c\
|
||||
cw_ktv_del_sub.c\
|
||||
cfg.c\
|
||||
|
||||
|
||||
|
||||
LWSRC=\
|
||||
@ -231,7 +232,7 @@ DTLSSRC += dtls_openssl.c \
|
||||
dtls_openssl_connect.c \
|
||||
dtls_openssl_get_cipher.c \
|
||||
dtls_openssl_bio.c
|
||||
LIBS+=-lssl
|
||||
LIBS=
|
||||
|
||||
#DTLSSRC+= dtls_gnutls.c \
|
||||
# dtls_gnutls_accept.c \
|
||||
@ -263,6 +264,5 @@ all: $(SNAME) $(DNAME)
|
||||
static: $(SNAME)
|
||||
dynamic: $(DNAME)
|
||||
|
||||
|
||||
include ../lib.mk
|
||||
|
||||
|
355
src/cw/cfg.c
Normal file
355
src/cw/cfg.c
Normal file
@ -0,0 +1,355 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <mavl.h>
|
||||
|
||||
#include "cw.h"
|
||||
#include "cfg.h"
|
||||
|
||||
struct cfg_entry{
|
||||
char *key;
|
||||
char *val;
|
||||
};
|
||||
|
||||
static int cmp(const void *k1,const void*k2){
|
||||
struct cfg_entry * e1,*e2;
|
||||
e1=(struct cfg_entry *)k1;
|
||||
e2=(struct cfg_entry *)k2;
|
||||
return strcmp(e1->key,e2->key);
|
||||
}
|
||||
|
||||
static void del(void *ptr)
|
||||
{
|
||||
struct cfg_entry * e;
|
||||
e=(struct cfg_entry *)ptr;
|
||||
free(e->key);
|
||||
free(e->val);
|
||||
}
|
||||
|
||||
|
||||
cw_Cfg_t * cw_cfg_create()
|
||||
{
|
||||
return mavl_create(cmp, del, sizeof(struct cfg_entry));
|
||||
}
|
||||
|
||||
int cw_cfg_set(cw_Cfg_t * cfg,const char *key, const char *val)
|
||||
{
|
||||
struct cfg_entry e;
|
||||
int replaced;
|
||||
|
||||
e.key = cw_strdup(key);
|
||||
if (!e.key)
|
||||
return 0;
|
||||
e.val = cw_strdup(val);
|
||||
if (!e.val){
|
||||
free(e.key);
|
||||
return 0;
|
||||
}
|
||||
void * rc = mavl_replace(cfg,&e,&replaced);
|
||||
if (!rc){
|
||||
del(&e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!replaced)
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void cw_cfg_dump(cw_Cfg_t *cfg)
|
||||
{
|
||||
mavliter_t it;
|
||||
struct cfg_entry *e;
|
||||
mavliter_init(&it,cfg);
|
||||
mavliter_foreach(&it){
|
||||
|
||||
e = mavliter_get(&it);
|
||||
printf("%s: '%s'\n",e->key,e->val);
|
||||
//cw_dbg(dbglevel,"%s%s :%s: %s",prefix,data->key,type->get_type_name(data), value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct parser {
|
||||
int line;
|
||||
int pos;
|
||||
int prevpos;
|
||||
char error[256];
|
||||
int quote;
|
||||
FILE *f;
|
||||
int (*getc)(struct parser *);
|
||||
void (*ungetc)(struct parser *);
|
||||
};
|
||||
|
||||
static int get_char(struct parser *p)
|
||||
{
|
||||
int c;
|
||||
c = fgetc (p->f);
|
||||
p->pos++;
|
||||
if (c=='\n'){
|
||||
p->prevpos=p->pos;
|
||||
p->line ++;
|
||||
p->pos=0;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
static void unget_char(struct parser *p,int c){
|
||||
ungetc(c,p->f);
|
||||
if (c=='\n'){
|
||||
p->line--;
|
||||
p->pos=p->prevpos;
|
||||
}
|
||||
else
|
||||
p->pos--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int get_char_q(struct parser *p)
|
||||
{
|
||||
int c;
|
||||
|
||||
while(1) {
|
||||
c = get_char(p);
|
||||
if (c==EOF || c=='\n')
|
||||
return c;
|
||||
|
||||
if(c=='"' && !p->quote){
|
||||
p->quote=1;
|
||||
continue;
|
||||
}
|
||||
if(c=='"' && p->quote){
|
||||
p->quote=0;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!p->quote)
|
||||
return c;
|
||||
|
||||
if (c!='\\')
|
||||
return c;
|
||||
|
||||
c = get_char(p);
|
||||
switch(c){
|
||||
case EOF:
|
||||
return c;
|
||||
case 'n':
|
||||
return '\n';
|
||||
|
||||
case '\\':
|
||||
return '\\';
|
||||
case '"':
|
||||
return '"';
|
||||
default:
|
||||
unget_char(p,c);
|
||||
return '\\';
|
||||
}
|
||||
|
||||
/* We will never reach here */
|
||||
/* return c;*/
|
||||
}
|
||||
|
||||
static int skip_chars (struct parser *p, const char * chars)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ( (c = get_char (p)) != EOF) {
|
||||
if (strchr (chars, c))
|
||||
continue;
|
||||
return c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
static int skip_to_chars (struct parser *p, const char *chars)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ( (c = get_char (p)) != EOF) {
|
||||
if (strchr (chars, c))
|
||||
return c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int read_key (struct parser *p, char *key, int max_len)
|
||||
{
|
||||
int c,n;
|
||||
|
||||
do {
|
||||
c = skip_chars (p, " \t\n\a\v");
|
||||
if (c == '#') {
|
||||
c = skip_to_chars (p, "\n\a");
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (c != EOF);
|
||||
|
||||
unget_char(p,c);
|
||||
c=get_char_q(p);
|
||||
|
||||
n=0;
|
||||
while(c!=EOF && n<max_len){
|
||||
if (!p->quote && !isalnum(c) && !strchr("._/-()@#|{}[]\\",c)/*strchr(": \t\n\a",c)*/){
|
||||
unget_char(p,c);
|
||||
break;
|
||||
}
|
||||
|
||||
key[n]=c;
|
||||
|
||||
c=get_char_q(p);
|
||||
n++;
|
||||
|
||||
}
|
||||
key[n]=0;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
static int skip_to_colon(FILE *f,struct parser * p)
|
||||
{
|
||||
int c;
|
||||
c = skip_chars (p, " \t");
|
||||
if (c!=':'){
|
||||
if (c=='\n'){
|
||||
unget_char(p,c);
|
||||
sprintf(p->error,"Error at line %d, pos %d: Unexpected EOL, collon expected.", p->line, p->pos);
|
||||
return 0;
|
||||
}
|
||||
sprintf(p->error,"Error at line %d, pos %d: Collon expected.", p->line, p->pos);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int read_val(struct parser *p, char *val, int max_len){
|
||||
int c,n,quote;
|
||||
if (!skip_to_colon(p->f,p))
|
||||
return -1;
|
||||
c = skip_chars (p, " \t");
|
||||
if (c=='"'){
|
||||
quote=1;
|
||||
c=get_char(p);
|
||||
}
|
||||
else{
|
||||
quote=0;
|
||||
}
|
||||
n=0;
|
||||
while(c!=EOF && n<max_len){
|
||||
if (quote && c=='"'){
|
||||
break;
|
||||
}
|
||||
if (c=='\n'){
|
||||
break;
|
||||
}
|
||||
if (quote){
|
||||
if (c=='\\'){
|
||||
c = get_char(p);
|
||||
switch(c){
|
||||
case 'n':
|
||||
c='\n';
|
||||
break;
|
||||
case '\\':
|
||||
break;
|
||||
case '"':
|
||||
break;
|
||||
default:
|
||||
unget_char(p,c);
|
||||
c='\\';
|
||||
}
|
||||
}
|
||||
}
|
||||
val[n++]=c;
|
||||
c=get_char(p);
|
||||
}
|
||||
|
||||
|
||||
if(!quote && n>0){
|
||||
while(n>0){
|
||||
if (isspace(val[n-1]))
|
||||
n--;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
val[n]=0;
|
||||
|
||||
return n;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int cw_cfg_read_line (FILE *f, struct parser *p, char * key, char *val)
|
||||
{
|
||||
int n;
|
||||
|
||||
|
||||
n = read_key (p,key,CW_CFG_MAX_KEY_LEN);
|
||||
if (n==0)
|
||||
return 1;
|
||||
if (n==-1){
|
||||
return -1;
|
||||
}
|
||||
|
||||
n = read_val (p,val,CW_CFG_MAX_KEY_LEN);
|
||||
if (n==-1){
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cw_cfg_read_from_file(FILE * f, cw_Cfg_t * cfg)
|
||||
{
|
||||
char key[CW_CFG_MAX_KEY_LEN];
|
||||
char val[2048];
|
||||
struct parser p;
|
||||
|
||||
p.line=1;
|
||||
p.pos=0;
|
||||
p.prevpos=0;
|
||||
p.quote=0;
|
||||
p.f=f;
|
||||
|
||||
int rc;
|
||||
|
||||
|
||||
do {
|
||||
|
||||
rc = cw_cfg_read_line(f,&p,key,val);
|
||||
if (rc==-1){
|
||||
fprintf(stderr,"Error: %s",p.error);
|
||||
}
|
||||
|
||||
|
||||
if (rc != 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
cw_cfg_set(cfg,key,val);
|
||||
|
||||
|
||||
}while(rc==0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int cw_cfg_load(const char *filename,cw_Cfg_t * cfg)
|
||||
{
|
||||
FILE *f = fopen(filename,"rb");
|
||||
if (!f)
|
||||
return errno;
|
||||
cw_cfg_read_from_file(f,cfg);
|
||||
return 0;
|
||||
}
|
18
src/cw/cfg.h
Normal file
18
src/cw/cfg.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef _CFG_H
|
||||
#define _CFG_H
|
||||
|
||||
#include <mavl.h>
|
||||
|
||||
#define CW_CFG_MAX_KEY_LEN 1024
|
||||
|
||||
typedef struct mavl cw_Cfg_t;
|
||||
|
||||
cw_Cfg_t * cw_cfg_create();
|
||||
int cw_cfg_set(cw_Cfg_t *cfg,const char *key, const char *val);
|
||||
void cw_cfg_dump(cw_Cfg_t *cfg);
|
||||
int cw_cfg_read_from_file(FILE * file, cw_Cfg_t * cfg);
|
||||
int cw_cfg_load(const char *filename,cw_Cfg_t * cfg);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -90,7 +90,7 @@ struct conn * conn_create(int sock, struct sockaddr * addr, int qsize)
|
||||
/* conn->send_data_packet = conn_send_data_packet;*/
|
||||
|
||||
conn->last_seqnum_received=-1;
|
||||
conn->mtu=500;
|
||||
conn->mtu=600;
|
||||
|
||||
|
||||
conn->cur_packet=0;
|
||||
@ -102,7 +102,7 @@ struct conn * conn_create(int sock, struct sockaddr * addr, int qsize)
|
||||
|
||||
/* conn->write_data = conn->send_data_packet; */
|
||||
|
||||
conn->dtls_mtu = 500;
|
||||
conn->dtls_mtu = 600;
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
@ -515,6 +515,7 @@ int process_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
||||
if ((sd > 0 && sd < 128) || (sd < 0 && sd < -128) || s1 < 0) {
|
||||
/* seqnum is ok, normal message processing */
|
||||
conn->last_seqnum_received = seqnum;
|
||||
|
||||
return process_elements(conn, rawmsg, rawlen, from);
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,8 @@ int cw_decode_element(struct cw_ElemHandlerParams *params, int proto,
|
||||
handler->name);
|
||||
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
|
||||
}
|
||||
|
||||
printf ("USING HANDLERi TO DECODE: %d %s\n",handler->id,handler->name);
|
||||
rc = handler->get(handler, params, data, len);
|
||||
|
||||
|
||||
|
@ -18,6 +18,8 @@ int cw_in_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerP
|
||||
key = handler->key;
|
||||
}
|
||||
|
||||
printf("CW_IN_GENERIC STRUCT: %s\n",key);
|
||||
|
||||
/* int (*mkkey)(struct cw_ElemHandler * handler, char *dst, struct cw_ElemHandlerParams * params,
|
||||
uint8_t*data, int len);
|
||||
*/
|
||||
|
@ -8,9 +8,6 @@ int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
|
||||
int pos, i,l;
|
||||
cw_KTV_t * result;
|
||||
|
||||
if (strcmp(pkey,"radio.0/cisco/wtp-radio-config")==0)
|
||||
i = 99;
|
||||
|
||||
|
||||
pos=0; i=0;
|
||||
while (stru[i].type != NULL){
|
||||
@ -47,6 +44,7 @@ int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
|
||||
|
||||
stru[i].type->to_str(result,dbstr,100);
|
||||
cw_dbg(DBG_ELEM_DETAIL, "Read (%d): %s: %s",pos,key,dbstr);
|
||||
printf("READ STRUCT (%d): %s: %s\n",pos,key,dbstr);
|
||||
|
||||
if (stru[i].len==-1)
|
||||
l = result->type->len(result);
|
||||
|
@ -24,9 +24,15 @@ int cw_ktv_write_struct(mavl_t ktv, mavl_t def, const cw_KTVStruct_t * stru, con
|
||||
else
|
||||
sprintf(key,"%s",pkey);
|
||||
|
||||
|
||||
printf("Get Key: %s\n",key);
|
||||
result = cw_ktv_get(ktv,key,NULL);
|
||||
|
||||
|
||||
if(result)
|
||||
{
|
||||
char s[129];
|
||||
result->type->to_str(result,s,128);
|
||||
printf("Content: '%s'\n",s);
|
||||
}
|
||||
|
||||
if (result == NULL && def != NULL){
|
||||
result = cw_ktv_get(def,key,NULL);
|
||||
|
@ -12,7 +12,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
||||
, uint8_t * dst)
|
||||
{
|
||||
|
||||
struct cw_KTV * elem, search;
|
||||
struct cw_KTV * elem;
|
||||
int start, len, l;
|
||||
|
||||
/* Get the element */
|
||||
@ -49,7 +49,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
||||
/* Size for msg elem header depends on
|
||||
vendor specific payload */
|
||||
/* start = handler->vendor ? 10 : 4; */
|
||||
start = cw_header_len(handler);
|
||||
start = params->msgset->header_len(handler);
|
||||
|
||||
if (cw_ktv_cast(elem,handler->type)==NULL){
|
||||
cw_log(LOG_ERR,"Can't put element '%s'- can't cast from %s to %s for key: %s", handler->name,
|
||||
@ -67,7 +67,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||
|
||||
l = len + cw_put_elem_hdr(dst, handler->id, len); */
|
||||
l = cw_write_header(handler,dst,len);
|
||||
l = params->msgset->write_header(handler,dst,len);
|
||||
|
||||
cw_dbg_elem(DBG_ELEM_OUT,NULL,params->msgdata->type,handler,dst,l);
|
||||
/* cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,handler,dst,l);*/
|
||||
|
@ -10,7 +10,6 @@ int cw_out_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemH
|
||||
uint8_t * ob;
|
||||
const cw_KTVIndexed_t *ie;
|
||||
cw_KTVEnum_t * e;
|
||||
struct cw_ElemHandler thandler;
|
||||
|
||||
ie = handler->type;
|
||||
|
||||
@ -22,10 +21,13 @@ int cw_out_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemH
|
||||
|
||||
for(i=0; e[i].name!=NULL; i++) {
|
||||
sprintf(key,"%s/%s",handler->key,e[i].name);
|
||||
|
||||
//printf("Her is the Key: %s - %s\n",key, );
|
||||
|
||||
result = cw_ktv_base_exists(params->local_cfg,key);
|
||||
if (result==NULL)
|
||||
continue;
|
||||
start = cw_header_len(handler);
|
||||
start = params->msgset->header_len(handler);
|
||||
len = 0;
|
||||
if (ie->idxpos==0)
|
||||
len = 1;
|
||||
@ -36,17 +38,11 @@ int cw_out_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemH
|
||||
len += cw_ktv_write_struct(params->local_cfg,
|
||||
NULL,e[i].type,key,ob+start+len);
|
||||
|
||||
/* thandler.type=e[i].type;
|
||||
thandler.key=key;
|
||||
len += e->fun_out(&thandler,params,ob+start+len);
|
||||
*/
|
||||
cw_set_byte(ob+start+ie->idxpos,e[i].value);
|
||||
if (ie->idxpos==len)
|
||||
len++;
|
||||
|
||||
ob += cw_write_header(handler,ob,len);
|
||||
|
||||
|
||||
ob += params->msgset->write_header(handler,ob,len);
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,12 @@ int cw_out_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandler
|
||||
return 0;
|
||||
}
|
||||
|
||||
start = cw_header_len(handler);
|
||||
start = params->msgset->header_len(handler);
|
||||
|
||||
len = cw_ktv_write_struct(params->local_cfg,
|
||||
params->default_cfg,
|
||||
handler->type,handler->key,dst+start);
|
||||
|
||||
return cw_write_header(handler,dst,len);
|
||||
return params->msgset->write_header(handler,dst,len);
|
||||
|
||||
}
|
||||
|
@ -24,12 +24,12 @@ int cw_out_generic_with_index(struct cw_ElemHandler * eh,
|
||||
if (strncmp(result->key,key,strlen(key))!=0)
|
||||
break;
|
||||
|
||||
start = cw_header_len(eh);
|
||||
start = params->msgset->header_len(eh);
|
||||
len = cw_put_byte(ob+start,idx);
|
||||
|
||||
len += result->type->put(result,ob+start+len);
|
||||
|
||||
ob += cw_write_header(eh,ob,len);
|
||||
ob += params->msgset->write_header(eh,ob,len);
|
||||
|
||||
idx++;
|
||||
|
||||
|
@ -37,15 +37,13 @@ int cw_out_idx_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHan
|
||||
|
||||
sprintf(key,handler->key,idx);
|
||||
|
||||
printf("Here we are '%s'! --> %d\n",key,idx);
|
||||
|
||||
len =0;
|
||||
start = mdst + cw_header_len(handler);
|
||||
start = mdst + params->msgset->header_len(handler);
|
||||
|
||||
len += cw_put_byte(start+len,idx);
|
||||
len += cw_ktv_write_struct(params->local_cfg,NULL, handler->type,key,start+len);
|
||||
|
||||
mdst += cw_write_header(handler,mdst,len);
|
||||
mdst += params->msgset->write_header(handler,mdst,len);
|
||||
|
||||
|
||||
i=idx+1;
|
||||
|
@ -14,7 +14,7 @@ int cw_out_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemH
|
||||
cdst = dst;
|
||||
|
||||
|
||||
offset = cw_header_len(handler);
|
||||
offset = params->msgset->header_len(handler);
|
||||
|
||||
i=-1;
|
||||
while(1){
|
||||
@ -37,7 +37,7 @@ int cw_out_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemH
|
||||
l+= cw_ktv_write_struct(params->local_cfg,NULL, handler->type,basekey,cdst+offset+l);
|
||||
|
||||
|
||||
cdst+=cw_write_header(handler,cdst,l);
|
||||
cdst+=params->msgset->write_header(handler,cdst,l);
|
||||
}
|
||||
return cdst-dst;
|
||||
}
|
||||
@ -52,16 +52,18 @@ int cw_out_traverse0(struct cw_ElemHandler * handler, struct cw_ElemHandlerParam
|
||||
char key[CW_KTV_MAX_KEY_LEN];
|
||||
int len;
|
||||
len = 0;
|
||||
|
||||
|
||||
printf("Next: %s\n", next);
|
||||
|
||||
sl = strchr(next,'/');
|
||||
if (sl==NULL){
|
||||
cw_KTV_t * result;
|
||||
cw_KTV_t * result;
|
||||
sprintf(key,"%s/%s",current,next);
|
||||
result = cw_ktv_base_exists(params->local_cfg,key);
|
||||
if (result != NULL){
|
||||
int offset;
|
||||
int i,l;
|
||||
offset = cw_header_len(handler);
|
||||
offset = params->msgset->header_len(handler);
|
||||
printf("Yea! We can do it: %s\n",result->key);
|
||||
for (i=0;i<stack[0];i++){
|
||||
printf("I=%i\n",stack[i+1]);
|
||||
@ -71,7 +73,7 @@ int cw_out_traverse0(struct cw_ElemHandler * handler, struct cw_ElemHandlerParam
|
||||
|
||||
printf("Write struct len %i\n",l);
|
||||
|
||||
l=cw_write_header(handler,dst,l);
|
||||
l=params->msgset->write_header(handler,dst,l);
|
||||
printf("header wr len %d\n",l);
|
||||
if (handler->patch){
|
||||
handler->patch(dst+offset,stack);
|
||||
@ -84,6 +86,9 @@ int cw_out_traverse0(struct cw_ElemHandler * handler, struct cw_ElemHandlerParam
|
||||
}
|
||||
|
||||
strcpy(key,current);
|
||||
|
||||
printf("current is %s\n", current);
|
||||
|
||||
if (key[0!=0])
|
||||
strcat(key,"/");
|
||||
l = sl - next;
|
||||
@ -98,6 +103,7 @@ int cw_out_traverse0(struct cw_ElemHandler * handler, struct cw_ElemHandlerParam
|
||||
cw_KTV_t * result;
|
||||
|
||||
i = cw_ktv_idx_get_next(params->local_cfg,key,i+1);
|
||||
|
||||
if (i==-1)
|
||||
break;
|
||||
sprintf(basekey,"%s.%d",key,i);
|
||||
@ -127,6 +133,8 @@ int cw_out_traverse(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
||||
stack[0]=0;
|
||||
|
||||
current[0]=0;
|
||||
|
||||
|
||||
|
||||
return cw_out_traverse0(handler,params,dst,-1,current,handler->key, stack);
|
||||
}
|
||||
|
@ -154,6 +154,7 @@ printf("Elem: %d %d %d %s\n", data->proto, data->vendor, data->id, handler->name
|
||||
|
||||
cw_decode_elements( ¶ms, elems_ptr,elems_len);
|
||||
|
||||
printf ("----------------------------------- end redecode -----------------------------\n");
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@ int cw_write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int cw_header_len(struct cw_ElemHandler * handler)
|
||||
{
|
||||
return handler->vendor ? 10 : 4;
|
||||
|
@ -5,7 +5,7 @@ struct mlistelem * mlist_get(mlist_t list, const void *data){
|
||||
mlist_foreach(elem,list){
|
||||
void *tdata = mlistelem_dataptr(elem);
|
||||
if (list->cmp(tdata,data)==0){
|
||||
return tdata;
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -105,7 +105,7 @@ struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
||||
struct cw_MsgSet *set;
|
||||
|
||||
if (!msgset_cache) {
|
||||
msgset_cache = mavl_create(cmp, NULL, 1312);
|
||||
msgset_cache = mavl_create(cmp, NULL, sizeof(struct cache_item*));
|
||||
if (!msgset_cache) {
|
||||
cw_log(LOG_ERR, "Can't initialize msgset cache: %s",
|
||||
strerror(errno));
|
||||
@ -213,7 +213,7 @@ struct cw_Mod *cw_mod_load(const char *mod_name, mavl_t global_cfg, int role)
|
||||
|
||||
/* if modlist is not initialized, initialize ... */
|
||||
if (mods_loaded == NULL) {
|
||||
mods_loaded = mavl_create(mod_cmp_mavl, NULL, 1312);
|
||||
mods_loaded = mavl_create(mod_cmp_mavl, NULL, sizeof(struct cw_Mod*));
|
||||
if (mods_loaded == NULL) {
|
||||
cw_log(LOG_ERROR, "Can't init modlist, no memory");
|
||||
return NULL;
|
||||
@ -272,8 +272,10 @@ struct cw_Mod *cw_mod_load(const char *mod_name, mavl_t global_cfg, int role)
|
||||
cw_log(LOG_ERR, "Can' add module %s", mod_name);
|
||||
goto errX;
|
||||
}
|
||||
|
||||
cw_dbg(DBG_MOD, "MOD: %s sucessfull loaded, calling init now.", filename);
|
||||
mod->init(mod, global_cfg, role);
|
||||
|
||||
errX:
|
||||
free(filename);
|
||||
return mod;
|
||||
|
@ -114,6 +114,7 @@ void cw_msgset_destroy(struct cw_MsgSet *set)
|
||||
*/
|
||||
struct cw_MsgSet *cw_msgset_create()
|
||||
{
|
||||
const cw_Type_t **ti;
|
||||
|
||||
/* allocate memory for a message_set */
|
||||
struct cw_MsgSet *set = malloc(sizeof(struct cw_MsgSet));
|
||||
@ -149,13 +150,15 @@ struct cw_MsgSet *cw_msgset_create()
|
||||
}
|
||||
|
||||
set->types_tree = cw_ktv_create_types_tree();
|
||||
|
||||
printf("TYPES TREE %p\n",set->types_tree);
|
||||
|
||||
if (set->types_tree == NULL){
|
||||
cw_msgset_destroy(set);
|
||||
return NULL;
|
||||
}
|
||||
/* insert default types */
|
||||
for (ti=CW_KTV_STD_TYPES;*ti;ti++){
|
||||
mavl_insert_ptr(set->types_tree,*ti);
|
||||
}
|
||||
|
||||
|
||||
set->state_machine = mavl_create(cmp_machinestate,NULL,sizeof(cw_StateMachineState_t));
|
||||
if (set->state_machine == NULL)
|
||||
@ -336,10 +339,6 @@ int cw_msgset_add(struct cw_MsgSet *set,
|
||||
{
|
||||
mavliter_t it;
|
||||
cw_dbg(DBG_MOD," Known types:");
|
||||
|
||||
printf("TYPES TREE ITER %p\n",set->types_tree);
|
||||
|
||||
|
||||
mavliter_init(&it,set->types_tree);
|
||||
mavliter_foreach(&it){
|
||||
struct cw_Type * t = mavliter_get_ptr(&it);
|
||||
|
@ -7,13 +7,6 @@
|
||||
|
||||
#include "ktv.h"
|
||||
|
||||
struct cw_MsgSet {
|
||||
mavl_t msgdata;
|
||||
mavl_t handlers_by_id;
|
||||
mavl_t handlers_by_key;
|
||||
mavl_t types_tree;
|
||||
mavl_t state_machine;
|
||||
};
|
||||
|
||||
struct cw_ElemDef{
|
||||
int proto;
|
||||
@ -68,6 +61,19 @@ struct cw_ElemHandler {
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct cw_MsgSet {
|
||||
mavl_t msgdata;
|
||||
mavl_t handlers_by_id;
|
||||
mavl_t handlers_by_key;
|
||||
mavl_t types_tree;
|
||||
mavl_t state_machine;
|
||||
int (*write_header)(struct cw_ElemHandler * handler, uint8_t * dst, int len);
|
||||
int (*header_len)(struct cw_ElemHandler *handler);
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct cw_State{
|
||||
uint8_t state;
|
||||
uint8_t next;
|
||||
|
@ -826,6 +826,19 @@ static cw_StateMachineState_t statemachine_states[]={
|
||||
{0,0,0}
|
||||
};
|
||||
|
||||
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||
{
|
||||
if (handler->vendor)
|
||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||
|
||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||
}
|
||||
|
||||
static int header_len(struct cw_ElemHandler * handler)
|
||||
{
|
||||
return handler->vendor ? 10 : 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
||||
@ -838,10 +851,8 @@ struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
||||
|
||||
cw_msgset_add_states(set,statemachine_states);
|
||||
|
||||
mavl_insert_ptr(set->types_tree,CW_TYPE_BSTR16);
|
||||
mavl_insert_ptr(set->types_tree,CW_TYPE_BYTE);
|
||||
mavl_insert_ptr(set->types_tree,CW_TYPE_DWORD);
|
||||
mavl_insert_ptr(set->types_tree,CW_TYPE_WORD);
|
||||
set->write_header = write_header;
|
||||
set->header_len = header_len;
|
||||
|
||||
cw_dbg(DBG_INFO,"CAPWAP: Done register messages");
|
||||
return set;
|
||||
|
@ -297,9 +297,9 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
|
||||
}
|
||||
}
|
||||
|
||||
start = cw_header_len(eh);
|
||||
start = params->msgset->header_len(eh);
|
||||
len = cw_ktv_write_struct(params->local_cfg,NULL,type,key,ob+start);
|
||||
ob += cw_write_header(eh,ob,len);
|
||||
ob += params->msgset->write_header(eh,ob,len);
|
||||
|
||||
idx++;
|
||||
|
||||
@ -513,18 +513,17 @@ static cw_KTVStruct_t cisco_add_wlan70[]={
|
||||
{CW_TYPE_BOOL,"wep-encryption",1,42},
|
||||
|
||||
{CW_TYPE_BYTE,"qos",1,324},
|
||||
{CW_TYPE_WORD,"scan-defer-period",1,328},
|
||||
{CW_TYPE_WORD,"scan-defer-time",1,330},
|
||||
{CW_TYPE_BOOL,"broadcast-ssid",1,332},
|
||||
{CW_TYPE_BOOL,"aironet-ie",1,333},
|
||||
{CW_TYPE_BYTE,"hreap-local-switch",1,378},
|
||||
{CW_TYPE_WORD,"session-timout",2,381},
|
||||
|
||||
{CW_TYPE_BYTE, "dtim-period",1,440},
|
||||
{CW_TYPE_STR,"profile-name",30,441},
|
||||
{CW_TYPE_STR, "ssid",-1,480},
|
||||
{CW_TYPE_STR, "ssid",33,474},
|
||||
|
||||
/* {CW_TYPE_BYTE, "dtim-period",1,541},
|
||||
{CW_TYPE_STR, "ssid-a",30,545},
|
||||
{CW_TYPE_BYTE, "allow-aaa-override",1,578},
|
||||
{CW_TYPE_BYTE, "max-stations",1,580},*/
|
||||
|
||||
{NULL,NULL,0,0}
|
||||
};
|
||||
@ -561,6 +560,25 @@ static int cisoc_add_wlan_mkkey(const char *pkey, uint8_t*data, int len, char *d
|
||||
}
|
||||
|
||||
|
||||
static int cisoc_add_wlan_mkkey70(const char *pkey, uint8_t*data, int len, char *dst)
|
||||
{
|
||||
int wlan_id,radio_id;
|
||||
|
||||
radio_id = cw_get_byte(data);
|
||||
wlan_id = cw_get_byte(data+4);
|
||||
sprintf(dst,"radio.%d/wlan.%d/add-wlan",radio_id,wlan_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cisco_patch_add_wlan70(uint8_t * data, void * st)
|
||||
{
|
||||
int * stack = st;
|
||||
cw_set_byte(data,stack[1]);
|
||||
cw_set_byte(data+3, stack[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static cw_KTVStruct_t cisco_add_lwwlan[]={
|
||||
{CW_TYPE_BSTR16, "misc", 8, 2},
|
||||
@ -1427,10 +1445,11 @@ static struct cw_ElemHandler handlers70[] = {
|
||||
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||
7,1117, /* min/max length */
|
||||
cisco_add_wlan70, /* type */
|
||||
"radio/wlan", /* Key */
|
||||
"radio/wlan/add-wlan", /* Key */
|
||||
cw_in_generic_struct, /* get */
|
||||
cw_out_generic_struct, /* put */
|
||||
cisoc_add_wlan_mkkey
|
||||
cw_out_traverse, /* put */
|
||||
cisoc_add_wlan_mkkey70,
|
||||
cisco_patch_add_wlan70
|
||||
}
|
||||
,
|
||||
|
||||
@ -1819,7 +1838,7 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
|
||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_9, 0, 0},
|
||||
|
||||
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_ADD_WLAN, 0, CW_IGNORE},
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_ADD_WLAN, 0, 0},
|
||||
|
||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_MCAST_MGID_INFO, 0, 0},
|
||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 0, 0},
|
||||
@ -1869,8 +1888,11 @@ static struct cw_ElemDef change_state_event_request_elements[] ={
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_ADD_WLAN, 1, CW_IGNORE},
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_OPER_STATE_DETAIL_CAUSE, 1, CW_IGNORE},
|
||||
|
||||
{0, 0, CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1, 0},
|
||||
|
||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_HARDWARE_INFO, 1, 0},
|
||||
|
||||
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
|
@ -26,6 +26,31 @@ static struct cw_Mod * capwap_mod = NULL;
|
||||
static struct cw_Mod * capwap80211_mod = NULL;
|
||||
|
||||
|
||||
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||
{
|
||||
if (handler->proto == 0){
|
||||
if (handler->vendor)
|
||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||
|
||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||
}
|
||||
/* put the lwap elem header */
|
||||
lw_set_dword(dst + 10, handler->vendor);
|
||||
lw_set_word(dst + 14, handler->id);
|
||||
return len + 6 + cw_put_elem_vendor_hdr(dst, handler->vendor,
|
||||
CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
|
||||
|
||||
}
|
||||
|
||||
static int header_len(struct cw_ElemHandler * handler)
|
||||
{
|
||||
if (handler->proto==0)
|
||||
return handler->vendor ? 10 : 4;
|
||||
|
||||
return 16;
|
||||
}
|
||||
|
||||
|
||||
static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
||||
{
|
||||
cw_dbg(DBG_INFO,"CISCO: Register messages");
|
||||
@ -35,6 +60,8 @@ static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
||||
capwap_mod->register_messages(set, CW_MOD_MODE_CAPWAP);
|
||||
capwap80211_mod->register_messages(set, CW_MOD_MODE_BINDINGS);
|
||||
cisco_register_msg_set(set,CW_MOD_MODE_CAPWAP);
|
||||
set->write_header = write_header;
|
||||
set->header_len = header_len;
|
||||
|
||||
|
||||
/* cw_dbg(DBG_MOD,"Cisco: loading cisco message set");*/
|
||||
@ -193,31 +220,6 @@ static struct cw_Mod capwap_ac = {
|
||||
};
|
||||
*/
|
||||
|
||||
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||
{
|
||||
if (handler->proto == 0){
|
||||
if (handler->vendor)
|
||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||
|
||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||
}
|
||||
/* put the lwap elem header */
|
||||
lw_set_dword(dst + 10, handler->vendor);
|
||||
lw_set_word(dst + 14, handler->id);
|
||||
return len + 6 + cw_put_elem_vendor_hdr(dst, handler->vendor,
|
||||
CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
|
||||
|
||||
}
|
||||
|
||||
static int header_len(struct cw_ElemHandler * handler)
|
||||
{
|
||||
if (handler->proto==0)
|
||||
return handler->vendor ? 10 : 4;
|
||||
|
||||
return 16;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int static setup_cfg(struct conn * conn)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ cisco/ap-regulatory-domain.1/slot :Byte: 0
|
||||
cisco/ap-sub-mode :Byte: 0
|
||||
cisco/ap-telnet-ssh/ssh :Bool: false
|
||||
cisco/ap-telnet-ssh/telnet :Bool: false
|
||||
cisco/ap-timesync/timestamp :Dword: 1469722147
|
||||
cisco/ap-timesync/timestamp :Dword: 1469886778
|
||||
cisco/ap-timesync/type :Byte: 0
|
||||
cisco/ap-username-and-password/802.1x-credentials/option :Word: 2
|
||||
cisco/ap-username-and-password/802.1x-credentials/password :Str:
|
||||
@ -85,7 +85,7 @@ cisco/loghost-config/loghost.0 :IPAddress: 7.7.1.3
|
||||
cisco/loghost-config/loghost.1 :IPAddress: 0.0.0.0
|
||||
cisco/loghost-config/loghost.2 :IPAddress: 0.0.0.0
|
||||
cisco/loghost-config/loghost.3 :IPAddress: 0.0.0.0
|
||||
cisco/mcast-mgid-info :Bstr16: .x000000010000000000000000000000000000000101000000
|
||||
cisco/mcast-mgid-info :Bstr16: .x0000000d0000000000000000000000000000000101000000
|
||||
cisco/mwar-addr/address :IPAddress: 192.168.0.162
|
||||
cisco/mwar-addr/mwar-type :Byte: 0
|
||||
cisco/mwar-addr/unknown :Word: 0
|
||||
@ -97,7 +97,7 @@ cisco/rouge-and-mss/roge-detection :Bool: true
|
||||
cisco/rouge-and-mss/tcp-adjust-mss :Word: 0
|
||||
cisco/rouge-detection/rest :Bstr16: .x000aff800000
|
||||
cisco/rouge-detection/rouge-detection :Bool: false
|
||||
cisco/sig-toogle :Bool: false
|
||||
cisco/sig-toogle :Bool: true
|
||||
cisco/spam-domain-secret :Bstr16: .xe1ffd18a8f15b3b59c0a47a7f17a96e7cb36174f00
|
||||
cisco/ssl-certfile :Str: ../../ssl/certs/wtpc.crt
|
||||
cisco/ssl-cipher :Str: RSA:AES-128-CBC:SHA1
|
||||
@ -141,7 +141,7 @@ radio.0/cisco/direct-sequence-control/current-cca-mode :Byte: 0
|
||||
radio.0/cisco/direct-sequence-control/current-channel :Byte: 1
|
||||
radio.0/cisco/direct-sequence-control/energy-detect-threshold :Dword: -50
|
||||
radio.0/cisco/direct-sequence-control/unknown :Byte: 1
|
||||
radio.0/cisco/elem19 :Bstr16: .xc0a800a10001000bc0a800a103000101003ccd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000001060b010101
|
||||
radio.0/cisco/elem19 :Bstr16: .xc0a800a10001000bc0a800a103000101001ecd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000001060b010101
|
||||
radio.0/cisco/elem22 :Bstr16: .x0d00b400320102030405060708090a0b0c0d
|
||||
radio.0/cisco/elem24 :Bstr16: .x003c000c
|
||||
radio.0/cisco/elem81 :Bstr16: .x00000000010101010a001e0a02051cbfffbfff0a00
|
||||
@ -196,7 +196,7 @@ radio.0/wlan.0/add-wlan/scan-defer-time :Word: 100
|
||||
radio.0/wlan.0/add-wlan/session-timout :Word: 1800
|
||||
radio.0/wlan.0/add-wlan/ssid :Str:
|
||||
radio.0/wlan.0/add-wlan/wep-encryption :Bool: false
|
||||
radio.0/wlan.0/add-wlan/wep-key :Bstr16: .x61d4be12e22feb1135d1be6d3f
|
||||
radio.0/wlan.0/add-wlan/wep-key :Bstr16: .x25c544f95684f1f8687a411ca5
|
||||
radio.0/wlan.0/add-wlan/wep-key-index :Byte: 1
|
||||
radio.0/wlan.0/add-wlan/wlan-capability :Word: 1073
|
||||
radio.0/wlan.0/add-wlan/wlan-id :Byte: 1
|
||||
@ -212,6 +212,40 @@ radio.0/wlan.0/ssid-a :Str: Schlosspark
|
||||
radio.0/wlan.0/wep-key :Bstr16: .xaa0c0a02000000000000000000
|
||||
radio.0/wlan.0/wlan-capability :Word: 1057
|
||||
radio.0/wlan.0/wlan-id :Byte: 0
|
||||
radio.0/wlan.1/add-wlan/aironet-ie :Bool: true
|
||||
radio.0/wlan.1/add-wlan/broadcast-ssid :Bool: true
|
||||
radio.0/wlan.1/add-wlan/dtim-period :Byte: 1
|
||||
radio.0/wlan.1/add-wlan/encryption-policy :Dword: 4
|
||||
radio.0/wlan.1/add-wlan/hreap-local-switch :Byte: 0
|
||||
radio.0/wlan.1/add-wlan/profile-name :Str: tubeC
|
||||
radio.0/wlan.1/add-wlan/qos :Byte: 0
|
||||
radio.0/wlan.1/add-wlan/radio-id :Byte: 0
|
||||
radio.0/wlan.1/add-wlan/scan-defer-period :Word: 28784
|
||||
radio.0/wlan.1/add-wlan/scan-defer-time :Word: 100
|
||||
radio.0/wlan.1/add-wlan/session-timout :Word: 1800
|
||||
radio.0/wlan.1/add-wlan/ssid :Str: tubeC
|
||||
radio.0/wlan.1/add-wlan/wep-encryption :Bool: false
|
||||
radio.0/wlan.1/add-wlan/wep-key :Bstr16: .xc3616fee42fcf74fa02bff3d87
|
||||
radio.0/wlan.1/add-wlan/wep-key-index :Byte: 1
|
||||
radio.0/wlan.1/add-wlan/wlan-capability :Word: 1073
|
||||
radio.0/wlan.1/add-wlan/wlan-id :Byte: 1
|
||||
radio.0/wlan.13/add-wlan/aironet-ie :Bool: true
|
||||
radio.0/wlan.13/add-wlan/broadcast-ssid :Bool: true
|
||||
radio.0/wlan.13/add-wlan/dtim-period :Byte: 19
|
||||
radio.0/wlan.13/add-wlan/encryption-policy :Dword: 1
|
||||
radio.0/wlan.13/add-wlan/hreap-local-switch :Byte: 16
|
||||
radio.0/wlan.13/add-wlan/profile-name :Str: SuerWLAN
|
||||
radio.0/wlan.13/add-wlan/qos :Byte: 0
|
||||
radio.0/wlan.13/add-wlan/radio-id :Byte: 0
|
||||
radio.0/wlan.13/add-wlan/scan-defer-period :Word: 15420
|
||||
radio.0/wlan.13/add-wlan/scan-defer-time :Word: 100
|
||||
radio.0/wlan.13/add-wlan/session-timout :Word: 1800
|
||||
radio.0/wlan.13/add-wlan/ssid :Str: SuperSSID
|
||||
radio.0/wlan.13/add-wlan/wep-encryption :Bool: false
|
||||
radio.0/wlan.13/add-wlan/wep-key :Bstr16: .x00000000000000000000000000
|
||||
radio.0/wlan.13/add-wlan/wep-key-index :Byte: 1
|
||||
radio.0/wlan.13/add-wlan/wlan-capability :Word: 1057
|
||||
radio.0/wlan.13/add-wlan/wlan-id :Byte: 13
|
||||
radio.0/wtp-radio-information :Dword: 1
|
||||
radio.1/admin-state :Byte: reserved
|
||||
radio.1/cisco-multi-domain-capability/first-channel :Word: 36
|
||||
@ -229,7 +263,7 @@ radio.1/cisco/antenna-payload/number-of-antennas :Byte: 2
|
||||
radio.1/cisco/antenna-payload/unknown :Byte: 3
|
||||
radio.1/cisco/channel-power :Bstr16: .x0808102408221c16100a04fefe2808221c16100a04fefe2c08221c16100a04fefe3008221c16100a04fefe3408221c16100a04fefe3808221c16100a04fefe3c08221c16100a04fefe4008221c16100a04fefe6408221c16100a04fefe6808221c16100a04fefe6c08221c16100a04fefe7008221c16100a04fefe7408221c16100a04fefe8408221c16100a04fefe8808221c16100a04fefe8c08221c16100a04fefe
|
||||
radio.1/cisco/elem15 :Bstr16: .x027007ffffffce010001
|
||||
radio.1/cisco/elem19 :Bstr16: .xc0a800a10001000ac0a800a110000101003ccd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000024282c3034383c4064686c707484888c01010101010101010101010101010101
|
||||
radio.1/cisco/elem19 :Bstr16: .xc0a800a10001000ac0a800a110000101001ecd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000024282c3034383c4064686c707484888c01010101010101010101010101010101
|
||||
radio.1/cisco/elem22 :Bstr16: .x1000b4003224282c3034383c4064686c707484888c
|
||||
radio.1/cisco/elem24 :Bstr16: .x003c000c
|
||||
radio.1/cisco/elem47 :Bstr16: .x01ccb0000c000f42401999ba1040000003
|
||||
@ -248,7 +282,7 @@ radio.1/cisco/multi-domain-capability/max-tx-power-level :Word: 20
|
||||
radio.1/cisco/multi-domain-capability/number-of-channels :Word: 4
|
||||
radio.1/cisco/multi-domain-capability/reserved :Byte: 1
|
||||
radio.1/cisco/tx-power-levels :Bstr16: .x070011000e000b000800050002ffff0000
|
||||
radio.1/cisco/tx-power/current-tx-power :Word: 6
|
||||
radio.1/cisco/tx-power/current-tx-power :Word: 1
|
||||
radio.1/cisco/tx-power/reserved :Byte: 1
|
||||
radio.1/cisco/wtp-radio-config/beacon-period :Word: 100
|
||||
radio.1/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b90
|
||||
@ -266,23 +300,40 @@ radio.1/decryption-error-report-period :Word: 120
|
||||
radio.1/operational-state/cause :Byte: Normal
|
||||
radio.1/operational-state/state :Byte: enabled
|
||||
radio.1/rate_set :Bstr16: .x8c129824b048606c
|
||||
radio.1/wlan.0/add-lw-wlan/misc :Bstr16: .x3e9904fac0000100
|
||||
radio.1/wlan.0/add-lw-wlan/misc2 :Word: 4
|
||||
radio.1/wlan.0/add-lw-wlan/ssid :Str: TubeSSID
|
||||
radio.1/wlan.0/add-wlan/broadcast-ssid :Bool: true
|
||||
radio.1/wlan.0/add-wlan/dtim-period :Byte: 1
|
||||
radio.1/wlan.0/add-wlan/encryption-policy :Dword: 4
|
||||
radio.1/wlan.0/add-wlan/profile-name :Str: tubeC
|
||||
radio.1/wlan.0/add-wlan/qos :Byte: 0
|
||||
radio.1/wlan.0/add-wlan/radio-id :Byte: 1
|
||||
radio.1/wlan.0/add-wlan/scan-defer-time :Word: 100
|
||||
radio.1/wlan.0/add-wlan/session-timout :Word: 1800
|
||||
radio.1/wlan.0/add-wlan/ssid :Str:
|
||||
radio.1/wlan.0/add-wlan/wep-encryption :Bool: false
|
||||
radio.1/wlan.0/add-wlan/wep-key :Bstr16: .xf0571b63dc70fdf913e2bd0806
|
||||
radio.1/wlan.0/add-wlan/wep-key-index :Byte: 1
|
||||
radio.1/wlan.0/add-wlan/wlan-capability :Word: 17
|
||||
radio.1/wlan.0/add-wlan/wlan-id :Byte: 1
|
||||
radio.1/wlan.1/add-wlan/aironet-ie :Bool: true
|
||||
radio.1/wlan.1/add-wlan/broadcast-ssid :Bool: true
|
||||
radio.1/wlan.1/add-wlan/dtim-period :Byte: 1
|
||||
radio.1/wlan.1/add-wlan/encryption-policy :Dword: 4
|
||||
radio.1/wlan.1/add-wlan/hreap-local-switch :Byte: 0
|
||||
radio.1/wlan.1/add-wlan/profile-name :Str: tubeC
|
||||
radio.1/wlan.1/add-wlan/qos :Byte: 0
|
||||
radio.1/wlan.1/add-wlan/radio-id :Byte: 1
|
||||
radio.1/wlan.1/add-wlan/scan-defer-period :Word: 28784
|
||||
radio.1/wlan.1/add-wlan/scan-defer-time :Word: 100
|
||||
radio.1/wlan.1/add-wlan/session-timout :Word: 1800
|
||||
radio.1/wlan.1/add-wlan/ssid :Str: tubeC
|
||||
radio.1/wlan.1/add-wlan/wep-encryption :Bool: false
|
||||
radio.1/wlan.1/add-wlan/wep-key :Bstr16: .xcac80297ec10e7a8da2c9b1f03
|
||||
radio.1/wlan.1/add-wlan/wep-key-index :Byte: 1
|
||||
radio.1/wlan.1/add-wlan/wlan-capability :Word: 17
|
||||
radio.1/wlan.1/add-wlan/wlan-id :Byte: 1
|
||||
radio.1/wlan.13/add-wlan/aironet-ie :Bool: true
|
||||
radio.1/wlan.13/add-wlan/broadcast-ssid :Bool: true
|
||||
radio.1/wlan.13/add-wlan/dtim-period :Byte: 19
|
||||
radio.1/wlan.13/add-wlan/encryption-policy :Dword: 1
|
||||
radio.1/wlan.13/add-wlan/hreap-local-switch :Byte: 16
|
||||
radio.1/wlan.13/add-wlan/profile-name :Str: SuerWLAN
|
||||
radio.1/wlan.13/add-wlan/qos :Byte: 0
|
||||
radio.1/wlan.13/add-wlan/radio-id :Byte: 1
|
||||
radio.1/wlan.13/add-wlan/scan-defer-period :Word: 15420
|
||||
radio.1/wlan.13/add-wlan/scan-defer-time :Word: 100
|
||||
radio.1/wlan.13/add-wlan/session-timout :Word: 1800
|
||||
radio.1/wlan.13/add-wlan/ssid :Str: SuperSSID
|
||||
radio.1/wlan.13/add-wlan/wep-encryption :Bool: false
|
||||
radio.1/wlan.13/add-wlan/wep-key :Bstr16: .x00000000000000000000000000
|
||||
radio.1/wlan.13/add-wlan/wep-key-index :Byte: 1
|
||||
radio.1/wlan.13/add-wlan/wlan-capability :Word: 1
|
||||
radio.1/wlan.13/add-wlan/wlan-id :Byte: 13
|
||||
radio.1/wtp-radio-information :Dword: 2
|
||||
radio.255/admin-state :Byte: reserved
|
||||
radio.255/operational-state/cause :Byte: Normal
|
||||
|
@ -97,21 +97,24 @@ static void do_update(struct conn * conn)
|
||||
|
||||
|
||||
|
||||
if (!update)
|
||||
return;
|
||||
update=0;
|
||||
// if (!update)
|
||||
// return;
|
||||
// update=0;
|
||||
|
||||
/* mbag_t result = mbag_create();
|
||||
update_radios(conn,result);
|
||||
*/ cw_dbg(DBG_INFO, "Saving configuration ...");
|
||||
/* cfg_to_json();*/
|
||||
/* Change State ... */
|
||||
|
||||
|
||||
/*
|
||||
rc = cw_send_request(conn,CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST);
|
||||
if ( !cw_result_is_ok(rc) ) {
|
||||
cw_strresult(rc);
|
||||
return ;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@ -162,24 +165,26 @@ int run(struct conn * conn)
|
||||
if (rc < 0 && errno == EAGAIN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
printf("--------------------------------------------------------------------------------------\n");
|
||||
|
||||
if ( !cw_result_is_ok(rc))
|
||||
if ( !cw_result_is_ok(rc)) {
|
||||
printf("---------------------- cwrsult is not ok\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf("lalalala\n");
|
||||
cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"KTV DUMP ----------------","Remote:", "DUMP done -------");
|
||||
|
||||
printf("Saving Config\n");
|
||||
mavl_merge(conn->local_cfg,conn->remote_cfg);
|
||||
cw_ktv_save(conn->local_cfg,"cisco.ktv");
|
||||
clean_cfg(conn->remote_cfg);
|
||||
|
||||
|
||||
/*cw_dbg(DBG_X,"We hav a message processed");*/
|
||||
cw_dbg(DBG_X,"We hav a message processed");
|
||||
update=1;
|
||||
do_update(conn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (rc<0 && errno == EAGAIN){
|
||||
rc = cw_send_request(conn,CAPWAP_MSG_ECHO_REQUEST);
|
||||
|
||||
@ -194,9 +199,6 @@ int run(struct conn * conn)
|
||||
cw_log(LOG_ERR,"Error in run state: %d %s",rc,cw_strrc(rc));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} while (conn->capwap_state == CAPWAP_STATE_RUN);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user