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 {
int check;
/* Check of packet */
/* Retrieve network information */
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);
if (check == CAPWAP_DTLS_PACKET) {
struct capwap_dtls* dtls = (socket.isctrlsocket ? &g_wtp.ctrldtls : &g_wtp.datadtls);