Title: mdns-repeater causes ChromeCast Audio devices to cease broadcasting mDNS responses when interface MTU exceeded · Issue #245 · python-zeroconf/python-zeroconf · GitHub
Open Graph Title: mdns-repeater causes ChromeCast Audio devices to cease broadcasting mDNS responses when interface MTU exceeded · Issue #245 · python-zeroconf/python-zeroconf
X Title: mdns-repeater causes ChromeCast Audio devices to cease broadcasting mDNS responses when interface MTU exceeded · Issue #245 · python-zeroconf/python-zeroconf
Description: Because I'm not sure of the right set of fixes, I'm filing this issue with each of: Google Chromecast/Home Team (via email), https://github.com/jstasiak/python-zeroconf, https://github.com/kennylevinsen/mdns-repeater, https://github.com/...
Open Graph Description: Because I'm not sure of the right set of fixes, I'm filing this issue with each of: Google Chromecast/Home Team (via email), https://github.com/jstasiak/python-zeroconf, https://github.com/kennylev...
X Description: Because I'm not sure of the right set of fixes, I'm filing this issue with each of: Google Chromecast/Home Team (via email), https://github.com/jstasiak/python-zeroconf, https://github.com/...
Opengraph URL: https://github.com/python-zeroconf/python-zeroconf/issues/245
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mdns-repeater causes ChromeCast Audio devices to cease broadcasting mDNS responses when interface MTU exceeded","articleBody":"Because I'm not sure of the right set of fixes, I'm filing this issue with each of:\r\nGoogle Chromecast/Home Team (via email),\r\nhttps://github.com/jstasiak/python-zeroconf,\r\nhttps://github.com/kennylevinsen/mdns-repeater,\r\nhttps://github.com/home-assistant/plugin-multicast, and\r\nhttps://github.com/home-assistant/core\r\n\r\nI just spent the weekend tracking this down as I apparently started using mdns-repeater\r\nunwittingly due to a change in HomeAssistant's hass.io and its new\r\nmulticast plugin\r\n(https://github.com/home-assistant/plugin-multicast). That resulted in\r\na revival of some terrible instability in my 30+ Google ChromeCast\r\nAudio (CCA) devices in my home -- the problem had gone away a couple\r\nmonths ago and I'd attributed it to IGMP issues, but I peeled the\r\nonion and this is what I found.\r\n\r\nBUG #1 CHROMECAST AUDIO DEVICE PROCESS CRASHES ENDING mDNS:\r\n\r\nThe mDNS announcing process of Google Chromecast Audios (a\r\ndiscontinued product, unfortunately) dies when triggered by the steps\r\nbelow using mdns-repeater and python zeroconf (via Home Assistant in my case).\r\n\r\nThe CCA crash manifests itself by the multicast messages announcing\r\nthe CCA and its audio groups stopping appearing. E.g., if you do\r\n\r\ntcpdump -npi eno1 port 5353 and host [CCA_IP]\r\n\r\nyou'll see a couple of PTR responses coming from the devices every 10\r\nseconds, announcing something like:\r\n\r\nChromecast-Audio-dc.a.................f._googlecast._tcp.local: type TXT, class IN, cache flush\r\n\r\nwhen the set of steps below happens, these announcements end until either:\r\n\r\n1) the CCA reboots (power cycle); or\r\n\r\n2) the CCA is forced to switch to a new WAP; e.g., I have a script\r\nthat forces a client to reconnect to the WAP in order to kick this\r\nmDNS announcing process back on.\r\n\r\nWhen those announcements cease, the Google Home app on Android stops\r\nshowing \"Play Music\" links under that device in the display. HOWEVER,\r\nthere is a per-physical-WAP (based off the MAC of the WAP, not SSID,\r\nso it is not shared across multiple mesh-networked WAPs on the same\r\nSSID) cache for Google Home, so you won't see the problem happen\r\nimmediately. You instead, have to go to another room, ensure the phone\r\nis connected to a new WAP, and then see that \"Play Music\" will no\r\nlonger show up for that device.\r\n\r\nIt's worthing noting that the TCP socket interface to each ChromeCast Audio\r\ndevice is still working after the MDNS announcing process has died. E.g.,\r\nyou can still play music and control the device via TCP APIs, you just\r\ncan't discover the device via mDNS.\r\n\r\n\r\nBUG #1 SUMMARY - HIGH SEVERITY but probably NO FIX: Google ChromeCast\r\nAudio must not crash due to bad network data. (But this probably won't\r\nget fixed since Google Home/Mini do not have the bug and the CCA is a\r\ndiscontinued product.)\r\n\r\n\r\n\r\nBUG #2 PYTHON ZEROCONF SHOULD NOT SEND HUGE PACKETS\r\n\r\nI have 30+ ChromeCast Audio devices and over 80+ Google casting\r\ndevices. A query response to _googlecast._tcp.locl. results in\r\na response that's almost 4KB, far larger than the 1500 MTU on\r\nmost ethernet switches. E.g., if I modify examples/browser.py\r\nto interrogate like so:\r\n\r\n browser = ServiceBrowser(zeroconf, \"_googlecast._tcp.local.\", handlers=[on_service_state_change])\r\n\r\nzeroconf will then publish those 4KB mDNS responses. They, of\r\ncourse, get IP fragmented and that seems to be find when multicasting\r\ndirectly to the CCAs and other devices. However, RFC 6762\r\n(https://tools.ietf.org/html/rfc6762) section 17 states some\r\nrequirements for Multicast DNS Message Size, and the fourth paragraph reads:\r\n\r\n\"A Multicast DNS packet larger than the interface MTU, which is sent\r\n using fragments, MUST NOT contain more than one resource record.\"\r\n\r\nLarger than the interface MTU seems to me to mean that these Responses\r\nmust limit themselves to no more than 1500 octets (except in the\r\nspecial case of a long single record that's too big). That's not the\r\nissue here -- the responses causing the crash are, e.g., 59 Resource\r\nRecords (RR) in the answer (not a single long one).\r\n\r\nFor whatever reason, that problem alone is not causing the ChromeCast\r\nAudios to crash, but I strongly suspect that fixing this problem would\r\nfix the stack. I believe these MUST be broken up into separate UDP\r\npackets of length \u003c= 1500 (the interface MTU) at the application layer\r\n(rather than using IP fragmentation).\r\n\r\nYou can reproduce this using avahi-publish to create lots of records in a\r\nsubdomain and then browsing that subdomain. The total length of the\r\nDNS records should exceed 2KB (for good measure to be sure it's\r\nbig enough).\r\n\r\nBUG #2 SUMMARY - MEDIUM SEVERITY AND STRAIGHTFORWARD FIX: python\r\nzeroconf MUST adhere to RFC 6762.\r\n\r\n\r\nBUG #3 MDNS-REPEATER SOMEHOW TICKLES BUG #1 WHEN PRESENTED WITH MDNS IP FRAGMENTS\r\n\r\nI've not investigated this thoroughly, but I suspect it's either due\r\nto some kind of UDP storm due to a cycle that crashes that CCAs\r\nbecause of the fragmentation, or some kind of packet rewriting.\r\n\r\nThe only other open issue on home-assistant/plugin-multicast seems\r\npossibly relevant\r\n(https://github.com/home-assistant/plugin-multicast/issues/1) and\r\njesserockz's note at the end is worth understanding/trying. I don't\r\nthink the mdns-repeater code should be mirroring all the interfaces,\r\nso if it is, that's a bug.\r\n\r\nNote that in the configuration where I can reproduce this,\r\nmdns-repeater is running inside Home Assistant's hass.io plugin called\r\nthe home-assistant/plugin-multicast\r\n\r\nI work around it by running a shell inside that docker environment and\r\nchanging the run command to comment out the running of mdns-repeater\r\n(since just docker stop-ping that container results in the hassio\r\nsupervisor restarting the container).\r\n\r\nIt may be worth noting that the machine on which hassio has many network interfaces:\r\n```\r\n$ ifconfig # output follows\r\ndocker0: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\neno1: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\neno2: flags=4099\u003cUP,BROADCAST,MULTICAST> mtu 1500\r\nenp2s0f0: flags=4099\u003cUP,BROADCAST,MULTICAST> mtu 1500\r\nenp2s0f1: flags=4099\u003cUP,BROADCAST,MULTICAST> mtu 1500\r\nhassio: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nlo: flags=73\u003cUP,LOOPBACK,RUNNING> mtu 65536\r\nveth0ac5dfe: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nveth0ff2059: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nveth1b05ec4: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nveth3003e6f: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nveth347b241: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nveth54a968f: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nveth748acbe: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nvethc5fab43: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nvethedd7c47: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST> mtu 1500\r\nvirbr0: flags=4099\u003cUP,BROADCAST,MULTICAST> mtu 1500\r\n```\r\n\r\nBUG #3 SUMMARY - UNCERTAIN SEVERITY AND FIX. Confirm it's behaving\r\nas expected when there are multiple interfaces and in the presence\r\nof UDP packets undergoing IP fragmentation.\r\n\r\n\r\nSummary: I propose fixing python-zeroconf as the quickest and easiest\r\nchange, and ideally someone more in tune with what homeassistant is\r\ntrying to do with mdns-repeater could figure out the right fix to\r\nmdns-repeater and/or the way the multicast plugin is configured.\r\n\r\nLet me know what more information you need.\r\n","author":{"url":"https://github.com/gjbadros","@type":"Person","name":"gjbadros"},"datePublished":"2020-05-05T06:48:30Z","url":"https://github.com/python-zeroconf/python-zeroconf/issues/245"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fedeafa6-db51-3296-b7af-4b366b058edf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B3B0:208599:412BFA:575A37:6B00A2C6 |
| html-safe-nonce | e1743a0c465a4a7c3f924e141153ff0b52c655e707bc2e5f4e3c83b37c946632 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0IwOjIwODU5OTo0MTJCRkE6NTc1QTM3OjZCMDBBMkM2IiwidmlzaXRvcl9pZCI6Ijg2MjAyMzY4MjUwMTkwNjUwMzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 865306881f6d4348bc8a40ceea38c7603c1136a5c4e722a376405712a8802439 |
| hovercard-subject-tag | issue:612377030 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-zeroconf/python-zeroconf/245/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2befd413d78bc0993b6e55dd8a6d485ef844ca6aab519a78ede9af9c679f3133/python-zeroconf/python-zeroconf/issues/245 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2befd413d78bc0993b6e55dd8a6d485ef844ca6aab519a78ede9af9c679f3133/python-zeroconf/python-zeroconf/issues/245 |
| og:image:alt | Because I'm not sure of the right set of fixes, I'm filing this issue with each of: Google Chromecast/Home Team (via email), https://github.com/jstasiak/python-zeroconf, https://github.com/kennylev... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gjbadros |
| hostname | github.com |
| expected-hostname | github.com |
| None | 455b493e3402a3a3a06beac5d20bb7db3da060808b220aa48d6a7eca7c59863a |
| turbo-cache-control | no-preview |
| go-import | github.com/python-zeroconf/python-zeroconf git https://github.com/python-zeroconf/python-zeroconf.git |
| octolytics-dimension-user_id | 120192235 |
| octolytics-dimension-user_login | python-zeroconf |
| octolytics-dimension-repository_id | 21548731 |
| octolytics-dimension-repository_nwo | python-zeroconf/python-zeroconf |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 21548731 |
| octolytics-dimension-repository_network_root_nwo | python-zeroconf/python-zeroconf |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2f575159976167242d488c0b062eb355c4e198b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width