From 8b5356fb618d8e3270e9fbc8a4321e3da658f1eb Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Fri, 14 Jul 2023 16:30:27 +0000 Subject: [PATCH] esp-idf: Fixes for ESP-IDF environment --- src/coap_address.c | 6 +++--- src/coap_net.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/coap_address.c b/src/coap_address.c index 81d6e426..03deb0ab 100644 --- a/src/coap_address.c +++ b/src/coap_address.c @@ -139,7 +139,7 @@ coap_is_mcast(const coap_address_t *a) { return 0; } -#if !defined(WIN32) +#if !defined(WIN32) && !defined(ESPIDF_VERSION) #ifndef COAP_BCST_CNT #define COAP_BCST_CNT 6 @@ -228,13 +228,13 @@ coap_is_bcast(const coap_address_t *a) { return 0; #endif /* COAP_IPV4_SUPPORT */ } -#else /* WIN32 */ +#else /* WIN32 || ESPIDF_VERSION */ int coap_is_bcast(const coap_address_t *a) { (void)a; return 0; } -#endif /* WIN32 */ +#endif /* WIN32 || ESPIDF_VERSION */ #endif /* !defined(WITH_CONTIKI) && !defined(WITH_LWIP) */ diff --git a/src/coap_net.c b/src/coap_net.c index 54ef7339..e8d8bafc 100644 --- a/src/coap_net.c +++ b/src/coap_net.c @@ -4043,7 +4043,9 @@ coap_join_mcast_group_intf(coap_context_t *ctx, const char *group_name, #if COAP_IPV4_SUPPORT struct ip_mreq mreq4; #endif /* COAP_IPV4_SUPPORT */ +#if COAP_IPV6_SUPPORT struct ipv6_mreq mreq6; +#endif /* COAP_IPV6_SUPPORT */ struct addrinfo *resmulti = NULL, hints, *ainfo; int result = -1; coap_endpoint_t *endpoint; @@ -4055,7 +4057,9 @@ coap_join_mcast_group_intf(coap_context_t *ctx, const char *group_name, return -1; /* Default is let the kernel choose */ +#if COAP_IPV6_SUPPORT mreq6.ipv6mr_interface = 0; +#endif /* COAP_IPV6_SUPPORT */ #if COAP_IPV4_SUPPORT mreq4.imr_interface.s_addr = INADDR_ANY; #endif /* COAP_IPV4_SUPPORT */