Work on wtp join
FossilOrigin-Name: 6bc5cec137a404301cb7f1089f589c6c03cb24c1b309a6b2f9e8d595a467bc6c
This commit is contained in:
parent
03a786b530
commit
5b62365285
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Workspace Name="actube" Database="">
|
||||
<Project Name="ac" Path="ac.project" Active="No"/>
|
||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||
<Project Name="wtp" Path="wtp.project" Active="Yes"/>
|
||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||
<BuildMatrix>
|
||||
|
@ -271,6 +271,9 @@
|
||||
<File Name="src/cw/cw_ktv_get_dword.c"/>
|
||||
<File Name="src/cw/cw_type_str.c"/>
|
||||
<File Name="src/cw/cw_ktv_get_str.c"/>
|
||||
<File Name="src/cw/cw_setup_dtls.c"/>
|
||||
<File Name="src/cw/cw_ktv_replace.c"/>
|
||||
<File Name="src/cw/cw_ktv_set_byte.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
|
@ -135,7 +135,7 @@ strict_capwap = off
|
||||
# Currently as protocol only capwap is suppert
|
||||
#
|
||||
# Defalut:
|
||||
listen = 192.168.0.14:1027
|
||||
#listen = 192.168.0.14:1027
|
||||
|
||||
# broadcast_listen - Broadcast listen address
|
||||
# If ommited, the boraadcast listen adresses a determined automatically
|
||||
@ -145,7 +145,7 @@ listen = 192.168.0.14:1027
|
||||
# broadcast_listen =
|
||||
#
|
||||
|
||||
broadcast_listen = 192.168.0.255:1027
|
||||
#broadcast_listen = 192.168.0.255:1027
|
||||
|
||||
# use_loopback
|
||||
# Include loopback interfaces if listen addresses are auto detected
|
||||
|
@ -688,7 +688,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr)
|
||||
// struct sockaddr *from);
|
||||
*/
|
||||
wtpman->conn = conn_create(sockfd, srcaddr, 100);
|
||||
wtpman->conn->receiver = CW_RECEIVER_AC;
|
||||
wtpman->conn->role = CW_ROLE_AC;
|
||||
|
||||
wtpman->conn->data_sock = socklist[socklistindex].data_sockfd;
|
||||
sock_copyaddr(&wtpman->conn->data_addr, (struct sockaddr *) &wtpman->conn->addr);
|
||||
|
@ -190,7 +190,7 @@ static struct cw_MsgDef messages[] = {
|
||||
{
|
||||
"Discovery Request",
|
||||
CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
CW_RECEIVER_AC,
|
||||
CW_ROLE_AC,
|
||||
discovery_request_states,
|
||||
discovery_request_elements
|
||||
},
|
||||
@ -198,7 +198,7 @@ static struct cw_MsgDef messages[] = {
|
||||
{
|
||||
"Discovery Response",
|
||||
CAPWAP_MSG_DISCOVERY_RESPONSE,
|
||||
CW_RECEIVER_WTP,
|
||||
CW_ROLE_WTP,
|
||||
discovery_response_states,
|
||||
discovery_response_elements
|
||||
},
|
||||
|
@ -43,10 +43,13 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int static setup_cfg(struct conn * conn)
|
||||
{
|
||||
|
||||
|
||||
int security;
|
||||
security = cw_setup_dtls(conn,conn->local_cfg,"capwap",CAPWAP_CIPHER);
|
||||
cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ static struct cw_MsgDef messages[] = {
|
||||
{
|
||||
"Discovery Request",
|
||||
CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
CW_RECEIVER_AC,
|
||||
CW_ROLE_AC,
|
||||
discovery_request_states,
|
||||
discovery_request_elements
|
||||
}
|
||||
|
@ -157,14 +157,14 @@ static struct cw_MsgDef messages[] = {
|
||||
{
|
||||
NULL, /* name */
|
||||
CAPWAP_MSG_DISCOVERY_REQUEST, /* type */
|
||||
CW_RECEIVER_AC,
|
||||
CW_ROLE_AC,
|
||||
discovery_request_states,
|
||||
discovery_request_elements
|
||||
},
|
||||
{
|
||||
NULL, /* name */
|
||||
CAPWAP_MSG_DISCOVERY_RESPONSE, /* type */
|
||||
CW_RECEIVER_WTP,
|
||||
CW_ROLE_WTP,
|
||||
discovery_response_states,
|
||||
discovery_response_elements
|
||||
},
|
||||
|
@ -1,15 +1,14 @@
|
||||
#capwap/ssl-certfile:Str:../../ssl/certs/wtp.crt
|
||||
|
||||
|
||||
|
||||
capwap/ssl-certfile:Str:"../../ssl/certs/wtp.crt"
|
||||
capwap/ssl-keyfile:Str:"../../ssl/certs/wtp.key"
|
||||
|
||||
windows:Word:124
|
||||
|
||||
basic/mod:Bstr16:cisco
|
||||
|
||||
ansi/hallo:Dword:1
|
||||
discovery-type:Byte:0
|
||||
wtp-frame-tunnel-mode:Byte:1
|
||||
wtp-mac-type:Byte:2
|
||||
|
||||
|
||||
wtp-board-data/vendor:Dword:1234567
|
||||
|
||||
wtp-board-data/model-no:Bstr16:WFAT1234
|
||||
@ -31,12 +30,10 @@ radio/1/wtp-radio-information:Dword:02
|
||||
|
||||
wtp-name:Bstr16:WFAT01
|
||||
|
||||
|
||||
wtp-fallback:Byte:1
|
||||
ac-name-with-priority/TubesACx:Byte:3
|
||||
ac-name-with-priority/TubesAC:Byte:3
|
||||
ac-name-with-priority/"ac2":Byte:01
|
||||
|
||||
|
||||
capwap-timers/max-discovery-interval:Byte:0
|
||||
capwap-timers/min-discovery-interval:Byte:0
|
||||
capwap-timers/echo-interval:Byte:3
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "cw/dbg.h"
|
||||
#include "cw/sock.h"
|
||||
#include "cw/dtls.h"
|
||||
|
||||
#include "cw/mavl.h"
|
||||
|
||||
#include "wtp.h"
|
||||
|
||||
@ -102,12 +102,12 @@ acinfo.result_code=99;
|
||||
int run_join_d(struct conn * conn, struct sockaddr *sa)
|
||||
{
|
||||
char addrstr[SOCK_ADDR_BUFSIZE];
|
||||
int sockfd;
|
||||
|
||||
/* struct conn *conn = get_conn();*/
|
||||
|
||||
conn->capwap_state = CAPWAP_STATE_JOIN;
|
||||
|
||||
int sockfd;
|
||||
int rc;
|
||||
|
||||
sockfd = socket(sa->sa_family, SOCK_DGRAM, 0);
|
||||
if (sockfd == -1) {
|
||||
@ -131,9 +131,9 @@ int run_join_d(struct conn * conn, struct sockaddr *sa)
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
cw_dbg(DBG_DTLS, "Establishing DTLS session with %s", sock_addr2str(sa, addrstr));
|
||||
|
||||
cw_dbg(DBG_DTLS, "Establishing DTLS session with %s", sock_addr2str(sa, addrstr));
|
||||
/*
|
||||
int dtls_conf_ok=0;
|
||||
|
||||
if (conn->dtls_psk) {
|
||||
@ -220,11 +220,36 @@ int run_join(struct conn *conn)
|
||||
|
||||
|
||||
|
||||
int join(struct conn * conn, struct cw_DiscoveryResult dis)
|
||||
int join(struct conn * conn, struct cw_DiscoveryResult * dis)
|
||||
{
|
||||
|
||||
mavliter_t ii;
|
||||
char addrstr[SOCK_ADDR_BUFSIZE];
|
||||
mavliter_init(&ii,dis->prio_ip);
|
||||
|
||||
mavliter_foreach(&ii){
|
||||
cw_KTV_t * val,*ac;
|
||||
mavl_t rcfg;
|
||||
char * rk;
|
||||
char ipstr[100];
|
||||
char ac_name[CAPWAP_MAX_AC_NAME_LEN];
|
||||
|
||||
val = mavliter_get(&ii);
|
||||
rk = val->key;
|
||||
val = val->val.ptr;
|
||||
val->type->to_str(val, ipstr, 100);
|
||||
|
||||
rcfg = cw_ktv_get_sysptr(dis->prio_ac,rk,NULL);
|
||||
|
||||
ac=cw_ktv_get(rcfg,"ac-name",CW_TYPE_BSTR16);
|
||||
if (ac != NULL){
|
||||
ac->type->to_str(ac,ac_name,sizeof(ac_name));
|
||||
}
|
||||
else{
|
||||
strcpy(ac_name,"");
|
||||
}
|
||||
|
||||
cw_dbg(DBG_INFO, "Going to join CAPWAP controller '%s' at %s.",ac_name,ipstr);
|
||||
}
|
||||
|
||||
|
||||
/*mbag_del_all(conn->incomming);*/
|
||||
|
@ -27,6 +27,7 @@ int cw_run_discovery(struct conn *conn, const char *acaddr, const char *bindaddr
|
||||
|
||||
int cw_discovery_init_results(struct cw_DiscoveryResult *dis);
|
||||
void cw_discovery_free_results(struct cw_DiscoveryResult * dis);
|
||||
int join(struct conn * conn, struct cw_DiscoveryResult * dis);
|
||||
|
||||
struct conn * get_conn();
|
||||
|
||||
|
@ -81,7 +81,7 @@ int main (int argc, char **argv)
|
||||
mavl_t global_cfg, types_tree;
|
||||
const cw_Type_t ** ti;
|
||||
int i;
|
||||
|
||||
struct cw_DiscoveryResult dis;
|
||||
|
||||
bootcfg.nmods=0;
|
||||
|
||||
@ -129,6 +129,24 @@ int main (int argc, char **argv)
|
||||
|
||||
cw_dbg_ktv_dump(global_cfg,DBG_CFG_DMP,"----- global cfg start -----","","----- global cfg end -----");
|
||||
|
||||
/* create a connection object */
|
||||
conn = conn_create_noq(-1, NULL);
|
||||
if (conn==NULL){
|
||||
cw_log(LOG_ERR, "Connot create conn: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
/* conn->mod=mod;*/
|
||||
conn->detected = 1;
|
||||
conn->dtls_verify_peer=0;
|
||||
conn->dtls_mtu = 12000;
|
||||
conn->msgset=msgset;
|
||||
conn->local_cfg = global_cfg;
|
||||
conn->remote_cfg = NULL;
|
||||
conn->role = CW_ROLE_WTP;
|
||||
conn->wbid=1;
|
||||
|
||||
for (i=0;i<bootcfg.nmods; i++){
|
||||
mod = cw_mod_load(bootcfg.modnames[i], global_cfg, CW_ROLE_WTP);
|
||||
if (mod == NULL){
|
||||
@ -137,37 +155,17 @@ int main (int argc, char **argv)
|
||||
/* Build a message set from our loaded modules */
|
||||
mod->register_messages(msgset, CW_MOD_MODE_CAPWAP);
|
||||
mod->register_messages(msgset, CW_MOD_MODE_BINDINGS);
|
||||
if (mod->setup_cfg)
|
||||
mod->setup_cfg(conn);
|
||||
}
|
||||
|
||||
|
||||
/* create a connection object */
|
||||
conn = conn_create_noq(-1, NULL);
|
||||
if (conn==NULL){
|
||||
cw_log(LOG_ERR, "Connot create conn: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
conn->detected = 1;
|
||||
conn->dtls_verify_peer=0;
|
||||
conn->dtls_mtu = 12000;
|
||||
conn->msgset=msgset;
|
||||
conn->local_cfg = global_cfg;
|
||||
conn->remote_cfg = NULL;
|
||||
conn->receiver = CW_ROLE_WTP;
|
||||
conn->wbid=1;
|
||||
|
||||
struct cw_DiscoveryResult dis;
|
||||
|
||||
|
||||
cw_discovery_init_results(&dis);
|
||||
|
||||
|
||||
|
||||
cw_run_discovery(conn, "255.255.255.255",NULL, &dis);
|
||||
|
||||
cw_dbg_ktv_dump(dis.prio_ip, DBG_INFO, "=== IP list ===", "IP", "=== END IP List ===");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
{
|
||||
mavliter_t i;
|
||||
mavliter_init(&i, dis.prio_ip);
|
||||
@ -191,6 +189,8 @@ int main (int argc, char **argv)
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
join(conn,&dis);
|
||||
|
||||
cw_discovery_free_results(&dis);
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
</Compiler>
|
||||
<Linker Options="" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Debug" Command="$(WorkspacePath)/src/wtp/wtp" CommandArguments="-dall -mcisco" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(WorkspacePath)/src/wtp/" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Debug" Command="$(WorkspacePath)/src/wtp/wtp" CommandArguments="-dall " UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(WorkspacePath)/src/wtp/" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[LD_LIBRARY_PATH=../../lib]]>
|
||||
</Environment>
|
||||
|
Loading…
Reference in New Issue
Block a user