Centralized control of the AC IP address into recv function
This commit is contained in:
parent
00cd4f8511
commit
7b6bd52f48
@ -395,8 +395,23 @@ int wtp_dfa_running(void) {
|
|||||||
} else {
|
} else {
|
||||||
int check;
|
int check;
|
||||||
|
|
||||||
/* Check of packet */
|
/* Retrieve network information */
|
||||||
capwap_get_network_socket(&g_wtp.net, &socket, fds[index].fd);
|
capwap_get_network_socket(&g_wtp.net, &socket, fds[index].fd);
|
||||||
|
|
||||||
|
/* Check source */
|
||||||
|
if (socket.isctrlsocket && (g_wtp.acctrladdress.ss_family != AF_UNSPEC)) {
|
||||||
|
if (capwap_compare_ip(&g_wtp.acctrladdress, &recvfromaddr)) {
|
||||||
|
/* Unknown source */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (!socket.isctrlsocket && (g_wtp.acdataaddress.ss_family != AF_UNSPEC)) {
|
||||||
|
if (capwap_compare_ip(&g_wtp.acdataaddress, &recvfromaddr)) {
|
||||||
|
/* Unknown source */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check of packet */
|
||||||
check = capwap_sanity_check(socket.isctrlsocket, g_wtp.dfa.state, buffer, buffersize, g_wtp.ctrldtls.enable, g_wtp.datadtls.enable);
|
check = capwap_sanity_check(socket.isctrlsocket, g_wtp.dfa.state, buffer, buffersize, g_wtp.ctrldtls.enable, g_wtp.datadtls.enable);
|
||||||
if (check == CAPWAP_DTLS_PACKET) {
|
if (check == CAPWAP_DTLS_PACKET) {
|
||||||
struct capwap_dtls* dtls = (socket.isctrlsocket ? &g_wtp.ctrldtls : &g_wtp.datadtls);
|
struct capwap_dtls* dtls = (socket.isctrlsocket ? &g_wtp.ctrldtls : &g_wtp.datadtls);
|
||||||
|
@ -26,19 +26,17 @@ int wtp_dfa_state_configure(struct capwap_parsed_packet* packet, struct timeout_
|
|||||||
ASSERT(timeout != NULL);
|
ASSERT(timeout != NULL);
|
||||||
|
|
||||||
if (packet) {
|
if (packet) {
|
||||||
if (!capwap_compare_ip(&g_wtp.acctrladdress, &packet->connection->remoteaddr)) {
|
unsigned short binding;
|
||||||
unsigned short binding;
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
||||||
if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CONFIGURATION_STATUS_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) {
|
if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CONFIGURATION_STATUS_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) {
|
||||||
/* Valid packet, free request packet */
|
/* Valid packet, free request packet */
|
||||||
wtp_free_reference_last_request();
|
wtp_free_reference_last_request();
|
||||||
|
|
||||||
/* Parsing response values */
|
/* Parsing response values */
|
||||||
wtp_dfa_change_state(wtp_configure_ac(packet));
|
wtp_dfa_change_state(wtp_configure_ac(packet));
|
||||||
status = WTP_DFA_NO_PACKET;
|
status = WTP_DFA_NO_PACKET;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No Configuration status response received */
|
/* No Configuration status response received */
|
||||||
|
@ -17,33 +17,31 @@ int wtp_dfa_state_datacheck(struct capwap_parsed_packet* packet, struct timeout_
|
|||||||
ASSERT(timeout != NULL);
|
ASSERT(timeout != NULL);
|
||||||
|
|
||||||
if (packet) {
|
if (packet) {
|
||||||
if (!capwap_compare_ip(&g_wtp.acctrladdress, &packet->connection->remoteaddr)) {
|
unsigned short binding;
|
||||||
unsigned short binding;
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
||||||
|
|
||||||
if (packet->rxmngpacket->isctrlpacket) {
|
if (packet->rxmngpacket->isctrlpacket) {
|
||||||
if (binding == g_wtp.binding) {
|
if (binding == g_wtp.binding) {
|
||||||
if (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CHANGE_STATE_EVENT_RESPONSE) {
|
if (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CHANGE_STATE_EVENT_RESPONSE) {
|
||||||
if ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq) {
|
if ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq) {
|
||||||
if (packet->rxmngpacket->packetlength > 0) {
|
if (packet->rxmngpacket->packetlength > 0) {
|
||||||
int a = packet->rxmngpacket->packetlength;
|
int a = packet->rxmngpacket->packetlength;
|
||||||
a++;
|
a++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CHANGE_STATE_EVENT_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) {
|
if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CHANGE_STATE_EVENT_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) {
|
||||||
/* Valid packet, free request packet */
|
/* Valid packet, free request packet */
|
||||||
wtp_free_reference_last_request();
|
wtp_free_reference_last_request();
|
||||||
|
|
||||||
/* Parsing response values */
|
/* Parsing response values */
|
||||||
wtp_dfa_change_state(wtp_datacheck_ac(packet));
|
wtp_dfa_change_state(wtp_datacheck_ac(packet));
|
||||||
status = WTP_DFA_NO_PACKET;
|
status = WTP_DFA_NO_PACKET;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No change state response received */
|
/* No change state response received */
|
||||||
|
@ -126,19 +126,17 @@ int wtp_dfa_state_join(struct capwap_parsed_packet* packet, struct timeout_contr
|
|||||||
ASSERT(timeout != NULL);
|
ASSERT(timeout != NULL);
|
||||||
|
|
||||||
if (packet) {
|
if (packet) {
|
||||||
if (!capwap_compare_ip(&g_wtp.acctrladdress, &packet->connection->remoteaddr)) {
|
unsigned short binding;
|
||||||
unsigned short binding;
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
||||||
if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_JOIN_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) {
|
if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_JOIN_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) {
|
||||||
/* Valid packet, free request packet */
|
/* Valid packet, free request packet */
|
||||||
wtp_free_reference_last_request();
|
wtp_free_reference_last_request();
|
||||||
|
|
||||||
/* Parsing response values */
|
/* Parsing response values */
|
||||||
wtp_dfa_change_state(wtp_join_ac(packet));
|
wtp_dfa_change_state(wtp_join_ac(packet));
|
||||||
status = WTP_DFA_NO_PACKET;
|
status = WTP_DFA_NO_PACKET;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No Join response received */
|
/* No Join response received */
|
||||||
|
Loading…
Reference in New Issue
Block a user