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

Make minmdns advertiser send a TTL=0 record broadcast when services are removed. #19692

Merged
merged 7 commits into from
Jun 17, 2022

Conversation

andy31415
Copy link
Contributor

Problem

MinMDNS hardcodes a TTL for all records of 2 minutes (since it actually does not really know about real validity).

This means for fast operations (e.g. advertise commissionable and then actually commission), the device will stay up for 2 minutes for servers that implement caching and honor ttl (e.g. bonjour, avahi, other non min-mdns systems)

Change overview

Support a "send all records with TTL=0" operation min minmdns. Use this in MinMdns advertiser.
Cleanup shutdown logic in minmdns demo server, however since that does not use the real advertiser, it will not send either of boot time or shut down advertisements. This one did not seem as important to fix (2 min timeout seems ok here).

Testing

a) started all-clusters-app on linux, noticed that avahi-browse stops showing the services immediately after ^C (before they persisted)
b) Adjusted one unit test to validate that "set TTL to 0" works
c) CI will validate that normal operations are still ok - specifically commission and operation tests on linux use minMDNS.

@github-actions
Copy link

github-actions bot commented Jun 16, 2022

PR #19692: Size comparison from 3963c1b to 6c383da

Increases (22 builds for efr32, esp32, linux, mbed, p6)
platform target config section 3963c1b 6c383da change % change
efr32 lighting-app BRD4161A+rs911x (read only) 799092 799412 320 0.0
.text 799084 799404 320 0.0
lock-app BRD4161A+wf200 (read only) 965524 965796 272 0.0
.text 965516 965788 272 0.0
esp32 all-clusters-app c3devkit (read only) 1012634 1012888 254 0.0
.flash.text 1012634 1012888 254 0.0
m5stack (read only) 1067171 1067423 252 0.0
.flash.text 1061787 1062039 252 0.0
linux all-clusters-app debug (read only) 2929609 2930681 1072 0.0
.rodata 259421 259741 320 0.1
.text 2493746 2494498 752 0.0
all-clusters-minimal-app debug (read only) 2783321 2784393 1072 0.0
.rodata 260957 261277 320 0.1
.text 2348098 2348850 752 0.0
bridge-app debug+rpc (read only) 2285953 2286945 992 0.0
.rodata 194304 194560 256 0.1
.text 1930562 1931298 736 0.0
chip-tool debug (read only) 10140077 10141069 992 0.0
.rodata 508725 508981 256 0.1
.text 8225621 8226357 736 0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9881836 9882380 544 0.0
.text 7873108 7873652 544 0.0
lighting-app debug+rpc (read only) 2518705 2519729 1024 0.0
.rodata 210056 210344 288 0.1
.text 2138946 2139682 736 0.0
lock-app debug (read only) 2457417 2458457 1040 0.0
.rodata 223752 224040 288 0.1
.text 2069362 2070114 752 0.0
ota-provider-app debug (read only) 2295313 2296337 1024 0.0
.rodata 199928 200216 288 0.1
.text 1933234 1933970 736 0.0
ota-requestor-app debug (read only) 2411025 2412065 1040 0.0
.rodata 203616 203904 288 0.1
.text 2037026 2037778 752 0.0
shell debug (read only) 2603153 2604161 1008 0.0
.rodata 229746 230002 256 0.1
.text 2213650 2214402 752 0.0
thermostat-no-ble arm64 (read only) 2570700 2571260 560 0.0
.text 2168256 2168816 560 0.0
tv-app debug (read only) 3067169 3068161 992 0.0
.rodata 245664 245920 256 0.1
.text 2634642 2635378 736 0.0
tv-casting-app debug (read only) 5550025 5551017 992 0.0
.rodata 341193 341449 256 0.1
.text 4932386 4933122 736 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read/write) 2437720 2437976 256 0.0
.text 1400364 1400620 256 0.0
p6 all-clusters-app default (read/write) 2553568 2553888 320 0.0
.text 1511832 1512152 320 0.0
all-clusters-minimal-app default (read/write) 2499416 2499752 336 0.0
.text 1457680 1458016 336 0.0
light-app default (read/write) 2430160 2430496 336 0.0
.text 1388424 1388760 336 0.0
lock-app default (read/write) 2450784 2451120 336 0.0
.text 1409048 1409384 336 0.0
Decreases (2 builds for cyw30739, telink)
platform target config section 3963c1b 6c383da change % change
cyw30739 ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 616078 616070 -8 -0.0
.app_xip_area 473632 473624 -8 -0.0
telink lighting-app tlsr9518adk80d text 576068 576066 -2 -0.0
Full report (41 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 3963c1b 6c383da change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 659563 659563 0 0.0
(read/write) 191300 191300 0 0.0
.bss 73756 73756 0 0.0
.data 3356 3356 0 0.0
.rodata 87083 87083 0 0.0
.text 572168 572168 0 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 648031 648031 0 0.0
(read/write) 157316 157316 0 0.0
.bss 73044 73044 0 0.0
.data 3356 3356 0 0.0
.rodata 90407 90407 0 0.0
.text 557304 557304 0 0.0
lock-ftd LP_CC2652R7 (read only) 690483 690483 0 0.0
(read/write) 150492 150492 0 0.0
.bss 70756 70756 0 0.0
.data 3280 3280 0 0.0
.rodata 99163 99163 0 0.0
.text 590836 590836 0 0.0
lock-mtd LP_CC2652R7 (read only) 639891 639891 0 0.0
(read/write) 143888 143888 0 0.0
.bss 66492 66492 0 0.0
.data 3280 3280 0 0.0
.rodata 99043 99043 0 0.0
.text 540356 540356 0 0.0
pump-app LP_CC2652R7 (read only) 671435 671435 0 0.0
(read/write) 170428 170428 0 0.0
.bss 70876 70876 0 0.0
.data 3280 3280 0 0.0
.rodata 87259 87259 0 0.0
.text 583692 583692 0 0.0
pump-controller-app LP_CC2652R7 (read only) 662423 662423 0 0.0
(read/write) 179568 179568 0 0.0
.bss 71004 71004 0 0.0
.data 3276 3276 0 0.0
.rodata 85183 85183 0 0.0
.text 576756 576756 0 0.0
shell LP_CC2652R7 (read only) 688970 688970 0 0.0
(read/write) 157388 157388 0 0.0
.bss 76052 76052 0 0.0
.data 3360 3360 0 0.0
.rodata 109658 109658 0 0.0
.text 579000 579000 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 612770 612770 0 0.0
.app_xip_area 469436 469436 0 0.0
.bss 86288 86288 0 0.0
.data 728 728 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 610078 610078 0 0.0
.app_xip_area 466568 466568 0 0.0
.bss 86464 86464 0 0.0
.data 732 732 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 616078 616070 -8 -0.0
.app_xip_area 473632 473624 -8 -0.0
.bss 85456 85456 0 0.0
.data 672 672 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 924008 924008 0 0.0
(read/write) 132416 132416 0 0.0
.bss 130336 130336 0 0.0
.data 2080 2080 0 0.0
.text 924000 924000 0 0.0
BRD4161A+rpc (read only) 959712 959712 0 0.0
(read/write) 149296 149296 0 0.0
.bss 147008 147008 0 0.0
.data 2284 2284 0 0.0
.text 959704 959704 0 0.0
BRD4161A+rs911x (read only) 799092 799412 320 0.0
(read/write) 128692 128692 0 0.0
.bss 126604 126604 0 0.0
.data 2088 2088 0 0.0
.text 799084 799404 320 0.0
lock-app BRD4161A+wf200 (read only) 965524 965796 272 0.0
(read/write) 129068 129068 0 0.0
.bss 126980 126980 0 0.0
.data 2088 2088 0 0.0
.text 965516 965788 272 0.0
window-app BRD4161A (read only) 909104 909104 0 0.0
(read/write) 132520 132520 0 0.0
.bss 130408 130408 0 0.0
.data 2108 2108 0 0.0
.text 909096 909096 0 0.0
esp32 all-clusters-app c3devkit (read only) 1012634 1012888 254 0.0
(read/write) 1482898 1482898 0 0.0
.dram0.bss 69392 69392 0 0.0
.dram0.data 14632 14632 0 0.0
.flash.rodata 213440 213440 0 0.0
.flash.text 1012634 1012888 254 0.0
.iram0.text 62902 62902 0 0.0
m5stack (read only) 1067171 1067423 252 0.0
(read/write) 485016 485016 0 0.0
.dram0.bss 74912 74912 0 0.0
.dram0.data 34144 34144 0 0.0
.flash.rodata 243964 243964 0 0.0
.flash.text 1061787 1062039 252 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 658908 658908 0 0.0
.bss 68756 68756 0 0.0
.data 1992 1992 0 0.0
.text 582360 582360 0 0.0
lock k32w061+release (read/write) 720864 720864 0 0.0
.bss 69196 69196 0 0.0
.data 2000 2000 0 0.0
.text 643868 643868 0 0.0
linux all-clusters-app debug (read only) 2929609 2930681 1072 0.0
(read/write) 188656 188656 0 0.0
.bss 95744 95744 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 84664 84664 0 0.0
.dynamic 608 608 0 0.0
.got 4536 4536 0 0.0
.init 27 27 0 0.0
.init_array 1032 1032 0 0.0
.rodata 259421 259741 320 0.1
.text 2493746 2494498 752 0.0
all-clusters-minimal-app debug (read only) 2783321 2784393 1072 0.0
(read/write) 180560 180560 0 0.0
.bss 95072 95072 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 77304 77304 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 1032 1032 0 0.0
.rodata 260957 261277 320 0.1
.text 2348098 2348850 752 0.0
bridge-app debug+rpc (read only) 2285953 2286945 992 0.0
(read/write) 159424 159424 0 0.0
.bss 83136 83136 0 0.0
.data 3792 3792 0 0.0
.data.rel.ro 66728 66728 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 728 728 0 0.0
.rodata 194304 194560 256 0.1
.text 1930562 1931298 736 0.0
chip-tool debug (read only) 10140077 10141069 992 0.0
(read/write) 609544 609544 0 0.0
.bss 24352 24352 0 0.0
.data 1088 1088 0 0.0
.data.rel.ro 577808 577808 0 0.0
.dynamic 624 624 0 0.0
.got 5008 5008 0 0.0
.init 27 27 0 0.0
.init_array 640 640 0 0.0
.rodata 508725 508981 256 0.1
.text 8225621 8226357 736 0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9881836 9882380 544 0.0
(read/write) 674225 674225 0 0.0
.bss 42641 42641 0 0.0
.data 1152 1152 0 0.0
.data.rel.ro 613208 613208 0 0.0
.dynamic 528 528 0 0.0
.got 13416 13416 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 472300 472300 0 0.0
.text 7873108 7873652 544 0.0
lighting-app debug+rpc (read only) 2518705 2519729 1024 0.0
(read/write) 163448 163448 0 0.0
.bss 83616 83616 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 71896 71896 0 0.0
.dynamic 608 608 0 0.0
.got 4424 4424 0 0.0
.init 27 27 0 0.0
.init_array 816 816 0 0.0
.rodata 210056 210344 288 0.1
.text 2138946 2139682 736 0.0
lock-app debug (read only) 2457417 2458457 1040 0.0
(read/write) 158096 158096 0 0.0
.bss 82016 82016 0 0.0
.data 1680 1680 0 0.0
.data.rel.ro 68568 68568 0 0.0
.dynamic 608 608 0 0.0
.got 4424 4424 0 0.0
.init 27 27 0 0.0
.init_array 776 776 0 0.0
.rodata 223752 224040 288 0.1
.text 2069362 2070114 752 0.0
ota-provider-app debug (read only) 2295313 2296337 1024 0.0
(read/write) 152232 152232 0 0.0
.bss 81696 81696 0 0.0
.data 1912 1912 0 0.0
.data.rel.ro 62840 62840 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 199928 200216 288 0.1
.text 1933234 1933970 736 0.0
ota-requestor-app debug (read only) 2411025 2412065 1040 0.0
(read/write) 158976 158976 0 0.0
.bss 84000 84000 0 0.0
.data 2200 2200 0 0.0
.data.rel.ro 66936 66936 0 0.0
.dynamic 608 608 0 0.0
.got 4480 4480 0 0.0
.init 27 27 0 0.0
.init_array 728 728 0 0.0
.rodata 203616 203904 288 0.1
.text 2037026 2037778 752 0.0
shell debug (read only) 2603153 2604161 1008 0.0
(read/write) 219288 219288 0 0.0
.bss 134504 134504 0 0.0
.data 1232 1232 0 0.0
.data.rel.ro 77808 77808 0 0.0
.dynamic 608 608 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 229746 230002 256 0.1
.text 2213650 2214402 752 0.0
thermostat-no-ble arm64 (read only) 2570700 2571260 560 0.0
(read/write) 192193 192193 0 0.0
.bss 99489 99489 0 0.0
.data 1688 1688 0 0.0
.data.rel.ro 82928 82928 0 0.0
.dynamic 528 528 0 0.0
.got 5072 5072 0 0.0
.init 24 24 0 0.0
.init_array 400 400 0 0.0
.rodata 163324 163324 0 0.0
.text 2168256 2168816 560 0.0
tv-app debug (read only) 3067169 3068161 992 0.0
(read/write) 289352 289352 0 0.0
.bss 199240 199240 0 0.0
.data 4656 4656 0 0.0
.data.rel.ro 79016 79016 0 0.0
.dynamic 608 608 0 0.0
.got 4840 4840 0 0.0
.init 27 27 0 0.0
.init_array 952 952 0 0.0
.rodata 245664 245920 256 0.1
.text 2634642 2635378 736 0.0
tv-casting-app debug (read only) 5550025 5551017 992 0.0
(read/write) 199960 199960 0 0.0
.bss 88072 88072 0 0.0
.data 2480 2480 0 0.0
.data.rel.ro 103184 103184 0 0.0
.dynamic 608 608 0 0.0
.got 4712 4712 0 0.0
.init 27 27 0 0.0
.init_array 872 872 0 0.0
.rodata 341193 341449 256 0.1
.text 4932386 4933122 736 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2437720 2437976 256 0.0
.bss 208204 208204 0 0.0
.data 5864 5864 0 0.0
.text 1400364 1400620 256 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1198715 1198715 0 0.0
bss 141598 141598 0 0.0
rodata 155676 155676 0 0.0
text 822532 822532 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1146687 1146687 0 0.0
bss 140850 140850 0 0.0
rodata 132200 132200 0 0.0
text 794748 794748 0 0.0
p6 all-clusters-app default (read/write) 2553568 2553888 320 0.0
.bss 143384 143384 0 0.0
.data 2776 2776 0 0.0
.text 1511832 1512152 320 0.0
all-clusters-minimal-app default (read/write) 2499416 2499752 336 0.0
.bss 142664 142664 0 0.0
.data 2776 2776 0 0.0
.text 1457680 1458016 336 0.0
light-app default (read/write) 2430160 2430496 336 0.0
.bss 134744 134744 0 0.0
.data 2592 2592 0 0.0
.text 1388424 1388760 336 0.0
lock-app default (read/write) 2450784 2451120 336 0.0
.bss 134568 134568 0 0.0
.data 2600 2600 0 0.0
.text 1409048 1409384 336 0.0
telink light-switch-app tlsr9518adk80d (read/write) 789016 789016 0 0.0
bss 69892 69892 0 0.0
noinit 40416 40416 0 0.0
text 559604 559604 0 0.0
lighting-app tlsr9518adk80d (read/write) 808728 808728 0 0.0
bss 70140 70140 0 0.0
noinit 40416 40416 0 0.0
text 576068 576066 -2 -0.0

src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp Outdated Show resolved Hide resolved
src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp Outdated Show resolved Hide resolved
src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp Outdated Show resolved Hide resolved
src/lib/dnssd/minimal_mdns/Parser.h Outdated Show resolved Hide resolved
src/lib/dnssd/minimal_mdns/Parser.h Outdated Show resolved Hide resolved
src/lib/dnssd/minimal_mdns/Parser.h Outdated Show resolved Hide resolved
src/lib/dnssd/minimal_mdns/responders/Responder.h Outdated Show resolved Hide resolved
src/lib/dnssd/minimal_mdns/responders/Responder.h Outdated Show resolved Hide resolved
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.

None yet

3 participants