[zeroconf] advertised IP address not updated on new connection

/df

Well-Known Member
HD-Fox T2
zeroconf 1.5-2
CFW 3.03

I found that the IP address advertised by mdnsd wasn't updated after making a WiFi connection.

At startup the ethernet interface eth0 is assigned the address 192.0.2.100 (even though eth0 is not connected - which seems like a bug in itself) and mdnsd advertises this address. When the wifi connection is established eth0, being disconnected, is disabled and wlan0 acquires a valid IP address through DHCP. However an attempt to connect to the HD Fox as humax.local still tries to use 192.0.2.100.

I modified /mod/etc/init.d/S80mdnsd to detect changes to /etc/hosts as follows, which fixed the problem. Doubtless there is a less kludgey solution, eg not requiring S80mdnsd to hang around.

Code:
line 12-
+			first=
+			while [ -z "$first" ] || inotifywait -e modify /etc/hosts; do
+			first=no
			interface="`/sbin/route | /bin/sed -n '$ {
				s/.* //
				p
			}'`"
			echo "    MDNS interface: [$interface]"
-			[ -z "$interface"  ] && interface=eth0
+			[ -z "$interface" -o "$interface" = "Iface" ] && interface=eth0

			/bin/ip route add 224.0.0.0/4 dev $interface
+			killall -q mdnsd
+			/mod/sbin/mdnsd &
+			done
And with my 1st post, many thanks to all those who have contributed to the impressive HD/HDR-Fox T2 customised firmware ecosystem.
 
Last edited:
Wow, that's a blast from the past, I haven't touched that code since 2012 when I added LLMNR support.
I've just had a read through and you're right, it can't handle changes in IP address and will start before the wireless connection comes up.
Your solution looks good and I don't have anything better off the top of my head (besides building the inotify watch into the mdns daemon itself).
 
On reflection, shouldn't there be mdns hooks in /etc/network/interfaces and/or udhcpd's action script?
 
Can we get this added in to the S80 file by default please? Just had to rebuild my system before Christmas and just found that I needed to reapply this fix..
 
I'm also seeing a further issue with mdns/zeroconf.

In a configuration with multiple HD/HDRs, although one device may acquire a .local DNS name, the other machines don't find out about it.

As far as I can tell, for this to happen automatically through mdnsd, the NSSwitch function (which allows configuration of name resolution services) would have to be available, but the uClibc build that came with the Humax software has this disabled in the build (IIRC) and the relevant configuration file is in RO flash (though a bind mount could fix that).

Alternatively, there could be
  • a listener on the Humaxes that updates /etc/hosts based on advertisements of acquired MDNS names; or
  • a function in a local DNS service (eg, proxy DNS server in household ISP router) that updates the local DNS based on advertisements of acquired MDNS names.
Apparently the latter isn't present in a Technicolor (aka Thomson) TG585.
 
Back
Top