Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allocate large enough IP Address array for discovered devices #109

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ + (DiscoveredNodeData *)convertToObjCDiscoveredNodeDataFrom:(const chip::Dnssd::
}
for (size_t i = 0; i < cppDiscoveredNodedata->resolutionData.numIPs; i++) {
char addrCString[chip::Inet::IPAddress::kMaxStringLength];
cppDiscoveredNodedata->resolutionData.ipAddress->ToString(addrCString, chip::Inet::IPAddress::kMaxStringLength);
cppDiscoveredNodedata->resolutionData.ipAddress[i].ToString(addrCString, chip::Inet::IPAddress::kMaxStringLength);
objCDiscoveredNodeData.ipAddresses[i] = [NSString stringWithCString:addrCString encoding:NSASCIIStringEncoding];
}
return objCDiscoveredNodeData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1

#define CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES 10

#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1

#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 41 // 0x0029 = 41 = Matter Casting Video Client
Expand Down
9 changes: 9 additions & 0 deletions src/include/platform/CHIPDeviceConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,15 @@
#define CHIP_DEVICE_CONFIG_EXTENDED_DISCOVERY_TIMEOUT_SECS (15 * 60)
#endif

/**
* CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES
*
* Maximum number of IP Addresses stored for a discovered node
*/
#ifndef CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES
#define CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES 5
#endif

/**
* CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE
*
Expand Down
3 changes: 1 addition & 2 deletions src/lib/dnssd/Resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ namespace Dnssd {
/// Node resolution data common to both operational and commissionable discovery
struct CommonResolutionData
{
// TODO: is this count OK? Sufficient space for IPv6 LL, GUA, ULA (and maybe IPv4 if enabled)
static constexpr unsigned kMaxIPAddresses = 5;
static constexpr unsigned kMaxIPAddresses = CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES;

Inet::InterfaceId interfaceId;

Expand Down