buglwIP - A Lightweight TCP/IP stack - Bugs: bug #49134, mDNS should not advertise invalid...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #49134: mDNS should not advertise invalid IPv4 address

Submitted by:  Daniel Elstner <danielk>
Submitted on:  Mon 19 Sep 2016 09:18:32 PM UTC  
 
Category: DNSSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Mon 26 Sep 2016 10:10:01 AM UTC, comment #4:

It is recommended to use AUTOIP (169.254/16 addresses) to always have an IPv4 address when using mDNS.

But the patch looks good anyway.

Erik Ekman <yarrick>
Project Member
Wed 21 Sep 2016 10:40:16 AM UTC, comment #3:

I applied the patch because it does normally make things better. The MDNS code has a TODO in its header to implement "goodbye messages" which would resolve my objections.

Dirk Ziegelmeier <dziegel>
Project Member
Tue 20 Sep 2016 01:07:31 PM UTC, comment #2:

Good question. I checked the DHCP code and it does reset the IP to 0.0.0.0 on nak/release, so that part is fine.

Skimming through RFC 6762 now. I'm totally new to all this so please bear with me:

It seems that the way it is supposed to work is that a newly announced A record for the same hostname (or PTR record for the same IP), with the cash-flush bit set, would immediately replace any stale record. This is regardless of who sends it, so if someone else takes over an IP previously used by another host, then that would just work.

However, I can't find any explicit means to flush a cache entry without at the same time providing a replacement. There are some hints though that simply sending the record again with TTL set to 1 second should essentially do the trick.

Not sure if it is worth it to implement that in lwIP. The most common reason for losing a DHCP lease is probably a (temporary) disconnect; in which case we cannot send anything anyway. Also, any stale mDNS record would be flushed anyway as soon as a new lease is obtained after reconnection.

Daniel Elstner <danielk>
Tue 20 Sep 2016 10:27:48 AM UTC, comment #1:

What happens if a device "looses" its IP address, e.g. DHCP lease expires / stop DHCP client. The will be no MDNS announcement of IP loss?

Dirk Ziegelmeier <dziegel>
Project Member
Mon 19 Sep 2016 09:18:32 PM UTC, original submission:

The lwIP mDNS documentation says:

The problem is that this requirement isn't really feasible in a dual-stack configuration using DHCP to configure the IPv4 address. There may or may not be a DHCP server on the network, so the IPv4 address may actually stay invalid indefinitely. However, this should not preclude IPv6 name resolving from working, especially since with IPv6 there will almost always be some valid address, even if only the link-local one.

Thus, it should be possible to activate the mDNS responder right after the interface comes up, without waiting for a DHCPv4 lease which may never arrive.

The attached patch adds some checks to the mDNS code to prevent it from sending 0.0.0.0 in IPv4 A and PTR records. I hope I caught all cases. It does work for me and I'm no longer seeing 0.0.0.0 records in Wireshark; so that's that.

Daniel Elstner <danielk>

 

Attached Files
file #38580:  0001-Fix-bug-49134-Do-not-announce-invalid-IPv4-address-v.patch added by danielk (2KiB - text/x-patch - Updated patch with bug number)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by yarrick (Posted a comment)
  • -unavailable- added by dziegel (Posted a comment)
  • -unavailable- added by danielk (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 21 Sep 2016 10:40:16 AM UTCdziegelStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Tue 20 Sep 2016 09:23:05 PM UTCdanielkAttached File-=>Added 0001-Fix-bug-49134-Do-not-announce-invalid-IPv4-address-v.patch, #38580
    Mon 19 Sep 2016 09:18:32 PM UTCdanielkAttached File-=>Added 0001-Do-not-announce-an-invalid-IPv4-address-via-mDNS.patch, #38559

    Back to the top


    Powered by Savane 3.1-cleanup1