Working on Cisoc support.
FossilOrigin-Name: 3b605a558b58d0288e1ee3c60277c74967b120fcb500e3458b3b7c7d71903bae
This commit is contained in:
@ -1,7 +1,13 @@
|
||||
#include "capwap/conn.h"
|
||||
#include "wtp_interface.h"
|
||||
|
||||
int configure()
|
||||
{
|
||||
struct conn * conn = get_conn();
|
||||
struct wtpinfo * wtpinfo = get_wtpinfo();
|
||||
|
||||
cw_prepare_configuration_status_request(conn,wtpinfo);
|
||||
conn_send_request(conn);
|
||||
|
||||
}
|
||||
|
||||
|
@ -50,12 +50,13 @@ static int acprint(void *p,void*d) //,int ctr)
|
||||
ACIP * ip = (ACIP*)d;
|
||||
char str[100];
|
||||
sock_addrtostr((struct sockaddr*)&ip->ip,str,100);
|
||||
// printf("ACIP: %s\n",str);
|
||||
// printf("CTR: %i\n",ip->wtp_count);
|
||||
printf("ACIP: %s\n",str);
|
||||
printf("CTR: %i\n",ip->wtp_count);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
struct ac_info wtp_acinfo;
|
||||
|
||||
|
||||
static int msg_cb(void *priv,struct cwrmsg * cwrmsg)
|
||||
@ -75,22 +76,22 @@ static int msg_cb(void *priv,struct cwrmsg * cwrmsg)
|
||||
*/
|
||||
|
||||
|
||||
struct ac_info acinfo;
|
||||
memset(&acinfo,0,sizeof(acinfo));
|
||||
struct ac_info * acinfo = &wtp_acinfo;
|
||||
memset(acinfo,0,sizeof(struct ac_info));
|
||||
|
||||
acinfo.aciplist = di->aciplist;
|
||||
acinfo->aciplist = di->aciplist;
|
||||
|
||||
|
||||
|
||||
|
||||
cwread_discovery_response(&acinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
||||
cwread_discovery_response(acinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char ai [4096];
|
||||
acinfo_print(ai,&acinfo);
|
||||
acinfo_print(ai,acinfo);
|
||||
printf("AC INFO\n%s",ai);
|
||||
|
||||
|
||||
@ -111,7 +112,7 @@ static int msg_cb(void *priv,struct cwrmsg * cwrmsg)
|
||||
|
||||
printf("ACL COUNT: %i\n",acinfo.aciplist->count);
|
||||
*/
|
||||
aciplist_foreach(acinfo.aciplist,acprint,0);
|
||||
aciplist_foreach(acinfo->aciplist,acprint,0);
|
||||
|
||||
// responses++;
|
||||
//
|
||||
@ -300,7 +301,6 @@ ACIPLIST * do_discovery(const char *acaddr)
|
||||
discovery_count++;
|
||||
|
||||
|
||||
/* create socket */
|
||||
int sockfd;
|
||||
int opt;
|
||||
sockfd=socket(res->ai_family,SOCK_DGRAM,0);
|
||||
@ -324,17 +324,20 @@ ACIPLIST * do_discovery(const char *acaddr)
|
||||
|
||||
do_discover_conn(conn,&di);
|
||||
|
||||
close(sockfd);
|
||||
|
||||
if ( di.aciplist->count != 0)
|
||||
if ( di.aciplist->count != 0){
|
||||
set_sock(sockfd);
|
||||
break;
|
||||
}
|
||||
|
||||
close(sockfd);
|
||||
|
||||
}
|
||||
|
||||
freeaddrinfo(res0);
|
||||
|
||||
if (di.aciplist->count){
|
||||
// cw_log_debug2("Discover responses received: %i\n",di.response_count);
|
||||
cw_dbg(DBG_CW_INFO,"Discovery responses received: %i\n",di.response_count);
|
||||
return di.aciplist;
|
||||
|
||||
}
|
||||
|
@ -62,19 +62,23 @@ for(int i=0; i<10; i++){
|
||||
// }while(cwrmsg==0);
|
||||
|
||||
|
||||
|
||||
printf("SEQQQQS %d %d\n",cwrmsg->seqnum,conn->seqnum);
|
||||
if(!cwrmsg) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
printf("SEQS %d %d\n",cwrmsg->type,conn->seqnum);
|
||||
|
||||
// cw_log_debug0("Received message %i",cwrmsg->seqnum);
|
||||
|
||||
if (cwrmsg->type != CWMSG_JOIN_RESPONSE || cwrmsg->seqnum != conn->seqnum){
|
||||
printf("Wrong messagei %d %d\n",cwrmsg->seqnum,conn->seqnum);
|
||||
printf("Wrong message %d %d\n",cwrmsg->type,conn->seqnum);
|
||||
|
||||
}
|
||||
|
||||
struct ac_info acinfo;
|
||||
memset(&acinfo,0,sizeof(acinfo));
|
||||
|
||||
acinfo.result_code=99;
|
||||
|
||||
cwread_join_response(&acinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
||||
|
||||
@ -91,7 +95,9 @@ int join(struct sockaddr *sa)
|
||||
int sockfd;
|
||||
int rc;
|
||||
|
||||
sockfd = socket(AF_INET,SOCK_DGRAM,0);
|
||||
// sockfd = socket(AF_INET,SOCK_DGRAM,0);
|
||||
|
||||
sockfd = get_sock();
|
||||
if (sockfd==-1){
|
||||
cw_log(LOG_ERR,"Can't create socket: %s\n",strerror(errno));
|
||||
return -1;
|
||||
@ -111,6 +117,7 @@ int join(struct sockaddr *sa)
|
||||
struct conn * conn = get_conn();
|
||||
|
||||
conn->capwap_mode = CWMODE_CISCO;
|
||||
conn->seqnum=-1;
|
||||
|
||||
|
||||
conn->sock=sockfd;
|
||||
|
@ -99,11 +99,10 @@ printf("Back from conn send req\n");
|
||||
if (rc==0){
|
||||
|
||||
printf("Error !\n");
|
||||
exit(0);
|
||||
|
||||
dtls_shutdown(conn);
|
||||
// dtls_shutdown(conn);
|
||||
// cw_log_debug1("Connection lost, no echo response");
|
||||
return 0;
|
||||
// return 0;
|
||||
}
|
||||
echo_interval_timer=time(NULL);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ char * default_ac_list[] = {
|
||||
// "192.168.0.255",
|
||||
"255.255.255.255",
|
||||
// "224.0.1.140",
|
||||
// "192.168.0.12"
|
||||
//"192.168.0.77"
|
||||
};
|
||||
|
||||
int wtpconf_ac_list()
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "capwap/acinfo.h"
|
||||
#include "capwap/conn.h"
|
||||
#include "capwap/capwap_80211.h"
|
||||
#include "capwap/cw_log.h"
|
||||
|
||||
#include "wtp_conf.h"
|
||||
#include "wtp_interface.h"
|
||||
@ -30,6 +31,8 @@ struct wtpinfo * get_wtpinfo()
|
||||
|
||||
}
|
||||
|
||||
wtpinfo->radios_in_use=2;
|
||||
|
||||
wtpinfo->encryption_cap=1;
|
||||
|
||||
wtpinfo->serial_no=conf_serial_no;
|
||||
@ -56,17 +59,22 @@ struct wtpinfo * get_wtpinfo()
|
||||
wtpinfo->macaddress=conf_macaddress;
|
||||
wtpinfo->macaddress_len=conf_macaddress_len;
|
||||
|
||||
wtpinfo->mac_type=0;
|
||||
|
||||
wtpinfo->max_msg_len=14000;
|
||||
|
||||
wtpinfo->mac_type=1;
|
||||
|
||||
|
||||
// wtpinfo->session_id = malloc(8);
|
||||
// wtpinfo->session_id_len = cw_rand(wtpinfo->session_id,8);
|
||||
|
||||
uint8_t sessid[4];
|
||||
int sidl = cw_rand(sessid,4);
|
||||
wtpinfo->session_id = bstr_create(sessid,sidl);
|
||||
memset(sessid,0,4);
|
||||
int sidl = cw_rand(sessid+2,2);
|
||||
|
||||
wtpinfo->session_id = bstr_create(sessid,4);
|
||||
|
||||
wtpinfo->frame_tunnel_mode=1;
|
||||
wtpinfo->frame_tunnel_mode=4;
|
||||
return wtpinfo;
|
||||
}
|
||||
|
||||
@ -86,6 +94,22 @@ ACIPLIST * order_aciplist(ACIPLIST *aciplistin)
|
||||
}
|
||||
|
||||
|
||||
static int sockfd = -1;
|
||||
int get_sock()
|
||||
{
|
||||
return sockfd;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int set_sock(int sock)
|
||||
{
|
||||
sockfd = sock;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static struct conn * conn=0;
|
||||
struct conn * get_conn()
|
||||
{
|
||||
|
@ -81,10 +81,17 @@ int do_connect(void *priv,void *data)
|
||||
if (!rc)
|
||||
return 1;
|
||||
|
||||
|
||||
rc = configure();
|
||||
printf("Sleep after oin\n");
|
||||
sleep(5);
|
||||
printf("Go conf\n");
|
||||
|
||||
|
||||
// rc = join(&ip->ip);
|
||||
// if (!rc)
|
||||
// return 1;
|
||||
|
||||
rc = configure();
|
||||
|
||||
run (get_conn());
|
||||
return 0;
|
||||
}
|
||||
|
@ -1218,11 +1218,13 @@ int wtpdrv_get_radioinfo(int rid,struct radioinfo * radioinfo)
|
||||
|
||||
radioinfo->rid=rid;
|
||||
//uint8_t rm[8]="12345600";
|
||||
uint8_t rm[8]={0x00,0x19,0xdb,0xe0,0x93,0x27};
|
||||
|
||||
// uint8_t rm[8]={0x00,0x19,0xdb,0xe0,0x93,0x27};
|
||||
// uint8_t rm[8]={0x00,0x3a,0x99,0x02,0xfa,0xc0};
|
||||
uint8_t rm[8]={0x68,0x67,0x65,0x64,0x63,0x62};
|
||||
|
||||
radioinfo->rmac = bstr_create(rm,6);
|
||||
|
||||
radioinfo->type|=CW_80211_RADIO_TYPE_B; //CWRADIO_TYPE_N;
|
||||
radioinfo->type|=rid+1; //CW_80211_RADIO_TYPE_B; //CWRADIO_TYPE_N;
|
||||
|
||||
/*
|
||||
struct wpa_driver_ops * drv = wpa_drivers[0];
|
||||
|
Reference in New Issue
Block a user