A lot of LWAPP and Cisco stuff added.
FossilOrigin-Name: a95a9632485d5b2632f48c24eea56f7dcca9a4c423981287040e532c22eeab74
This commit is contained in:
parent
8bfc4fb2a1
commit
c80fcb8b41
@ -1,4 +1,14 @@
|
||||
|
||||
Terms used by Cisco, CAPWAP, LWAPP and others ...
|
||||
|
||||
Slot ID = Radio ID
|
||||
AC = MWAR = WLC
|
||||
AP = RAD = WTP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2. Cisco MWAR Addr
|
||||
|
||||
Address of AC
|
||||
@ -36,8 +46,10 @@
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Default Gateway |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Reserved |
|
||||
| Type | Reserved ... |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Reserved |
|
||||
+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 83
|
||||
Length: 16
|
||||
@ -45,6 +57,10 @@
|
||||
IP Address: The IP address of AP
|
||||
Netmask: Netmask
|
||||
Default Gateway: default gateway
|
||||
Type:
|
||||
1=Static
|
||||
0=DHCP
|
||||
Reserved: (?)
|
||||
|
||||
|
||||
126. Cisco AP Regulatory Domain
|
||||
@ -54,9 +70,9 @@
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Band ID | regDomainSet | RegDomainSlot | RegDomainCode |
|
||||
| Band ID | regDomainSet | RegDomainSlot | RegDomainCode0 |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| RegDomainCope1|
|
||||
| RegDomainCode1|
|
||||
+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 126
|
||||
@ -94,6 +110,9 @@
|
||||
Type: Time type
|
||||
0 = Manual (?)
|
||||
|
||||
169. Cisco AP IP Domain
|
||||
|
||||
170. Cisco AP IP Name Server
|
||||
|
||||
|
||||
207. Cisco Board Data Options
|
||||
@ -124,10 +143,34 @@
|
||||
01 = Normal MWAR
|
||||
02 = Configured MWAR
|
||||
|
||||
254. Cisco SPAM AP LED Flash Config
|
||||
|
||||
|
||||
|
||||
LWAPP
|
||||
=====
|
||||
20. Ciscp AP Username Password
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Username (32 bytes) ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
... Username |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Password hash ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
|
||||
44. Cisco AP Telnet SSH
|
||||
0 1
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| | |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 44
|
||||
Length: 2
|
||||
|
||||
|
||||
73. Cisco Path MTU
|
||||
|
||||
@ -136,6 +179,8 @@ LWAPP
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Data length | Padding |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Padding data ..
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 73
|
||||
Length: >=4
|
||||
|
@ -64,6 +64,7 @@ LWAPPOBJS = \
|
||||
lw_put_ac_descriptor.o \
|
||||
lw_put_cisco_path_mtu.o \
|
||||
lw_readelem_wtp_name.o \
|
||||
lw_put_80211_wtp_wlan_radio_configuration.o \
|
||||
|
||||
|
||||
# LWAPP cisco vendor specific objs
|
||||
|
@ -610,6 +610,7 @@ extern int cw_addelem_vendor_specific_payload(uint8_t * dst, uint32_t vendorid,
|
||||
uint8_t * data, uint16_t len);
|
||||
|
||||
|
||||
extern void cw_prepare_configuration_status_request(struct conn * conn, struct radioinfo * radioinfo, struct wtpinfo *wtpinfo);
|
||||
|
||||
|
||||
#define cw_addelem_ac_name(dst,name) \
|
||||
|
@ -35,8 +35,10 @@
|
||||
#define CW_CISCO_RAD_SLOT 4
|
||||
#define CW_CISCO_RAD_NAME LW_ELEM_WTP_NAME /* 5 */
|
||||
#define CW_CISCO_MWAR LW_ELEM_AC_DESCRIPTOR /* 6 */
|
||||
#define CW_CISCO_STATION_CFG 8
|
||||
|
||||
#define CWVENDOR_CISCO_BOARD DATA LW_ELEM_WTP_BOARD_DATA /* 50 */
|
||||
#define CW_CISCO_CERTIFICATE LW_ELEM_CERTIFICATE /* 44 */
|
||||
#define CW_CISCO_BOARD DATA LW_ELEM_WTP_BOARD_DATA /* 50 */
|
||||
#define CWVENDER_CISCO_AP_MODE_AND_TYPE 54
|
||||
|
||||
#define CWVENDOR_CISCO_AP_IP_ADDR 83
|
||||
@ -45,7 +47,7 @@
|
||||
|
||||
#define CW_CISCO_AP_GROUP_NAME 123
|
||||
#define CWVENDOR_CISCO_AP_LED_STATE_CONFIG 125
|
||||
#define CW_ELEM_CISCO_AP_REGULATORY_DOMAIN 126
|
||||
#define CW_CISCO_AP_REGULATORY_DOMAIN 126
|
||||
|
||||
#define CWVENDOR_CISCO_AP_PRE_STD_SWITCH_CONFIG 137
|
||||
#define CWVENDOR_CISCO_AP_POWER_INJECTOR_CONFIG 138
|
||||
@ -89,13 +91,25 @@ static inline int cw_addelem_cisco_rad_name(uint8_t * dst, uint8_t * name)
|
||||
* @param name Group name, zero terminated
|
||||
* @return number of bytes put
|
||||
*/
|
||||
static inline int cw_addelem_cisco_ap_group_name(uint8_t * dst, uint8_t * name)
|
||||
{
|
||||
static inline int cw_addelem_cisco_ap_group_name(uint8_t * dst, uint8_t * name){
|
||||
return cw_addelem_vendor_specific_payload(dst, CW_VENDOR_ID_CISCO, CW_CISCO_AP_GROUP_NAME, name,
|
||||
strlen((char *) name));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline int cw_addelem_cisco_ap_regulatory_domain(uint8_t *dst, struct radioinfo * ri){
|
||||
uint8_t *d=dst+10;
|
||||
|
||||
d+=cw_put_byte(d,ri->rid); /* Band ID */
|
||||
d+=cw_put_byte(d,1); /* Set True/False */
|
||||
d+=cw_put_byte(d,ri->rid); /* Slot ID */
|
||||
d+=cw_put_word(d,ri->regDomain);
|
||||
return 5 + cw_put_elem_vendor_hdr(dst, CW_VENDOR_ID_CISCO, CW_CISCO_AP_REGULATORY_DOMAIN, 5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add a Cisco MWAR message element.
|
||||
* @param dst destinnation buffer
|
||||
@ -110,6 +124,25 @@ static inline int cw_addelem_cisco_mwar(uint8_t *dst, struct ac_info *acinfo){
|
||||
return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_MWAR,l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Cisco Certificate payload message element
|
||||
* @param dst destination buffer
|
||||
* @param src pointer to DER certificate
|
||||
* @param len length of certificate
|
||||
* @return number of bytes put
|
||||
*/
|
||||
static inline int cw_addelem_cisco_certificate(uint8_t*dst,uint8_t*src,int len){
|
||||
int l = lw_put_certificate(dst+10,src,len);
|
||||
return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_CERTIFICATE,l);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline int cw_addelem_cisco_station_cfg(uint8_t * dst,struct radioinfo *ri){
|
||||
int l = lw_put_80211_wtp_wlan_radio_configuration(dst+10,ri);
|
||||
return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_STATION_CFG,l);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -133,7 +166,14 @@ static inline int cw_addelem_cisco_mwar(uint8_t *dst, struct ac_info *acinfo){
|
||||
#define cwmsg_addelem_cisco_mwar(cwmsg,acinfo)\
|
||||
(cwmsg)->pos+=cw_addelem_cisco_mwar(((cwmsg)->msgelems+(cwmsg)->pos),(acinfo))
|
||||
|
||||
#define cwmsg_addelem_cisco_certificate(cwmsg,crt,len)\
|
||||
(cwmsg)->pos+=cw_addelem_cisco_certificate(((cwmsg)->msgelems+(cwmsg)->pos),crt,len)
|
||||
|
||||
#define cwmsg_addelem_cisco_ap_regulatory_domain(cwmsg,radioinfo)\
|
||||
(cwmsg)->pos+=cw_addelem_cisco_ap_regulatory_domain(((cwmsg)->msgelems+(cwmsg)->pos),radioinfo)
|
||||
|
||||
#define cwmsg_addelem_cisco_station_cfg(cwmsg,radioinfo)\
|
||||
(cwmsg)->pos+=cw_addelem_cisco_station_cfg(((cwmsg)->msgelems+(cwmsg)->pos),radioinfo)
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,20 +1,29 @@
|
||||
|
||||
#include "capwap.h"
|
||||
#include "lwapp_cisco.h"
|
||||
#include "capwap_cisco.h"
|
||||
|
||||
|
||||
#include "conn.h"
|
||||
#include "wtpinfo.h"
|
||||
|
||||
void cw_prepare_configuration_status_request(struct conn * conn, struct wtpinfo *wtpinfo)
|
||||
void cw_prepare_configuration_status_request(struct conn * conn, struct radioinfo * radioinfo, struct wtpinfo *wtpinfo)
|
||||
{
|
||||
struct cwmsg * cwmsg = &conn->req_msg;
|
||||
uint8_t * buffer = conn->req_buffer;
|
||||
cwmsg_init(cwmsg,buffer,CW_MSG_CONFIGURATION_STATUS_REQUEST,conn_get_next_seqnum(conn),0);
|
||||
|
||||
cwmsg_init(cwmsg,buffer,CW_MSG_CONFIGURATION_STATUS_REQUEST,conn_get_next_seqnum(conn),radioinfo);
|
||||
cwmsg->capwap_mode=conn->capwap_mode;
|
||||
|
||||
cwmsg_addelem_ac_name(cwmsg,(uint8_t *)"AC-iMaxi");
|
||||
|
||||
|
||||
cwmsg_addelem_cisco_ap_regulatory_domain(cwmsg,&wtpinfo->radioinfo[0]);
|
||||
cwmsg_addelem_cisco_ap_regulatory_domain(cwmsg,&wtpinfo->radioinfo[1]);
|
||||
|
||||
cwmsg_addelem_cisco_station_cfg(cwmsg,&wtpinfo->radioinfo[0]);
|
||||
cwmsg_addelem_cisco_station_cfg(cwmsg,&wtpinfo->radioinfo[1]);
|
||||
|
||||
/*
|
||||
uint8_t mtu[2048];
|
||||
int l = lw_put_cisco_path_mtu(mtu,1485,1701);
|
||||
|
@ -44,6 +44,7 @@ void cwmsg_addelem_wtp_board_data(struct cwmsg *cwmsg, struct wtpinfo *wtpinfo)
|
||||
len += add_board_data_subelem(msg+len,CWBOARDDATA_REVISION,wtpinfo->board_revision);
|
||||
|
||||
|
||||
|
||||
if (wtpinfo->macaddress) {
|
||||
*((uint32_t *) (msg + len)) =
|
||||
htonl(CWBOARDDATA_MACADDRESS << 16 | wtpinfo->macaddress_len);
|
||||
|
@ -59,7 +59,7 @@ int cwsend_discovery_request(struct conn *conn, struct radioinfo *radioinfo,
|
||||
|
||||
|
||||
/* radio infos */
|
||||
cwmsg_addelem_wtp_radio_infos(&cwmsg, wtpinfo->radioinfo);
|
||||
// cwmsg_addelem_wtp_radio_infos(&cwmsg, wtpinfo->radioinfo);
|
||||
|
||||
|
||||
/* Non-mandatory elements */
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "acinfo.h" //Tube
|
||||
|
||||
extern int pmu;
|
||||
|
||||
int cwsend_join_request(struct conn *conn, struct radioinfo *radioinfo, struct wtpinfo *wtpinfo)
|
||||
{
|
||||
@ -121,7 +122,11 @@ int cwsend_join_request(struct conn *conn, struct radioinfo *radioinfo, struct w
|
||||
case CWMODE_CISCO:
|
||||
{
|
||||
uint8_t mtu[2048];
|
||||
if(pmu) {
|
||||
int l = lw_put_cisco_path_mtu(mtu,1485,11);
|
||||
}
|
||||
|
||||
//cwmsg_addelem_cisco_certificate(&cwmsg,mtu,10);
|
||||
|
||||
// printf("Len = %d\n",l);
|
||||
|
||||
|
@ -18,6 +18,9 @@ int lw_put_80211_wtp_wlan_radio_configuration(uint8_t*dst,struct radioinfo *ri)
|
||||
lw_put_data(dst+16,ri->country_str,4);
|
||||
lw_put_byte(dst+20,ri->max_bssid);
|
||||
|
||||
return 21;
|
||||
/* XXX not LWAP conform */
|
||||
lw_put_data(dst+21,(uint8_t*)"DEAU990",7);
|
||||
|
||||
return 21+7;
|
||||
}
|
||||
|
||||
|
@ -115,11 +115,19 @@
|
||||
#define LW_ELEM_SUPPORTED_RATES 16
|
||||
#define LW_ELEM_TEST 18
|
||||
|
||||
#define LW_ELEM_CERTIFICATE 44
|
||||
#define LW_ELEM_WTP_BOARD_DATA 50
|
||||
#define LW_ELEM_AP_IP_ADDR 82
|
||||
|
||||
#define LW_ELEM_VENDOR_SPECIFIC 104
|
||||
|
||||
|
||||
|
||||
/* LWAPP IEEE 802.11 bindings */
|
||||
|
||||
#define LW_ELEM_80211_WTP_WLAN_RADIO_CONFIGURATION 8
|
||||
|
||||
|
||||
/* useful macros and inline functions */
|
||||
|
||||
#define lw_foreach_elem(d,msg,len) for(d=msg; d<msg+len; d=d+3+LWMSGELEM_GET_LEN(d))
|
||||
@ -162,6 +170,8 @@ static inline int lw_put_elem_hdr(uint8_t *dst,uint8_t type,uint16_t len)
|
||||
}
|
||||
|
||||
extern int lw_put_cisco_path_mtu(uint8_t *dst, uint16_t max, uint16_t padding);
|
||||
#define lw_put_certificate(dst,cert,len) lw_put_data(dst,cert,len)
|
||||
extern int lw_put_ac_descriptor(uint8_t * dst, struct ac_info * acinfo);
|
||||
|
||||
|
||||
/* function proto types */
|
||||
@ -170,7 +180,8 @@ extern uint16_t lw_checksum(uint8_t *d,int len);
|
||||
extern int lw_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len);
|
||||
extern int lw_readelem_wtp_name(bstr_t * dst, int type, uint8_t * msgelem, int len);
|
||||
|
||||
extern int lw_put_ac_descriptor(uint8_t * dst, struct ac_info * acinfo);
|
||||
|
||||
extern int lw_put_80211_wtp_wlan_radio_configuration(uint8_t*dst,struct radioinfo *ri);
|
||||
|
||||
|
||||
|
||||
|
@ -31,6 +31,17 @@ struct radioinfo{
|
||||
int state;
|
||||
int cause;
|
||||
bstr_t rmac;
|
||||
|
||||
uint16_t regDomain;
|
||||
|
||||
uint8_t country_str[4];
|
||||
int cfp_period;
|
||||
int cfp_max_duration;
|
||||
int beacon_period;
|
||||
int dtim_period;
|
||||
int max_bssid;
|
||||
int occupancy_limit;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -68,6 +68,8 @@ struct wtpinfo{
|
||||
bstr_t session_id;
|
||||
|
||||
|
||||
|
||||
|
||||
struct radioinfo radioinfo[31];
|
||||
|
||||
|
||||
@ -85,6 +87,9 @@ struct wtpinfo{
|
||||
uint16_t encryption_cap;
|
||||
|
||||
|
||||
/** Base MAC address */
|
||||
bstr_t base_mac;
|
||||
|
||||
|
||||
uint8_t * macaddress;
|
||||
int macaddress_len;
|
||||
|
@ -1,13 +1,15 @@
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/conn.h"
|
||||
#include "wtp_interface.h"
|
||||
|
||||
int configure()
|
||||
{
|
||||
sleep(10);
|
||||
struct conn * conn = get_conn();
|
||||
struct wtpinfo * wtpinfo = get_wtpinfo();
|
||||
|
||||
cw_prepare_configuration_status_request(conn,wtpinfo);
|
||||
struct radioinfo *rip = &(wtpinfo->radioinfo[0]);
|
||||
|
||||
cw_prepare_configuration_status_request(conn,rip,wtpinfo);
|
||||
conn_send_request(conn);
|
||||
|
||||
exit(0);
|
||||
|
@ -146,9 +146,10 @@ int wtpconf_name()
|
||||
|
||||
char * default_ac_list[] = {
|
||||
// "192.168.0.255",
|
||||
"255.255.255.255",
|
||||
"255.255.255.255"
|
||||
// "224.0.1.140",
|
||||
//"192.168.0.77"
|
||||
//"192.168.56.99"
|
||||
};
|
||||
|
||||
int wtpconf_ac_list()
|
||||
|
@ -60,6 +60,8 @@ struct wtpinfo * get_wtpinfo()
|
||||
wtpinfo->macaddress_len=conf_macaddress_len;
|
||||
|
||||
|
||||
|
||||
|
||||
wtpinfo->max_msg_len=14000;
|
||||
|
||||
wtpinfo->mac_type=1;
|
||||
|
@ -63,7 +63,7 @@ int main()
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
int pmu;
|
||||
|
||||
//#include <openssl/ssl.h>
|
||||
|
||||
@ -76,6 +76,10 @@ int do_connect(void *priv,void *data)
|
||||
sock_setport(&ip->ip,atoi(conf_control_port));
|
||||
// printf("Would connect to %s\n",str);
|
||||
|
||||
|
||||
printf("Sleep 5000\n");
|
||||
printf("slept\n");
|
||||
|
||||
int rc;
|
||||
rc = join(&ip->ip);
|
||||
if (!rc)
|
||||
@ -83,10 +87,10 @@ int do_connect(void *priv,void *data)
|
||||
|
||||
printf("Sleep after oin\n");
|
||||
printf("Go conf\n");
|
||||
extern struct conn * get_conn();
|
||||
extern join_state(struct conn * conn);
|
||||
struct conn * conn = get_conn();
|
||||
printf("Join conn = %p\n",conn);
|
||||
// extern struct conn * get_conn();
|
||||
// extern join_state(struct conn * conn);
|
||||
// struct conn * conn = get_conn();
|
||||
//printf("Join conn = %p\n",conn);
|
||||
|
||||
// join_state(conn);
|
||||
|
||||
|
@ -1215,16 +1215,20 @@ int wtpdrv_get_num_radios()
|
||||
|
||||
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,0x3a,0x99,0x02,0xfa,0xc0};
|
||||
uint8_t rm[8]={0x68,0x67,0x65,0x64,0x63,0x62};
|
||||
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|=rid+1; //CW_80211_RADIO_TYPE_B; //CWRADIO_TYPE_N;
|
||||
radioinfo->regDomain=1;
|
||||
|
||||
memcpy(radioinfo->country_str,"AUDE",4);
|
||||
|
||||
|
||||
/*
|
||||
struct wpa_driver_ops * drv = wpa_drivers[0];
|
||||
|
Loading…
Reference in New Issue
Block a user