Skip to content

Commit 8a166dd

Browse files
authored
Fix IPv6-only builds where platform LwIP has IPv4 (#10879)
#### Problem When LwIP is configured for IPv6 only, its type `ip_addr_t` is identical to `ip6_addr_t`; otherwise they are different. PR #10791 made the incorrect assumption that we would never build CHIP without IPv4 when then platform LwIP is configured with IPv4, and left out the constructor overload necessary for that case. #### Change overview Enable the `ip_addr_t` constructor if `LWIP_IPV4` is true. #### Testing Built ``` scripts/build/build_examples.py \ --target esp32-m5stack-all-clusters-ipv6only build` ```
1 parent b1fcb67 commit 8a166dd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/inet/IPAddress.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ IPAddress::IPAddress(const ip6_addr_t & ipv6Addr)
7676
memcpy(Addr, &ipv6Addr, sizeof(ipv6Addr));
7777
}
7878

79-
#if INET_CONFIG_ENABLE_IPV4
79+
#if INET_CONFIG_ENABLE_IPV4 || LWIP_IPV4
8080

8181
IPAddress::IPAddress(const ip4_addr_t & ipv4Addr)
8282
{
@@ -106,6 +106,10 @@ IPAddress::IPAddress(const ip_addr_t & addr)
106106
}
107107
}
108108

109+
#endif // INET_CONFIG_ENABLE_IPV4 || LWIP_IPV4
110+
111+
#if INET_CONFIG_ENABLE_IPV4
112+
109113
ip4_addr_t IPAddress::ToIPv4() const
110114
{
111115
ip4_addr_t ipAddr;

src/inet/IPAddress.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class DLL_EXPORT IPAddress
147147

148148
#if CHIP_SYSTEM_CONFIG_USE_LWIP
149149
explicit IPAddress(const ip6_addr_t & ipv6Addr);
150-
#if INET_CONFIG_ENABLE_IPV4
150+
#if INET_CONFIG_ENABLE_IPV4 || LWIP_IPV4
151151
explicit IPAddress(const ip4_addr_t & ipv4Addr);
152152
explicit IPAddress(const ip_addr_t & addr);
153153
#endif // INET_CONFIG_ENABLE_IPV4

0 commit comments

Comments
 (0)