2015-05-11 21:58:17 +02:00
|
|
|
|
2016-04-11 03:29:06 +02:00
|
|
|
#include "cw/action.h"
|
|
|
|
#include "cw/dbg.h"
|
|
|
|
#include "cw/log.h"
|
|
|
|
#include "cw/mbag.h"
|
|
|
|
#include "cw/cw.h"
|
|
|
|
#include "cw/capwap_items.h"
|
2015-05-11 21:58:17 +02:00
|
|
|
|
2016-04-11 03:29:06 +02:00
|
|
|
#include "cisco_items.h"
|
2015-05-11 21:58:17 +02:00
|
|
|
|
|
|
|
int cw_cisco_get_wlan_legacy(mbag_t wlan, uint8_t *data, int len)
|
|
|
|
{
|
|
|
|
mbag_set_word(wlan,"enc_capab", cw_get_word(data+1));
|
|
|
|
|
|
|
|
int wlan_id=cw_get_word(data+3);
|
|
|
|
mbag_set_word(wlan,"wlan_id",wlan_id);
|
|
|
|
|
|
|
|
mbag_set_dword(wlan,"enc_policy",cw_get_dword(data+5));
|
|
|
|
mbag_set_bstr16n(wlan,"key",data+9,32);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"key_index",cw_get_byte(data+41));
|
|
|
|
mbag_set_byte(wlan,"key_shared",cw_get_byte(data+42));
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"wpa_len",cw_get_byte(data+43));
|
|
|
|
mbag_set_bstr16n(wlan,"wpa_data",data+44,32);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"rsn_len",cw_get_byte(data+76));
|
|
|
|
mbag_set_bstr16n(wlan,"rsn_data",data+77,64);
|
|
|
|
|
|
|
|
mbag_set_bstr16n(wlan,"reserved",data+141,49);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"wme_len",cw_get_byte(data+190));
|
|
|
|
mbag_set_bstr16n(wlan,"wme_data",data+191,32);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"dot11e_len",cw_get_byte(data+223));
|
|
|
|
mbag_set_bstr16n(wlan,"dot11e_data",data+224,32);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"qos",cw_get_byte(data+256));
|
|
|
|
|
|
|
|
// mbag_set_byte(wlan,"ssid_broadcast",cw_get_byte(data+257));
|
|
|
|
mbag_set_byte(wlan,"ssid_broadcast",cw_get_byte(data+435));
|
|
|
|
mbag_set_byte(wlan,"aironet_ie",cw_get_byte(data+436));
|
|
|
|
|
|
|
|
mbag_set_bstr16n(wlan,"reserved2",data+258,40);
|
|
|
|
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"dtim_period",cw_get_byte(data+554));
|
|
|
|
mbag_set_bstr16n(wlan,"wlan_name",data+558,32);
|
|
|
|
mbag_set_byte(wlan,"allow_aaa_override",cw_get_byte(data+591));
|
|
|
|
mbag_set_byte(wlan,"max_clients",cw_get_byte(data+593));
|
|
|
|
|
|
|
|
|
|
|
|
mbag_set_bstr16n(wlan,"ssid",data+622,len-622);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-17 08:36:41 +02:00
|
|
|
int cw_cisco_get_wlan_(mbag_t wlan, uint8_t *data, int len)
|
|
|
|
{
|
|
|
|
mbag_set_word(wlan,"enc_capab", cw_get_word(data+1));
|
|
|
|
|
|
|
|
int wlan_id=cw_get_word(data+3);
|
|
|
|
mbag_set_word(wlan,"wlan_id",wlan_id);
|
|
|
|
|
|
|
|
mbag_set_dword(wlan,"enc_policy",cw_get_dword(data+5));
|
|
|
|
mbag_set_bstr16n(wlan,"key",data+9,32);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"key_index",cw_get_byte(data+41));
|
|
|
|
mbag_set_byte(wlan,"key_shared",cw_get_byte(data+42));
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"wpa_len",cw_get_byte(data+43));
|
|
|
|
mbag_set_bstr16n(wlan,"wpa_data",data+44,32);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"rsn_len",cw_get_byte(data+76));
|
|
|
|
mbag_set_bstr16n(wlan,"rsn_data",data+77,64);
|
|
|
|
|
|
|
|
mbag_set_bstr16n(wlan,"reserved",data+141,49);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"wme_len",cw_get_byte(data+190));
|
|
|
|
mbag_set_bstr16n(wlan,"wme_data",data+191,32);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"dot11e_len",cw_get_byte(data+223));
|
|
|
|
mbag_set_bstr16n(wlan,"dot11e_data",data+224,32);
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"qos",cw_get_byte(data+256));
|
|
|
|
|
|
|
|
// mbag_set_byte(wlan,"ssid_broadcast",cw_get_byte(data+257));
|
|
|
|
mbag_set_byte(wlan,"ssid_broadcast",cw_get_byte(data+435));
|
|
|
|
mbag_set_byte(wlan,"aironet_ie",cw_get_byte(data+436));
|
|
|
|
|
|
|
|
mbag_set_bstr16n(wlan,"reserved2",data+258,40);
|
|
|
|
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"dtim_period",cw_get_byte(data+554));
|
|
|
|
mbag_set_bstr16n(wlan,"wlan_name",data+558,32);
|
|
|
|
mbag_set_byte(wlan,"allow_aaa_override",cw_get_byte(data+591));
|
|
|
|
mbag_set_byte(wlan,"max_clients",cw_get_byte(data+593));
|
|
|
|
|
|
|
|
|
|
|
|
mbag_set_bstr16n(wlan,"ssid",data+622,len-622);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-11 21:58:17 +02:00
|
|
|
|
2016-04-11 03:29:06 +02:00
|
|
|
int cisco_in_add_wlan(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
2015-05-11 21:58:17 +02:00
|
|
|
struct sockaddr *from)
|
|
|
|
{
|
2018-02-22 23:04:15 +01:00
|
|
|
int pos=0;
|
|
|
|
|
2018-02-20 07:49:17 +01:00
|
|
|
cw_dbg (DBG_X,"Add WLAN");
|
|
|
|
|
2015-05-11 21:58:17 +02:00
|
|
|
int rid = cw_get_byte(data);
|
2018-02-22 23:04:15 +01:00
|
|
|
cw_dbg (DBG_X, "Radio ID = %d",rid);
|
2018-02-20 07:49:17 +01:00
|
|
|
|
|
|
|
bstr_t mac = bstr_create(data+1,6);
|
|
|
|
cw_dbg (DBG_X, "MAC: %s",sock_hwaddr2str(bstr_data(mac),bstr_len(mac)));
|
2018-02-22 23:04:15 +01:00
|
|
|
|
|
|
|
int wid = cw_get_word(data+1+6);
|
|
|
|
cw_dbg (DBG_X, "WLAN ID = %d",wid);
|
|
|
|
|
|
|
|
char * ssid=cw_get_str(data+1+6+2+1,16);
|
|
|
|
cw_dbg (DBG_X, "SSID = %s",ssid);
|
2018-02-20 07:49:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
2015-05-11 21:58:17 +02:00
|
|
|
mbag_t wlan = mbag_i_get_mbag(conn->radios,rid,NULL);
|
|
|
|
if ( !wlan ) {
|
|
|
|
printf("No Radio git\n");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mbag_set_byte(wlan,"radio_id",rid);
|
|
|
|
|
|
|
|
|
2016-04-11 03:29:06 +02:00
|
|
|
int mytype=mbag_get_byte(conn->config,CISCO_ITEM_AP_MODE_AND_TYPE,77) & 0xff;
|
2015-05-17 08:36:41 +02:00
|
|
|
|
|
|
|
printf("My type: %d\n",mytype);
|
|
|
|
exit(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-11 21:58:17 +02:00
|
|
|
cw_cisco_get_wlan_legacy(wlan,data,len);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|