lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #58473] Trailing dot in hostname results in extraneous


From: Mate Varga
Subject: [lwip-devel] [bug #58473] Trailing dot in hostname results in extraneous label (and corrupt packet)
Date: Sun, 31 May 2020 17:31:15 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 Edg/83.0.478.37

URL:
  <https://savannah.nongnu.org/bugs/?58473>

                 Summary: Trailing dot in hostname results in extraneous label
(and corrupt packet)
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: matevarga
            Submitted on: Sun 31 May 2020 09:31:13 PM UTC
                Category: DNS
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

Expected behavior:
------------------

When a hostname ending with a dot are looked up using lwip_gethostbyname(),
then the DNS query's QNAME section will contain the right number of labels. 

For example, an A query for foo.barbaz. should result in an UDP packet
fragment like 

3foo6barbaz0101

(3 char long label: foo, 6 char long label: barbaz, type: 1, class 1)

Actual behavior
---------------

LWIP considers the trailing dot as a separate label with zero lenght.
Therefore the above example will result in the following packet fragment:

3foo6barbaz00101

(3 char long label: foo, 6 char long label: barbaz, 0 char long label: , type:
1, class 1)

DNS servers like dnsmasq won't be able to parse this, and it'll likely be
interpreted as a * query with class 256. Site-local lookups will break.

I have attached the patch. I intend to submit a unit test as well.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 31 May 2020 09:31:13 PM UTC  Name:
0001-Does-not-add-an-empty-label-when-encountering-traili.patch  Size: 1KiB  
By: matevarga

<http://savannah.nongnu.org/bugs/download.php?file_id=49191>

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?58473>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]