From 00326bc220b57e9605c2b1f5abce8058973271a8 Mon Sep 17 00:00:00 2001 From: rosahay-silabs Date: Thu, 30 Jun 2022 03:48:10 +0530 Subject: [PATCH 1/5] Adds fix for IPV6 multicast --- src/inet/UDPEndPointImplLwIP.cpp | 2 +- src/lwip/efr32/lwipopts-rs911x.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/inet/UDPEndPointImplLwIP.cpp b/src/inet/UDPEndPointImplLwIP.cpp index b3ce8a24705eb1..62a2a5549e18ef 100644 --- a/src/inet/UDPEndPointImplLwIP.cpp +++ b/src/inet/UDPEndPointImplLwIP.cpp @@ -133,7 +133,7 @@ CHIP_ERROR UDPEndPointImplLwIP::LwIPBindInterface(struct udp_pcb * aUDP, Interfa InterfaceId UDPEndPointImplLwIP::GetBoundInterface() const { #if HAVE_LWIP_UDP_BIND_NETIF - return InterfaceId(netif_get_by_index(mUDP->netif_idx)); + return InterfaceId(netif_get_by_index(mUDP->netif_idx + 1)); #else return InterfaceId(mUDP->intf_filter); #endif diff --git a/src/lwip/efr32/lwipopts-rs911x.h b/src/lwip/efr32/lwipopts-rs911x.h index 5f84181387a69f..c866909e8d5a71 100644 --- a/src/lwip/efr32/lwipopts-rs911x.h +++ b/src/lwip/efr32/lwipopts-rs911x.h @@ -101,6 +101,7 @@ #define LWIP_IPV6_AUTOCONFIG (1) #define LWIP_IPV6_ROUTER_SUPPORT 1 #define LWIP_ND6_LISTEN_RA 1 +#define LWIP_IPV6_MLD 1 #define LWIP_ND6_NUM_NEIGHBORS (2) #define LWIP_ND6_NUM_DESTINATIONS (3) @@ -150,9 +151,7 @@ #define LWIP_IPV6_NUM_ADDRESSES 5 -#ifndef LWIP_IPV6_ND #define LWIP_IPV6_ND 1 -#endif #define LWIP_ND6_QUEUEING 1 #define LWIP_NUM_ND6_QUEUE 3 From bb884f207199dd40ed6df2263934def3fde730de Mon Sep 17 00:00:00 2001 From: rosahay-silabs Date: Thu, 30 Jun 2022 19:44:09 +0530 Subject: [PATCH 2/5] Revert LwIP options --- src/lwip/efr32/lwipopts-rs911x.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lwip/efr32/lwipopts-rs911x.h b/src/lwip/efr32/lwipopts-rs911x.h index c866909e8d5a71..5f84181387a69f 100644 --- a/src/lwip/efr32/lwipopts-rs911x.h +++ b/src/lwip/efr32/lwipopts-rs911x.h @@ -101,7 +101,6 @@ #define LWIP_IPV6_AUTOCONFIG (1) #define LWIP_IPV6_ROUTER_SUPPORT 1 #define LWIP_ND6_LISTEN_RA 1 -#define LWIP_IPV6_MLD 1 #define LWIP_ND6_NUM_NEIGHBORS (2) #define LWIP_ND6_NUM_DESTINATIONS (3) @@ -151,7 +150,9 @@ #define LWIP_IPV6_NUM_ADDRESSES 5 +#ifndef LWIP_IPV6_ND #define LWIP_IPV6_ND 1 +#endif #define LWIP_ND6_QUEUEING 1 #define LWIP_NUM_ND6_QUEUE 3 From 17fba74f5c4de89e9f3d68a366d8f71827d1f40e Mon Sep 17 00:00:00 2001 From: rosahay-silabs Date: Thu, 30 Jun 2022 19:45:37 +0530 Subject: [PATCH 3/5] Adds fix for warning on ESP32 toolchain --- src/inet/UDPEndPointImplLwIP.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inet/UDPEndPointImplLwIP.cpp b/src/inet/UDPEndPointImplLwIP.cpp index 62a2a5549e18ef..a81b3922492ce2 100644 --- a/src/inet/UDPEndPointImplLwIP.cpp +++ b/src/inet/UDPEndPointImplLwIP.cpp @@ -133,7 +133,7 @@ CHIP_ERROR UDPEndPointImplLwIP::LwIPBindInterface(struct udp_pcb * aUDP, Interfa InterfaceId UDPEndPointImplLwIP::GetBoundInterface() const { #if HAVE_LWIP_UDP_BIND_NETIF - return InterfaceId(netif_get_by_index(mUDP->netif_idx + 1)); + return InterfaceId(netif_get_by_index(++(mUDP->netif_idx))); #else return InterfaceId(mUDP->intf_filter); #endif From 1942083751b43274ef2cc9e1550941dece5a538b Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 6 Jul 2022 16:13:06 +0000 Subject: [PATCH 4/5] Restyled by astyle --- src/inet/UDPEndPointImplLwIP.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/inet/UDPEndPointImplLwIP.cpp b/src/inet/UDPEndPointImplLwIP.cpp index a81b3922492ce2..4148f1642cabbe 100644 --- a/src/inet/UDPEndPointImplLwIP.cpp +++ b/src/inet/UDPEndPointImplLwIP.cpp @@ -47,7 +47,7 @@ static_assert(LWIP_VERSION_MAJOR > 1, "CHIP requires LwIP 2.0 or later"); #else #define HAVE_LWIP_MULTICAST_LOOP 1 #endif // !defined(RAW_FLAGS_MULTICAST_LOOP) || !defined(UDP_FLAGS_MULTICAST_LOOP) || !defined(raw_clear_flags) || - // !defined(raw_set_flags) || !defined(udp_clear_flags) || !defined(udp_set_flags) +// !defined(raw_set_flags) || !defined(udp_clear_flags) || !defined(udp_set_flags) // unusual define check for LWIP_IPV6_ND is because espressif fork // of LWIP does not define the _ND constant. @@ -63,7 +63,7 @@ namespace chip { namespace Inet { CHIP_ERROR UDPEndPointImplLwIP::BindImpl(IPAddressType addressType, const IPAddress & address, uint16_t port, - InterfaceId interfaceId) + InterfaceId interfaceId) { // Lock LwIP stack LOCK_TCPIP_CORE(); @@ -262,7 +262,7 @@ void UDPEndPointImplLwIP::HandleDataReceived(System::PacketBufferHandle && msg) if (pktInfo != nullptr) { const IPPacketInfo pktInfoCopy = *pktInfo; // copy the address info so that the app can free the - // PacketBuffer without affecting access to address info. + // PacketBuffer without affecting access to address info. OnMessageReceived(this, std::move(msg), &pktInfoCopy); } else @@ -337,7 +337,7 @@ CHIP_ERROR UDPEndPointImplLwIP::GetPCB(IPAddressType addrType) } void UDPEndPointImplLwIP::LwIPReceiveUDPMessage(void * arg, struct udp_pcb * pcb, struct pbuf * p, const ip_addr_t * addr, - u16_t port) + u16_t port) { UDPEndPointImplLwIP * ep = static_cast(arg); IPPacketInfo * pktInfo = nullptr; From d051a88767c7847ae9b6c472905cfcffe56eabc0 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 6 Jul 2022 16:13:27 +0000 Subject: [PATCH 5/5] Restyled by clang-format --- src/inet/UDPEndPointImplLwIP.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inet/UDPEndPointImplLwIP.cpp b/src/inet/UDPEndPointImplLwIP.cpp index 4148f1642cabbe..aa002a0c0a42ed 100644 --- a/src/inet/UDPEndPointImplLwIP.cpp +++ b/src/inet/UDPEndPointImplLwIP.cpp @@ -63,7 +63,7 @@ namespace chip { namespace Inet { CHIP_ERROR UDPEndPointImplLwIP::BindImpl(IPAddressType addressType, const IPAddress & address, uint16_t port, - InterfaceId interfaceId) + InterfaceId interfaceId) { // Lock LwIP stack LOCK_TCPIP_CORE(); @@ -337,7 +337,7 @@ CHIP_ERROR UDPEndPointImplLwIP::GetPCB(IPAddressType addrType) } void UDPEndPointImplLwIP::LwIPReceiveUDPMessage(void * arg, struct udp_pcb * pcb, struct pbuf * p, const ip_addr_t * addr, - u16_t port) + u16_t port) { UDPEndPointImplLwIP * ep = static_cast(arg); IPPacketInfo * pktInfo = nullptr;