mod_capwap sends correct wtp descriptor now.

FossilOrigin-Name: b1f651a31ae1205d51b70d058e975756b6a302d5c75b5a98e441f3369d5fe5d2
This commit is contained in:
7u83@mail.ru 2016-03-04 21:32:01 +00:00
parent b47702131d
commit d85ef39abe
7 changed files with 40 additions and 14 deletions

View File

@ -20,3 +20,5 @@ CC=clang
COMPDEFS=-DWITH_CW_LOG
COMPDEFS+=-DWITH_CW_LOG_DEBUG

View File

@ -111,8 +111,8 @@ typedef uint8_t *bstr16_t;
#define bstr16_data(s) (((uint8_t*)s)+2)
/**
* Return the actual size of a bstr16_t string. That's the
* this objects needs in memory to be stored.
* Return the actual size of a bstr16_t string. That's the
* size this objects needs in memory to be stored.
*/
#define bstr16_size(l) (l+2)
/**
@ -143,6 +143,8 @@ static inline uint8_t * bstr16_create(uint8_t *data, uint16_t len)
uint8_t * bstr16_create_from_str(const char *s);
extern uint8_t * bstr16_create_from_cfgstr(const char * s);
#define bstr16_replace bstr_replace
/**
*@addtogroup BSTRTypes

View File

@ -219,14 +219,14 @@ static inline int mbag_set_data(mbag_t s, const char *id, const struct mbag_type
static inline bstrv_t mbag_set_bstrv(mbag_t s, const char *id, uint32_t vendor_id,
uint8_t * bstrv, int len)
uint8_t * version, int len)
{
mbag_item_t *i = mbag_item_create(s, id);
if (!i)
return NULL;
i->type = MBAG_VENDORSTR;
i->data = bstrv_create(vendor_id,bstrv,len);
i->data = bstrv_create(vendor_id,version,len);
return i->data;
}

View File

@ -5,7 +5,7 @@ include ../../Config.mak
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I ../../ -I../
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 $(COMPDEFS) -DWITH_RMAC_SUPPORT -I ../../ -I../
LIBDIR=../../lib/$(ARCH)

View File

@ -45,7 +45,9 @@ int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_
cw_log(LOG_ERR, "Can't send Hardware Version in WTP Descriptor, not set.");
}
i = mbag_get(mbag,CW_ITEM_WTP_SOFTWARE_VERSION);
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_WTP_SOFTWARE_VERSION,i->data);
}
@ -53,6 +55,14 @@ int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_
cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set.");
}
i = mbag_get(mbag,CW_ITEM_WTP_BOOTLOADER_VERSION);
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->data);
}
else {
cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set.");
}
int len = d-dst-4;
return len + cw_put_elem_hdr(dst,a->elem_id,len);

View File

@ -179,8 +179,8 @@ int read_config(const char * filename){
str = uci_lookup_option_string(ctx,section,"software_version");
if (str){
uint8_t * s = bstr_create_from_cfgstr(str);
bstr_replace(&conf_software_version,s);
uint8_t * s = bstr16_create_from_cfgstr(str);
bstr16_replace(&conf_software_version,s);
}
str = uci_lookup_option_string(ctx,section,"hardware_version");
@ -191,8 +191,8 @@ int read_config(const char * filename){
str = uci_lookup_option_string(ctx,section,"bootloader_version");
if (str){
uint8_t * s = bstr_create_from_cfgstr(str);
bstr_replace(&conf_bootloader_version,s);
uint8_t * s = bstr16_create_from_cfgstr(str);
bstr16_replace(&conf_bootloader_version,s);
}

View File

@ -172,13 +172,25 @@ mavl_destroy(b);
mbag_set_mbag(conn->config, CW_ITEM_WTP_BOARD_DATA, board_data);
bstrv_t hw =
bstrv_create(conf_vendor_id, bstr16_data(conf_hardware_version),
bstr16_len(conf_hardware_version));
mbag_set_bstrv(conn->config, CW_ITEM_WTP_HARDWARE_VERSION,
0,
bstr16_data(conf_hardware_version),
bstr16_len(conf_hardware_version));
mbag_set_bstrv(conn->config, CW_ITEM_WTP_SOFTWARE_VERSION,
0,
bstr16_data(conf_software_version),
bstr16_len(conf_software_version));
mbag_set_bstrv(conn->config, CW_ITEM_WTP_BOOTLOADER_VERSION,
0,
bstr16_data(conf_bootloader_version),
bstr16_len(conf_bootloader_version));
mbag_set_bstr16(conn->config, CW_ITEM_WTP_HARDWARE_VERSION, hw);
//mbag_set_bstr16(conn->config, CW_ITEM_WTP_SOFTWARE_VERSION,conf_software_version);
// mbag_set_bstrv(conn->config, CW_ITEM_WTP_SOFTWARE_VERSION, sw);
printf("Board_data %p\n", board_data);