If not set into wtp.conf the client bind to any port
This commit is contained in:
15
src/ac/ac.c
15
src/ac/ac.c
@ -20,10 +20,11 @@ static int ac_init(void) {
|
||||
capwap_network_init(&g_ac.net);
|
||||
g_ac.mtu = CAPWAP_MTU_DEFAULT;
|
||||
g_ac.binding = capwap_array_create(sizeof(unsigned short), 0);
|
||||
|
||||
g_ac.net.bind_sock_ctrl_port = CAPWAP_CONTROL_PORT;
|
||||
|
||||
/* Standard name */
|
||||
strcpy((char*)g_ac.acname.name, AC_STANDARD_NAME);
|
||||
|
||||
|
||||
/* Descriptor */
|
||||
g_ac.descriptor.stationlimit = AC_DEFAULT_MAXSTATION;
|
||||
g_ac.descriptor.maxwtp = AC_DEFAULT_MAXSESSIONS;
|
||||
@ -477,6 +478,16 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Set network port of WTP */
|
||||
if (config_lookup_int(config, "application.network.port", &configLongInt) == CONFIG_TRUE) {
|
||||
if ((configLongInt > 0) && (configLongInt < 65535)) {
|
||||
g_ac.net.bind_sock_ctrl_port = (unsigned short)configLongInt;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, invalid application.network.port value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set transport of AC */
|
||||
if (config_lookup_string(config, "application.network.transport", &configString) == CONFIG_TRUE) {
|
||||
if (!strcmp(configString, "udp")) {
|
||||
|
@ -625,7 +625,7 @@ void* ac_session_thread(void* param) {
|
||||
void ac_get_control_information(struct capwap_list* controllist) {
|
||||
struct capwap_list* addrlist;
|
||||
struct capwap_list_item* item;
|
||||
|
||||
|
||||
ASSERT(controllist != NULL);
|
||||
|
||||
/* Detect local address */
|
||||
@ -646,22 +646,22 @@ void ac_get_control_information(struct capwap_list* controllist) {
|
||||
|
||||
/* Add */
|
||||
capwap_itemlist_insert_after(controllist, NULL, itemcontrol);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free local address list */
|
||||
capwap_list_free(addrlist);
|
||||
|
||||
|
||||
/* */
|
||||
capwap_lock_enter(&g_ac.sessionslock);
|
||||
|
||||
|
||||
/* Get wtp count from any local address */
|
||||
for (item = controllist->first; item != NULL; item = item->next) {
|
||||
struct capwap_list_item* search;
|
||||
struct ac_session_control* sessioncontrol = (struct ac_session_control*)item->item;
|
||||
|
||||
|
||||
for (search = g_ac.sessions->first; search != NULL; search = search->next) {
|
||||
struct ac_session_t* session = (struct ac_session_t*)search->item;
|
||||
|
||||
|
||||
if (!capwap_compare_ip(&session->acctrladdress, &sessioncontrol->localaddress)) {
|
||||
sessioncontrol->count++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user