Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pidarped
Copy link
Contributor

@pidarped pidarped commented Jan 7, 2025

Use a boolean indicator for TCP server enabling in the TCPListenParameters to signal Server enabling during initialization. By default, TCP Server is enabled on the Server side, and disabled on the client/controller side.

Add API in TransportMgr to access this setting so that DNS-SD operational advertisements for TCP can be set accordingly.

Testing

Add 2 unit tests for checking TCP initialization as TCPClient, and both TCPClient and Server.

@semanticdiff-com
Copy link

Review changes with  SemanticDiff

@github-actions
Copy link

github-actions bot commented Jan 7, 2025

PR #36979: Size comparison from e7f6d0e to 7699ee4

Full report (19 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, nrfconnect, qpg, stm32, tizen)
platform target config section e7f6d0e 7699ee4 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1354956 1354956 0 0.0
RAM 104152 104152 0 0.0
bl702 lighting-app bl702+eth FLASH 726256 726256 0 0.0
RAM 25361 25361 0 0.0
bl702+wifi FLASH 913126 913126 0 0.0
RAM 14101 14101 0 0.0
bl706+mfd+rpc+littlefs FLASH 1173960 1173960 0 0.0
RAM 23941 23941 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 1083028 1083028 0 0.0
RAM 16612 16612 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 840208 840336 128 0.0
RAM 123696 123712 16 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825748 825868 120 0.0
RAM 125584 125600 16 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772568 772788 220 0.0
RAM 114060 114076 16 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756748 756968 220 0.0
RAM 114260 114276 16 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 540049 540237 188 0.0
RAM 205800 205816 16 0.0
lock CC3235SF_LAUNCHXL FLASH 574217 574389 172 0.0
RAM 205944 205960 16 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 918100 918100 0 0.0
RAM 143332 143332 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890592 890592 0 0.0
RAM 141519 141519 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 852164 852164 0 0.0
RAM 142244 142244 0 0.0
qpg lighting-app qpg6105+debug FLASH 664328 664328 0 0.0
RAM 105456 105456 0 0.0
lock-app qpg6105+debug FLASH 622156 622156 0 0.0
RAM 99908 99908 0 0.0
stm32 light STM32WB5MM-DK FLASH 485080 485080 0 0.0
RAM 144912 144912 0 0.0
tizen all-clusters-app arm unknown 5160 5160 0 0.0
FLASH 1780980 1781612 632 0.0
RAM 93684 93720 36 0.0
chip-tool-ubsan arm unknown 10844 10844 0 0.0
FLASH 17999086 18002566 3480 0.0
RAM 7855832 7857456 1624 0.0

@github-actions
Copy link

github-actions bot commented Jan 7, 2025

PR #36979: Size comparison from e7f6d0e to ec213db

Full report (70 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section e7f6d0e ec213db change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1354956 1354956 0 0.0
RAM 104152 104152 0 0.0
bl702 lighting-app bl702+eth FLASH 726256 726256 0 0.0
RAM 25361 25361 0 0.0
bl702+wifi FLASH 913126 913126 0 0.0
RAM 14101 14101 0 0.0
bl706+mfd+rpc+littlefs FLASH 1173960 1173960 0 0.0
RAM 23941 23941 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 1083028 1083028 0 0.0
RAM 16612 16612 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 840208 840336 128 0.0
RAM 123696 123712 16 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825748 825868 120 0.0
RAM 125584 125600 16 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772568 772788 220 0.0
RAM 114060 114076 16 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756748 756968 220 0.0
RAM 114260 114276 16 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 540049 540237 188 0.0
RAM 205800 205816 16 0.0
lock CC3235SF_LAUNCHXL FLASH 574217 574389 172 0.0
RAM 205944 205960 16 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 681745 681745 0 0.0
RAM 78756 78756 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 701597 701597 0 0.0
RAM 81396 81396 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 701597 701597 0 0.0
RAM 81396 81396 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 658525 658525 0 0.0
RAM 73824 73824 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 618369 618369 0 0.0
RAM 71748 71748 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 637997 637997 0 0.0
RAM 74292 74292 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 637997 637997 0 0.0
RAM 74292 74292 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 637769 637769 0 0.0
RAM 74756 74756 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 657477 657477 0 0.0
RAM 77300 77300 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 657477 657477 0 0.0
RAM 77300 77300 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 614389 614389 0 0.0
RAM 68844 68844 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 634241 634241 0 0.0
RAM 71476 71476 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 634241 634241 0 0.0
RAM 71476 71476 0 0.0
efr32 lock-app BRD4187C FLASH 932676 932676 0 0.0
RAM 160228 160228 0 0.0
BRD4338a FLASH 747160 747152 -8 -0.0
RAM 233356 233356 0 0.0
window-app BRD4187C FLASH 1025592 1025592 0 0.0
RAM 128332 128332 0 0.0
esp32 all-clusters-app c3devkit DRAM 95352 95352 0 0.0
FLASH 1541956 1541956 0 0.0
IRAM 82552 82552 0 0.0
m5stack DRAM 116332 116332 0 0.0
FLASH 1548154 1548154 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4752 4752 0 0.0
FLASH 2730137 2731267 1130 0.0
RAM 133096 133160 64 0.0
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 6018726 6019504 778 0.0
RAM 523992 524056 64 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5355204 5355982 778 0.0
RAM 243008 243072 64 0.0
bridge-app debug unknown 5472 5472 0 0.0
FLASH 4703618 4704396 778 0.0
RAM 221760 221824 64 0.0
chip-tool debug unknown 5992 5992 0 0.0
FLASH 12866788 12867836 1048 0.0
RAM 582586 582650 64 0.0
chip-tool-ipv6only arm64 unknown 21400 21400 0 0.0
FLASH 10995728 10996608 880 0.0
RAM 633584 633648 64 0.0
fabric-admin debug unknown 5816 5816 0 0.0
FLASH 11272273 11273321 1048 0.0
RAM 582930 582994 64 0.0
fabric-bridge-app debug unknown 4728 4728 0 0.0
FLASH 4528852 4529550 698 0.0
RAM 208880 208928 48 0.0
fabric-sync debug unknown 4968 4968 0 0.0
FLASH 5639429 5640533 1104 0.0
RAM 475880 475928 48 0.0
lighting-app debug+rpc+ui unknown 6136 6136 0 0.0
FLASH 5639409 5640529 1120 0.0
RAM 232008 232072 64 0.0
lock-app debug unknown 5408 5408 0 0.0
FLASH 4751986 4752764 778 0.0
RAM 208008 208072 64 0.0
ota-provider-app debug unknown 4768 4768 0 0.0
FLASH 4378612 4379310 698 0.0
RAM 201696 201744 48 0.0
ota-requestor-app debug unknown 4720 4720 0 0.0
FLASH 4517520 4518218 698 0.0
RAM 206280 206312 32 0.0
shell debug unknown 4248 4248 0 0.0
FLASH 3036685 3037469 784 0.0
RAM 160736 160792 56 0.0
thermostat-no-ble arm64 unknown 9584 9584 0 0.0
FLASH 4118968 4119752 784 0.0
RAM 246296 246336 40 0.0
tv-app debug unknown 5736 5736 0 0.0
FLASH 5988693 5989861 1168 0.0
RAM 599312 599360 48 0.0
tv-casting-app debug unknown 5320 5320 0 0.0
FLASH 11092685 11093821 1136 0.0
RAM 695496 695568 72 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 918100 918100 0 0.0
RAM 143332 143332 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890592 890592 0 0.0
RAM 141519 141519 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 852164 852164 0 0.0
RAM 142244 142244 0 0.0
nxp contact k32w0+release FLASH 585952 585952 0 0.0
RAM 71112 71112 0 0.0
mcxw71+release FLASH 600512 600512 0 0.0
RAM 63208 63208 0 0.0
light k32w0+release FLASH 612716 612716 0 0.0
RAM 70504 70504 0 0.0
k32w1+release FLASH 686920 686920 0 0.0
RAM 48840 48840 0 0.0
lock mcxw71+release FLASH 763264 763264 0 0.0
RAM 70876 70876 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1647500 1647652 152 0.0
RAM 212128 212144 16 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1555132 1555284 152 0.0
RAM 208944 208960 16 0.0
light cy8ckit_062s2_43012 FLASH 1470236 1470388 152 0.0
RAM 200912 200928 16 0.0
lock cy8ckit_062s2_43012 FLASH 1467956 1468108 152 0.0
RAM 225272 225280 8 0.0
qpg lighting-app qpg6105+debug FLASH 664328 664328 0 0.0
RAM 105456 105456 0 0.0
lock-app qpg6105+debug FLASH 622156 622156 0 0.0
RAM 99908 99908 0 0.0
stm32 light STM32WB5MM-DK FLASH 485080 485080 0 0.0
RAM 144912 144912 0 0.0
telink bridge-app tlsr9258a FLASH 683634 683634 0 0.0
RAM 91248 91248 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 623874 623874 0 0.0
RAM 31488 31488 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 772708 772708 0 0.0
RAM 49348 49348 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 777324 777324 0 0.0
RAM 99812 99812 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 711316 711316 0 0.0
RAM 73544 73544 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 628320 628320 0 0.0
RAM 142180 142180 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 814334 814334 0 0.0
RAM 99724 99724 0 0.0
tizen all-clusters-app arm unknown 5160 5160 0 0.0
FLASH 1780980 1781612 632 0.0
RAM 93684 93720 36 0.0
chip-tool-ubsan arm unknown 10844 10844 0 0.0
FLASH 17999086 18002566 3480 0.0
RAM 7855832 7857456 1624 0.0

Copy link
Contributor

@andy31415 andy31415 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pidarped please add a #### Testing section to the PR summary.

Use a boolean indicator for TCP server enabling in the
TCPListenParameters to signal Server enabling during initialization.
By default, TCP Server is enabled on the Server side, and disabled
on the client/controller side.

Add API in TransportMgr to access this setting so that DNS-SD
operational advertisements for TCP can be set accordingly.
@pidarped pidarped force-pushed the TCPServerSeparation branch from 366359b to 24df222 Compare January 9, 2025 18:20
@pidarped pidarped force-pushed the TCPServerSeparation branch from 24df222 to 1ba654a Compare January 9, 2025 18:26
@github-actions
Copy link

github-actions bot commented Jan 9, 2025

PR #36979: Size comparison from d3204f6 to 1ba654a

Full report (70 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section d3204f6 1ba654a change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1354956 1354956 0 0.0
RAM 104152 104152 0 0.0
bl702 lighting-app bl702+eth FLASH 726512 726512 0 0.0
RAM 25361 25361 0 0.0
bl702+wifi FLASH 913126 913126 0 0.0
RAM 14101 14101 0 0.0
bl706+mfd+rpc+littlefs FLASH 1173960 1173960 0 0.0
RAM 23941 23941 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 1083028 1083028 0 0.0
RAM 16612 16612 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 840256 840400 144 0.0
RAM 123696 123712 16 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825796 825932 136 0.0
RAM 125584 125600 16 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772632 772836 204 0.0
RAM 114060 114076 16 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756812 757016 204 0.0
RAM 114260 114276 16 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 540113 540285 172 0.0
RAM 205800 205816 16 0.0
lock CC3235SF_LAUNCHXL FLASH 574265 574453 188 0.0
RAM 205944 205960 16 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 681801 681801 0 0.0
RAM 78756 78756 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 701653 701653 0 0.0
RAM 81396 81396 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 701653 701653 0 0.0
RAM 81396 81396 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 658581 658581 0 0.0
RAM 73824 73824 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 618425 618425 0 0.0
RAM 71748 71748 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 638053 638053 0 0.0
RAM 74292 74292 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 638053 638053 0 0.0
RAM 74292 74292 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 637825 637825 0 0.0
RAM 74756 74756 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 657533 657533 0 0.0
RAM 77300 77300 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 657533 657533 0 0.0
RAM 77300 77300 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 614445 614445 0 0.0
RAM 68844 68844 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 634297 634297 0 0.0
RAM 71476 71476 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 634297 634297 0 0.0
RAM 71476 71476 0 0.0
efr32 lock-app BRD4187C FLASH 932740 932740 0 0.0
RAM 160228 160228 0 0.0
BRD4338a FLASH 747208 747200 -8 -0.0
RAM 233356 233356 0 0.0
window-app BRD4187C FLASH 1025656 1025656 0 0.0
RAM 128332 128332 0 0.0
esp32 all-clusters-app c3devkit DRAM 95352 95352 0 0.0
FLASH 1541996 1541996 0 0.0
IRAM 82552 82552 0 0.0
m5stack DRAM 116332 116332 0 0.0
FLASH 1548218 1548218 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4752 4752 0 0.0
FLASH 2730561 2731679 1118 0.0
RAM 133096 133160 64 0.0
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 6019150 6019916 766 0.0
RAM 523992 524056 64 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5355628 5356394 766 0.0
RAM 243008 243072 64 0.0
bridge-app debug unknown 5472 5472 0 0.0
FLASH 4704042 4704808 766 0.0
RAM 221760 221824 64 0.0
chip-tool debug unknown 5992 5992 0 0.0
FLASH 12866788 12867824 1036 0.0
RAM 582586 582650 64 0.0
chip-tool-ipv6only arm64 unknown 21400 21400 0 0.0
FLASH 10995728 10996592 864 0.0
RAM 633584 633648 64 0.0
fabric-admin debug unknown 5816 5816 0 0.0
FLASH 11272273 11273309 1036 0.0
RAM 582930 582994 64 0.0
fabric-bridge-app debug unknown 4728 4728 0 0.0
FLASH 4529276 4529962 686 0.0
RAM 208880 208928 48 0.0
fabric-sync debug unknown 4968 4968 0 0.0
FLASH 5639861 5640949 1088 0.0
RAM 475880 475928 48 0.0
lighting-app debug+rpc+ui unknown 6136 6136 0 0.0
FLASH 5639825 5640945 1120 0.0
RAM 232008 232072 64 0.0
lock-app debug unknown 5408 5408 0 0.0
FLASH 4752410 4753176 766 0.0
RAM 208008 208072 64 0.0
ota-provider-app debug unknown 4768 4768 0 0.0
FLASH 4379036 4379722 686 0.0
RAM 201696 201744 48 0.0
ota-requestor-app debug unknown 4720 4720 0 0.0
FLASH 4517944 4518630 686 0.0
RAM 206280 206312 32 0.0
shell debug unknown 4248 4248 0 0.0
FLASH 3037117 3037885 768 0.0
RAM 160736 160792 56 0.0
thermostat-no-ble arm64 unknown 9584 9584 0 0.0
FLASH 4119288 4120072 784 0.0
RAM 246344 246384 40 0.0
tv-app debug unknown 5736 5736 0 0.0
FLASH 5989109 5990277 1168 0.0
RAM 599312 599360 48 0.0
tv-casting-app debug unknown 5320 5320 0 0.0
FLASH 11093117 11094237 1120 0.0
RAM 695496 695568 72 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 918156 918156 0 0.0
RAM 143332 143332 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890664 890664 0 0.0
RAM 141519 141519 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 852220 852220 0 0.0
RAM 142244 142244 0 0.0
nxp contact k32w0+release FLASH 586112 586112 0 0.0
RAM 71112 71112 0 0.0
mcxw71+release FLASH 601624 601624 0 0.0
RAM 63328 63328 0 0.0
light k32w0+release FLASH 612748 612748 0 0.0
RAM 70504 70504 0 0.0
k32w1+release FLASH 687384 687384 0 0.0
RAM 48920 48920 0 0.0
lock mcxw71+release FLASH 763704 763704 0 0.0
RAM 70956 70956 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1647532 1647684 152 0.0
RAM 212128 212144 16 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1555164 1555316 152 0.0
RAM 208944 208960 16 0.0
light cy8ckit_062s2_43012 FLASH 1470268 1470420 152 0.0
RAM 200912 200928 16 0.0
lock cy8ckit_062s2_43012 FLASH 1468004 1468156 152 0.0
RAM 225272 225280 8 0.0
qpg lighting-app qpg6105+debug FLASH 664392 664392 0 0.0
RAM 105456 105456 0 0.0
lock-app qpg6105+debug FLASH 622204 622204 0 0.0
RAM 99908 99908 0 0.0
stm32 light STM32WB5MM-DK FLASH 485136 485136 0 0.0
RAM 144912 144912 0 0.0
telink bridge-app tlsr9258a FLASH 683698 683698 0 0.0
RAM 91248 91248 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 623938 623938 0 0.0
RAM 31488 31488 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 772772 772772 0 0.0
RAM 49348 49348 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 777388 777388 0 0.0
RAM 99812 99812 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 711380 711380 0 0.0
RAM 73544 73544 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 628384 628384 0 0.0
RAM 142180 142180 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 814398 814398 0 0.0
RAM 99724 99724 0 0.0
tizen all-clusters-app arm unknown 5160 5160 0 0.0
FLASH 1781116 1781740 624 0.0
RAM 93684 93720 36 0.0
chip-tool-ubsan arm unknown 10844 10844 0 0.0
FLASH 17999086 18002558 3472 0.0
RAM 7855832 7857456 1624 0.0

@pidarped pidarped requested review from a team January 9, 2025 21:24
@mergify mergify bot merged commit 0129a57 into project-chip:master Jan 9, 2025
68 checks passed

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
,
TcpListenParameters(DeviceLayer::TCPEndPointManager())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs some documentation explaining that the ordering here is very important and pointing to the code that depends on that ordering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to add the documentation in a subsequent PR. Had intended to do so in this one but it auto-merged before that.

#endif // CHIP_CONFIG_ENABLE_ICD_SERVER

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
app::DnssdServer::Instance().SetTCPServerEnabled(mTransports.GetTransport().GetImplAtIndex<1>().IsServerListenEnabled());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is weird. I would have expected the TcpListenParameters to tell the transport whether to enable server, not the transport deciding independently and then the Server having to get the info out somehow. And indeed the parameters have a flag for this. So what's going on here?

In particular, looks to me like Server always enables listen, so this whole IsServerListenEnabled complexity is not needed....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TcpListenParameters does carry the flag and it is set while initializing the TransportMgr. The way I have it in this PR is enabling the Server as a default setting in TcpListenParameters. The controller explicitly sets it to false.
For setting it in the DnssdServer, it is being retrieved from the Transport using the logic above because the setting in the TransportMgr is being assumed to be the source of truth.

.SetAddressType(Inet::IPAddressType::kIPv6)
.SetListenPort(params.listenPort)
#if INET_CONFIG_ENABLE_IPV4
#if INET_CONFIG_ENABLE_TCP_ENDPOINT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the ordering change here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And note that the ordering here is public API certainly for Server, so you have no idea whom you might be breaking with these ordering changes. Like "introduces silent security bugs" breaking.

Transport::TcpListenParameters(stateParams.tcpEndPointManager)
.SetAddressType(IPAddressType::kIPv6)
.SetListenPort(params.listenPort)
.SetServerListenEnabled(false) // Initialize as a TCP Client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why would we force controllers to never be TCP servers? This isn't a "by default" like the PR description misleadingly says: it's just force-disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to keep the interaction simple, I was assuming controllers(like chip-tool and commissioning clients) to be TCP clients.
The TcpListenParameters probably need to be percolated further up in order to make it a truly configurable parameter. For now, I have set the controller to be a TCP Client.

return TCPDisconnectImpl<0>(conn, shouldAbort);
}

bool IsServerListenEnabled() override { return IsServerListenEnabledImpl<0>(); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used? It doesn't seem to be used. The one use in Server gets something explicitly by index...

And what does this function even mean? "We have some transport that's listening as a server"?

What does it even mean for a generic transport (e.g. UDP) to be "listening as a server"?

@bzbarsky-apple
Copy link
Contributor

Here's what I propose concretely:

  1. Undo the ordering changes, because that's basically introducing a "now you have a security bug" problem into what is unfortunately public SDK API at the moment.
  2. Have Server and CHIPDeviceController create the TcpListenParameters on the stack and call DnssdServer::Instance().SetTCPServerEnabled with the value from the TcpListenParameters.
  3. Remove all the IsServerListenEnabled and IsServerListenEnabledImpl bits.

Alami-Amine pushed a commit to Alami-Amine/connectedhomeip that referenced this pull request Jan 12, 2025
* Add separate knob for TCP server listen enabling.

Use a boolean indicator for TCP server enabling in the
TCPListenParameters to signal Server enabling during initialization.
By default, TCP Server is enabled on the Server side, and disabled
on the client/controller side.

Add API in TransportMgr to access this setting so that DNS-SD
operational advertisements for TCP can be set accordingly.

* Add 2 unit tests

* Apply suggestions from code review

Co-authored-by: Andrei Litvin <[email protected]>

---------

Co-authored-by: Andrei Litvin <[email protected]>
pidarped added a commit to pidarped/connectedhomeip that referenced this pull request Jan 13, 2025
Address post-merge comments from PR project-chip#36979.

Keep original order of raw transports in the TransportMgr tuple because
it is part of the public API on the controller side.

When setting the TCPServerListen flag in DnssdServer, use the same value
as in TcpListenParams directly, instead of fetching from the
TransportMgr.
yufengwangca pushed a commit that referenced this pull request Jan 14, 2025
* Restore original order of transports in TransportMgr.

Address post-merge comments from PR #36979.

Keep original order of raw transports in the TransportMgr tuple because
it is part of the public API on the controller side.

When setting the TCPServerListen flag in DnssdServer, use the same value
as in TcpListenParams directly, instead of fetching from the
TransportMgr.

* Address review comments.
@pidarped pidarped deleted the TCPServerSeparation branch January 22, 2025 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants