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

Submitter:  Daniel Elstner <danielk>
Submitted:  Mon 19 Sep 2016 09:18:32 PM UTC
   
 
Category:  DNS Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned 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>
Group 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>
Group administrator
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>
Group administrator
Mon 19 Sep 2016 09:18:32 PM UTC, original submission:  

The lwIP mDNS documentation says:


It is recommended to call this function after an IPv4 address has been set,
since there is currently no check if the v4 address is valid.


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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

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
  • -email is unavailable- added by yarrick (Posted a comment)
  • -email is unavailable- added by dziegel (Posted a comment)
  • -email is unavailable- added by danielk (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-21 dziegel StatusNone Fixed
        Open/ClosedOpen Closed
    2016-09-20 danielk Attached File- Added 0001-Fix-bug-49134-Do-not-announce-invalid-IPv4-address-v.patch, #38580
    2016-09-19 danielk Attached File- Added 0001-Do-not-announce-an-invalid-IPv4-address-via-mDNS.patch, #38559

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code