drop received packet if it is not received on the correct interface

This commit is contained in:
Olaf Bergmann committed 2014-06-12 01:19:58 +02:00
1 parent 235bf72e90
commit 0dcbf38a20
1 file changed
+6 -1
+6 -1
View File
@@ -849,7 +849,12 @@ coap_read( coap_context_t *ctx ) {
} else {
#ifdef WITH_POSIX
/* FIXME: make sure that dst == ctx->endpoint->addr */
result = coap_handle_message(ctx, ctx->endpoint, packet);
if (coap_address_isany(&ctx->endpoint->addr) ||
coap_address_equals(&packet->dst, &ctx->endpoint->addr)) {
result = coap_handle_message(ctx, ctx->endpoint, packet);
} else {
coap_log(LOG_DEBUG, "packet received on wrong interface, dropped\n");
}
#endif /* WITH_POSIX */
#ifdef WITH_LWIP
result = coap_handle_message(ctx, &src,