mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-05 17:32:54 +03:00
mcast_loop: Drop mcast packet that server sent on different socket
Server enabled for mcast receipt. When the server is acting as a proxy sends a mcast packet out over a slave client type socket, it receives the mcast packet on the server socket (which could then be forward out of the client socket....). This change prevents the server socket from passing up the libcoap stack a mcast packet that it knows the client socket is sending.
This commit is contained in:
1 parent
e220c371be
commit
c2b34daa9b
1 file changed
+13
@@ -1074,6 +1074,19 @@ coap_endpoint_get_session(coap_endpoint_t *endpoint,
|
||||
return session;
|
||||
}
|
||||
|
||||
#if COAP_CLIENT_SUPPORT
|
||||
if (coap_is_mcast(&packet->addr_info.local)) {
|
||||
/* Check if this a proxy client packet we sent on another socket */
|
||||
SESSIONS_ITER(endpoint->context->sessions, session, rtmp) {
|
||||
if (coap_address_equals(&session->addr_info.remote, &packet->addr_info.local) &&
|
||||
coap_address_get_port(&session->addr_info.local) ==
|
||||
coap_address_get_port(&packet->addr_info.remote)) {
|
||||
/* Drop looped back packet to stop recursion / confusion */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* COAP_CLIENT_SUPPORT */
|
||||
SESSIONS_ITER(endpoint->sessions, session, rtmp) {
|
||||
if (session->ref == 0 && session->delayqueue == NULL) {
|
||||
if (session->type == COAP_SESSION_TYPE_SERVER) {
|
||||
|
||||
Reference in new issue
Block a user