rework socket and discovery handling

Swtich sockets to connected when talking to a specific AC. Use
unconnected UDP sockets only during DISCOVERY.

In JOIN, we need send our local address. The old, routing table
based local address discovery is broken for many reasons (VRF,
policy routing, ...). With a connected socket, we can the same
information with a simple getsockname.

During DISCOVERY we are talking to all potential AC's at once.
So using an unconnected socket makes still sense.
This commit is contained in:
Andreas Schultz
2016-03-02 15:13:56 +01:00
parent 067eb8d11a
commit 8dc30ae3c4
5 changed files with 121 additions and 46 deletions

View File

@ -363,8 +363,9 @@ int wtp_dfa_running(void) {
int check;
/* Check source */
if (capwap_compare_ip(&g_wtp.dtls.peeraddr, &fromaddr)) {
capwap_logging_debug("WTP compare failed, drop packet");
if (g_wtp.state != CAPWAP_DISCOVERY_STATE &&
capwap_compare_ip(&g_wtp.dtls.peeraddr, &fromaddr)) {
capwap_logging_debug("CAPWAP packet from unknown WTP when not in DISCOVERY, drop packet");
continue; /* Unknown source */
}