Centralized control of the AC IP address into recv function

This commit is contained in:
vemax78 2013-06-09 21:49:43 +02:00
parent 00cd4f8511
commit 7b6bd52f48
4 changed files with 52 additions and 43 deletions

View File

@ -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);

View File

@ -26,7 +26,6 @@ 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;
/* */ /* */
@ -39,7 +38,6 @@ int wtp_dfa_state_configure(struct capwap_parsed_packet* packet, struct timeout_
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 */
g_wtp.dfa.rfcRetransmitCount++; g_wtp.dfa.rfcRetransmitCount++;

View File

@ -17,7 +17,6 @@ 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;
/* */ /* */
@ -44,7 +43,6 @@ int wtp_dfa_state_datacheck(struct capwap_parsed_packet* packet, struct timeout_
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 */
g_wtp.dfa.rfcRetransmitCount++; g_wtp.dfa.rfcRetransmitCount++;

View File

@ -126,7 +126,6 @@ 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;
/* */ /* */
@ -139,7 +138,6 @@ int wtp_dfa_state_join(struct capwap_parsed_packet* packet, struct timeout_contr
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 */
g_wtp.dfa.rfcRetransmitCount++; g_wtp.dfa.rfcRetransmitCount++;