Bug 215545

Summary: net/mDNSResponder mdnsd doesn't bind to second interface
Product: Ports & Packages Reporter: Kirill Pertsev <kika>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (sunpoet)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
disable SO_REUSEADDR for FreeBSD and enable SO_REUSEPORT instead none

Description Kirill Pertsev 2016-12-25 14:07:45 UTC
Created attachment 178258 [details]
disable SO_REUSEADDR for FreeBSD and enable SO_REUSEPORT instead

I have a dual-homed machine which advertises mDNS resources to only one network. After running the mdnsd in debug mode I discovered that it reports "bind: address already in use" when trying to bind to the second interface. 
It appears that on FreeBSD using SO_REUSEADDR is not enough and one needs to use SO_REUSEPORT to successfully receive unicast and multicast packets on the same port on multiple interfaces.

Suggested patch was made against latest Apple upstream version "mDNSResponder-765.20.4"
Comment 1 commit-hook freebsd_committer 2017-04-28 20:25:11 UTC
A commit references this bug:

Author: sunpoet
Date: Fri Apr 28 20:24:29 UTC 2017
New revision: 439627
URL: https://svnweb.freebsd.org/changeset/ports/439627

Log:
  Use SO_REUSEPORT instead of SO_REUSEADDR

  - Bump PORTREVISION for package change

  PR:		215545
  Submitted by:	Kirill Pertsev <kika@kikap.com>

Changes:
  head/net/mDNSResponder/Makefile
  head/net/mDNSResponder/files/patch-mDNSPosix-mDNSPosix.c
Comment 2 Po-Chuan Hsieh freebsd_committer 2017-04-28 20:30:54 UTC
Committed. Thanks!