Work on join

FossilOrigin-Name: 49cdffd359bed4d93919d0f97aaf32806bef625405399f493ca5792b05122bca
This commit is contained in:
7u83@mail.ru
2018-04-03 05:35:55 +00:00
parent 447d7a5f53
commit 651261b6b6
11 changed files with 114 additions and 138 deletions

View File

@ -196,6 +196,7 @@ ssl_cert="../../ssl/certs/ac-cisco.pem"
# Set debug level
#
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
@ -212,13 +213,12 @@ ssl_cert="../../ssl/certs/ac-cisco.pem"
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_detail # DTLS in more detail
# 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 += all
#
# dbg += all # all of the above
# dbg += err # Same as dbg_err and pkt_err

View File

@ -261,7 +261,7 @@ int main (int argc, char *argv[])
actube_global_cfg = global_cfg;
cw_dbg_opt_level=0xffffffff;
/* cw_dbg_opt_level=0xffffffff;*/
cw_dbg(DBG_INFO,"Hello world");

View File

@ -20,3 +20,11 @@ capwap-control-ip-address/address.0:IPAddress:192.168.0.14
capwap-control-ip-address/wtps.0:Word:0
#capwap-control-ip-address/wtps.1:Word:11
capwap/ssl-keyfile:Str:"../../ssl/certs/ac-cisco.key"
capwap/ssl-certfile:Str:"../../ssl/certs/ac-cisco.pem"
capwap/ssl-cipher:Str:NORMAL
#capwap/ssl-psk:Str:"HalloWelt"

View File

@ -91,7 +91,7 @@ static void wtpman_run_discovery(void *arg)
time_t timer = cw_timer_start(10);
wtpman->conn->capwap_state = CAPWAP_STATE_DISCOVERY;
wtpman->conn->remote_cfg = cw_ktv_create();
while (!cw_timer_timeout(timer)
&& wtpman->conn->capwap_state == CAPWAP_STATE_DISCOVERY) {
@ -101,11 +101,11 @@ static void wtpman_run_discovery(void *arg)
wtpman->conn->capwap_state=CAPWAP_STATE_JOIN;
cw_dbg(DBG_INFO,"Discovery has detected mods: %s %s",
wtpman->conn->bmod->name,wtpman->conn->cmod->name);
wtpman->conn->cmod->name,wtpman->conn->bmod->name);
wtplist_lock();
discovery_cache_add(discovery_cache,(struct sockaddr*)&wtpman->conn->addr,
wtpman->conn->bmod,wtpman->conn->cmod);
wtpman->conn->cmod,wtpman->conn->bmod);
wtplist_unlock();
}
@ -137,11 +137,12 @@ static int wtpman_establish_dtls(void *arg)
char sock_buf[SOCK_ADDR_BUFSIZE];
struct wtpman *wtpman = (struct wtpman *) arg;
/* setup cipher */
wtpman->conn->dtls_cipher = conf_sslcipher;
/* wtpman->conn->dtls_cipher = conf_sslcipher;*/
/* setup DTSL certificates */
dtls_ok = 0;
/* dtls_ok = 0;
if (conf_sslkeyfilename && conf_sslcertfilename) {
@ -153,9 +154,9 @@ static int wtpman_establish_dtls(void *arg)
cw_dbg(DBG_DTLS, "Using cert file %s", wtpman->conn->dtls_cert_file);
dtls_ok = 1;
}
*/
/* setup DTLS psk */
if (conf_dtls_psk) {
/* if (conf_dtls_psk) {
wtpman->conn->dtls_psk = conf_dtls_psk;
wtpman->conn->dtls_psk_len = strlen(conf_dtls_psk);
dtls_ok = 1;
@ -166,7 +167,7 @@ static int wtpman_establish_dtls(void *arg)
"Can't establish DTLS session, neither psk nor certs set in config file.");
return 0;
}
*/
/* try to accept the connection */
if (!dtls_accept(wtpman->conn)) {
cw_dbg(DBG_DTLS, "Error establishing DTLS session with %s",
@ -321,7 +322,7 @@ void * wtpman_run_data(void *wtpman_arg)
static void * wtpman_run(void *arg)
{
mavl_t r;
mavl_t r;
int rc ;
time_t timer;
char sock_buf[SOCK_ADDR_BUFSIZE];
@ -332,6 +333,8 @@ static void * wtpman_run(void *arg)
wtpman->conn->seqnum = 0;
conn = wtpman->conn;
wtpman->conn->remote_cfg = cw_ktv_create();
/* We were invoked with an unencrypted packet,
* so assume, it is a discovery request */
if (!wtpman->dtlsmode){
@ -606,20 +609,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr, int dt
}
/* when created caused by a packet in DTLS mode, we try
* to find out the modules to load, for detected connection
* from discovery request */
if (dtlsmode){
int rc;
struct cw_Mod *cmod, *bmod;
rc = discovery_cache_get(discovery_cache,srcaddr,&cmod,&bmod);
if (rc){
cw_dbg(DBG_INFO, "Initializing with mod %s %s",cmod,bmod);
wtpman->conn->msgset = cw_mod_get_msg_set(wtpman->conn,cmod,bmod);
wtpman->conn->detected=1;
}
}
@ -638,12 +628,25 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr, int dt
*/
wtpman->conn->local_cfg = cw_ktv_create();
wtpman->conn->global_cfg = actube_global_cfg;
wtpman->conn->local_cfg = actube_global_cfg;
/* when created caused by a packet in DTLS mode, we try
* to find out the modules to load, for detected connection
* from discovery request */
if (dtlsmode){
int rc;
struct cw_Mod *cmod, *bmod;
rc = discovery_cache_get(discovery_cache,srcaddr,&cmod,&bmod);
if (rc){
cw_dbg(DBG_INFO, "Initializing with mod %s %s",cmod->name,bmod->name);
wtpman->conn->msgset = cw_mod_get_msg_set(wtpman->conn,cmod,bmod);
wtpman->conn->detected=1;
cmod->setup_cfg(wtpman->conn);
}
}
return wtpman;
}