From the std::net::UdpSocket::recv_from docs: : The function must be called with valid byte array buf of sufficient size to hold the message bytes. If a message is too long to fit in the supplied buffer, excess bytes may be discarded. In this case it read 1252 bytes from the socket but [the buffer can only hold 1024](https://searchfox.org/mozilla-central/rev/968bd894205cf4f579d94ac4e175cc3187458605/dom/media/webrtc/transport/mdns_service/src/lib.rs#443). [RFC 6762](https://www.rfc-editor.org/rfc/rfc6762) says this about mdns packets: > Even when fragmentation is used, a Multicast DNS packet, including IP and UDP headers, MUST NOT exceed 9000 bytes. > > Note that 9000 bytes is also the maximum payload size of an Ethernet "Jumbo" packet [Jumbo]. However, in practice Ethernet "Jumbo" packets are not widely used, so it is advantageous to keep packets under 1500 bytes whenever possible. Even on hosts that normally handle Ethernet "Jumbo" packets and IP fragment reassembly, it is becoming more common for these hosts to implement power-saving modes where the main CPU goes to sleep and hands off packet reception tasks to a more limited processor in the network interface hardware, which may not support Ethernet "Jumbo" packets or IP fragment reassembly. I'll admit I have no prior knowledge to mdns. Nico, would it make sense to make the buffer 1500 or 9000 bytes here? I can put up a patch.
Bug 1797674 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
From the std::net::UdpSocket::recv_from docs: : The function must be called with valid byte array buf of sufficient size to hold the message bytes. If a message is too long to fit in the supplied buffer, excess bytes may be discarded. In this case it read 1252 bytes from the socket but [the buffer can only hold 1024](https://searchfox.org/mozilla-central/rev/968bd894205cf4f579d94ac4e175cc3187458605/dom/media/webrtc/transport/mdns_service/src/lib.rs#443). [RFC 6762](https://www.rfc-editor.org/rfc/rfc6762) says this about mdns packets: > Even when fragmentation is used, a Multicast DNS packet, including IP and UDP headers, MUST NOT exceed 9000 bytes. > > Note that 9000 bytes is also the maximum payload size of an Ethernet "Jumbo" packet [Jumbo]. However, in practice Ethernet "Jumbo" packets are not widely used, so it is advantageous to keep packets under 1500 bytes whenever possible. Even on hosts that normally handle Ethernet "Jumbo" packets and IP fragment reassembly, it is becoming more common for these hosts to implement power-saving modes where the main CPU goes to sleep and hands off packet reception tasks to a more limited processor in the network interface hardware, which may not support Ethernet "Jumbo" packets or IP fragment reassembly. I'll admit I have no prior knowledge of mdns. Nico, would it make sense to make the buffer 1500 or 9000 bytes here? I can put up a patch.