Changed name of addr_capwap.socket to addr_capwap.sockaddr
Changed FQDN size from 128 to 256 according to RFC1035
This commit is contained in:
parent
7b9f515bd7
commit
f9bb716dac
@ -11,7 +11,7 @@
|
||||
/* */
|
||||
#define CAPWAP_MACADDRESS_EUI48_BUFFER 18
|
||||
#define CAPWAP_MACADDRESS_EUI64_BUFFER 24
|
||||
#define CAPWAP_MAX_FQDN_SIZE 128
|
||||
#define CAPWAP_MAX_FQDN_SIZE 256
|
||||
|
||||
/* */
|
||||
union sockaddr_capwap {
|
||||
@ -23,7 +23,7 @@ union sockaddr_capwap {
|
||||
|
||||
struct addr_capwap {
|
||||
char fqdn[CAPWAP_MAX_FQDN_SIZE];
|
||||
union sockaddr_capwap socket;
|
||||
union sockaddr_capwap sockaddr;
|
||||
char resolved;
|
||||
};
|
||||
|
||||
|
@ -141,9 +141,9 @@ static void wtp_add_default_acaddress() {
|
||||
/* Broadcast IPv4 */
|
||||
memset(&address, 0, sizeof(struct addr_capwap));
|
||||
address.resolved = 1;
|
||||
address.socket.sin.sin_family = AF_INET;
|
||||
address.socket.sin.sin_addr.s_addr = INADDR_BROADCAST;
|
||||
address.socket.sin.sin_port = htons(CAPWAP_CONTROL_PORT);
|
||||
address.sockaddr.sin.sin_family = AF_INET;
|
||||
address.sockaddr.sin.sin_addr.s_addr = INADDR_BROADCAST;
|
||||
address.sockaddr.sin.sin_port = htons(CAPWAP_CONTROL_PORT);
|
||||
memcpy(capwap_array_get_item_pointer(g_wtp.acdiscoveryarray, g_wtp.acdiscoveryarray->count), &address, sizeof(struct addr_capwap));
|
||||
|
||||
/* Multicast IPv4 */
|
||||
@ -1075,9 +1075,9 @@ static int wtp_parsing_configuration_1_0(config_t* config) {
|
||||
acaddr.resolved = 0;
|
||||
|
||||
/* Parsing address */
|
||||
if (capwap_address_from_string(address, &acaddr.socket)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&acaddr.socket)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&acaddr.socket, CAPWAP_CONTROL_PORT);
|
||||
if (capwap_address_from_string(address, &acaddr.sockaddr)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&acaddr.sockaddr)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&acaddr.sockaddr, CAPWAP_CONTROL_PORT);
|
||||
}
|
||||
acaddr.resolved = 1;
|
||||
g_wtp.discoverytype.type = CAPWAP_DISCOVERYTYPE_TYPE_STATIC;
|
||||
@ -1103,9 +1103,9 @@ static int wtp_parsing_configuration_1_0(config_t* config) {
|
||||
acaddr.resolved = 0;
|
||||
|
||||
/* Parsing address */
|
||||
if (capwap_address_from_string(address, &acaddr.socket)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&acaddr.socket)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&acaddr.socket, CAPWAP_CONTROL_PORT);
|
||||
if (capwap_address_from_string(address, &acaddr.sockaddr)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&acaddr.sockaddr)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&acaddr.sockaddr, CAPWAP_CONTROL_PORT);
|
||||
}
|
||||
acaddr.resolved = 1;
|
||||
} else {
|
||||
|
@ -51,16 +51,16 @@ void wtp_dfa_state_discovery_timeout(struct capwap_timeout* timeout, unsigned lo
|
||||
for (j = 0; j < ((indexpreferred != -1) ? indexpreferred : g_wtp.acpreferedarray->count); j++) {
|
||||
struct addr_capwap* acpreferredaddr = (struct addr_capwap*)capwap_array_get_item_pointer(g_wtp.acpreferedarray, j);
|
||||
if (!acpreferredaddr->resolved) {
|
||||
if (capwap_address_from_string(acpreferredaddr->fqdn, &acpreferredaddr->socket)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&acpreferredaddr->socket)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&acpreferredaddr->socket, CAPWAP_CONTROL_PORT);
|
||||
if (capwap_address_from_string(acpreferredaddr->fqdn, &acpreferredaddr->sockaddr)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&acpreferredaddr->sockaddr)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&acpreferredaddr->sockaddr, CAPWAP_CONTROL_PORT);
|
||||
}
|
||||
acpreferredaddr->resolved = 1;
|
||||
} else {
|
||||
capwap_logging_info("%s:%d Could not resolve application.acprefered.host %s", __FILE__, __LINE__, acpreferredaddr->fqdn);
|
||||
}
|
||||
}
|
||||
if (!capwap_compare_ip(&acpreferredaddr->socket, &checkaddr)) {
|
||||
if (!capwap_compare_ip(&acpreferredaddr->sockaddr, &checkaddr)) {
|
||||
indexpreferred = j;
|
||||
memcpy(&peeraddr, &checkaddr, sizeof(union sockaddr_capwap));
|
||||
break;
|
||||
@ -90,16 +90,16 @@ void wtp_dfa_state_discovery_timeout(struct capwap_timeout* timeout, unsigned lo
|
||||
for (j = 0; j < ((indexpreferred != -1) ? indexpreferred : g_wtp.acpreferedarray->count); j++) {
|
||||
struct addr_capwap* acpreferredaddr = (struct addr_capwap*)capwap_array_get_item_pointer(g_wtp.acpreferedarray, j);
|
||||
if (!acpreferredaddr->resolved) {
|
||||
if (capwap_address_from_string(acpreferredaddr->fqdn, &acpreferredaddr->socket)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&acpreferredaddr->socket)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&acpreferredaddr->socket, CAPWAP_CONTROL_PORT);
|
||||
if (capwap_address_from_string(acpreferredaddr->fqdn, &acpreferredaddr->sockaddr)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&acpreferredaddr->sockaddr)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&acpreferredaddr->sockaddr, CAPWAP_CONTROL_PORT);
|
||||
}
|
||||
acpreferredaddr->resolved = 1;
|
||||
} else {
|
||||
capwap_logging_info("Could not resolve application.acprefered.host %s", acpreferredaddr->fqdn);
|
||||
}
|
||||
}
|
||||
if (!capwap_compare_ip(&acpreferredaddr->socket, &checkaddr)) {
|
||||
if (!capwap_compare_ip(&acpreferredaddr->sockaddr, &checkaddr)) {
|
||||
indexpreferred = j;
|
||||
memcpy(&peeraddr, &checkaddr, sizeof(union sockaddr_capwap));
|
||||
break;
|
||||
@ -203,9 +203,9 @@ void wtp_dfa_state_discovery_timeout(struct capwap_timeout* timeout, unsigned lo
|
||||
for (i = 0; i < g_wtp.acdiscoveryarray->count; i++) {
|
||||
struct addr_capwap* addr = capwap_array_get_item_pointer(g_wtp.acdiscoveryarray, i);
|
||||
if (!addr->resolved) {
|
||||
if (capwap_address_from_string(addr->fqdn, &addr->socket)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&addr->socket)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&addr->socket, CAPWAP_CONTROL_PORT);
|
||||
if (capwap_address_from_string(addr->fqdn, &addr->sockaddr)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&addr->sockaddr)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&addr->sockaddr, CAPWAP_CONTROL_PORT);
|
||||
}
|
||||
addr->resolved = 1;
|
||||
g_wtp.discoverytype.type = CAPWAP_DISCOVERYTYPE_TYPE_STATIC;
|
||||
@ -213,7 +213,7 @@ void wtp_dfa_state_discovery_timeout(struct capwap_timeout* timeout, unsigned lo
|
||||
capwap_logging_info("%s:%d Could not resolve application.acdiscovery.host %s", __FILE__, __LINE__, addr->fqdn);
|
||||
}
|
||||
}
|
||||
if (!capwap_sendto_fragmentpacket(g_wtp.net.socket, g_wtp.requestfragmentpacket, &addr->socket)) {
|
||||
if (!capwap_sendto_fragmentpacket(g_wtp.net.socket, g_wtp.requestfragmentpacket, &addr->sockaddr)) {
|
||||
capwap_logging_info("Error to send discovery request packet");
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ static int wtp_join_prefered_ac()
|
||||
}
|
||||
|
||||
if(!peeraddr->resolved) {
|
||||
if (capwap_address_from_string(peeraddr->fqdn, &peeraddr->socket)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&peeraddr->socket)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&peeraddr->socket, CAPWAP_CONTROL_PORT);
|
||||
if (capwap_address_from_string(peeraddr->fqdn, &peeraddr->sockaddr)) {
|
||||
if (!CAPWAP_GET_NETWORK_PORT(&peeraddr->sockaddr)) {
|
||||
CAPWAP_SET_NETWORK_PORT(&peeraddr->sockaddr, CAPWAP_CONTROL_PORT);
|
||||
}
|
||||
peeraddr->resolved = 1;
|
||||
} else {
|
||||
@ -40,7 +40,7 @@ static int wtp_join_prefered_ac()
|
||||
}
|
||||
}
|
||||
|
||||
if (capwap_connect_socket(&g_wtp.net, &peeraddr->socket) < 0) {
|
||||
if (capwap_connect_socket(&g_wtp.net, &peeraddr->sockaddr) < 0) {
|
||||
capwap_logging_fatal("Cannot bind control address");
|
||||
capwap_close_sockets(&g_wtp.net);
|
||||
return -1;
|
||||
@ -54,7 +54,7 @@ static int wtp_join_prefered_ac()
|
||||
}
|
||||
|
||||
/* */
|
||||
capwap_crypt_setconnection(&g_wtp.dtls, g_wtp.net.socket, &localaddr, &peeraddr->socket);
|
||||
capwap_crypt_setconnection(&g_wtp.dtls, g_wtp.net.socket, &localaddr, &peeraddr->sockaddr);
|
||||
|
||||
/* */
|
||||
if (!g_wtp.enabledtls) {
|
||||
|
Loading…
Reference in New Issue
Block a user