From 249772072648517b3b98df28b13c39a4b9bf1455 Mon Sep 17 00:00:00 2001 From: Sharad Binjola <31142146+sharadb-amazon@users.noreply.github.com> Date: Thu, 6 Apr 2023 07:31:10 -0700 Subject: [PATCH] Allowing for CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES to be set in (#25994) --- examples/tv-casting-app/android/args.gni | 2 ++ .../MatterTvCastingBridge/ConversionUtils.mm | 2 +- examples/tv-casting-app/darwin/args.gni | 2 ++ examples/tv-casting-app/linux/args.gni | 2 ++ src/lib/dnssd/Resolver.h | 3 +-- src/platform/BUILD.gn | 5 +++++ 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/examples/tv-casting-app/android/args.gni b/examples/tv-casting-app/android/args.gni index e3a20c5055dd91..cf7e1648cc6674 100644 --- a/examples/tv-casting-app/android/args.gni +++ b/examples/tv-casting-app/android/args.gni @@ -31,3 +31,5 @@ chip_enable_additional_data_advertising = true chip_enable_rotating_device_id = true chip_config_network_layer_ble = false + +chip_max_discovered_ip_addresses = 20 diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm index 74f41c5203d022..a50195987c89ff 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm @@ -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; diff --git a/examples/tv-casting-app/darwin/args.gni b/examples/tv-casting-app/darwin/args.gni index 64353389c5285f..6f60b6971692f3 100644 --- a/examples/tv-casting-app/darwin/args.gni +++ b/examples/tv-casting-app/darwin/args.gni @@ -31,3 +31,5 @@ chip_enable_additional_data_advertising = true chip_enable_rotating_device_id = true chip_config_network_layer_ble = false + +chip_max_discovered_ip_addresses = 20 diff --git a/examples/tv-casting-app/linux/args.gni b/examples/tv-casting-app/linux/args.gni index 3175a832930e5e..f882ed23024643 100644 --- a/examples/tv-casting-app/linux/args.gni +++ b/examples/tv-casting-app/linux/args.gni @@ -29,3 +29,5 @@ chip_build_libshell = true chip_enable_additional_data_advertising = true chip_enable_rotating_device_id = true + +chip_max_discovered_ip_addresses = 20 diff --git a/src/lib/dnssd/Resolver.h b/src/lib/dnssd/Resolver.h index 5f48378bd01d4e..eecf21db306fa2 100644 --- a/src/lib/dnssd/Resolver.h +++ b/src/lib/dnssd/Resolver.h @@ -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; diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index ac478a14d0ce52..678cbb8778fc79 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -65,6 +65,9 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { # The string of device software version was built. chip_device_config_device_software_version_string = "" + + # Define the default number of ip addresses to discover + chip_max_discovered_ip_addresses = 5 } if (chip_stack_lock_tracking == "auto") { @@ -291,6 +294,8 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { if (chip_device_config_device_software_version_string != "") { defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${chip_device_config_device_software_version_string}\"" ] } + + defines += [ "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}" ] } } else if (chip_device_platform == "none") { buildconfig_header("platform_buildconfig") {