Closed Bug 1286636 Opened 7 years ago Closed 7 years ago

[FlyWeb] Use unbound UDP socket for mDNS queries


(Core :: Networking, defect)

Not set



Tracking Status
firefox50 --- fixed


(Reporter: djvj, Assigned: djvj)



(Whiteboard: [necko-active])


(1 file, 1 obsolete file)

One of the implementation issues we ran into on Windows 10 is that win10 system processes open and hold UDP port 5353 on the mDNS multicast address.

Our current fallback implementation also uses a SO_REUSE UDP socket on port 5353, but is hampered by conflicts.  The main issue is that only broadcast packets sent to the multicast group are delivered to the gecko UDP socket.  Directed UDP messages to the machine on that port are not delivered, and presumably go to the system socket instead.

The workaround suggested is to use a single query socket opened on an arbitrary port.  The query socket does NOT join the mDNS multicast IP group, but DOES send packets to that group.  Since this socket is assigned its own unique port, query responses addressed to it will resolve properly.
Attached patch use-unbound-query-socket.patch (obsolete) — Splinter Review
Tested this on Linux, Android, and my Win10 box.  Seems to work quite well.
Attachment #8770685 - Flags: review?(jdarcangelo)
Assignee: nobody → kvijayan
Whiteboard: [necko-active]
Comment on attachment 8770685 [details] [diff] [review]

Review of attachment 8770685 [details] [diff] [review]:

LGTM. See my comment about removing the old block of commented-out code.

::: netwerk/dns/mdns/libmdns/fallback/MulticastDNS.jsm
@@ +343,5 @@
>        sockets.forEach((socket) => {
>          socket.send(MDNS_MULTICAST_GROUP, MDNS_PORT, data, data.length);
>        });
>      });
> +    */

We should probably just remove this block instead of commenting it out.
Attachment #8770685 - Flags: review?(jdarcangelo) → review+
Updated patch.
Attachment #8770685 - Attachment is obsolete: true
Attachment #8771453 - Flags: review?(jdarcangelo)
Attachment #8771453 - Flags: review?(jdarcangelo) → review+
Pushed by
Use dedicated custom-port query socket to do mDNS queries.  Respond to queries using per-interface sockets. r=justindarc
Blocks: flyweb
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
this caused a small perf improvement on android (nexus 4.1: ):
Summary of tests that improved:

  remote-blank summary android-4-2-armv7-api15 opt - 2.08% better

thanks for the win!
You need to log in before you can comment on or make changes to this bug.