Skip to content

espressif: fails to resolve FQDNs with trailing "." #7032

@anecdata

Description

@anecdata

CircuitPython version

Adafruit CircuitPython 8.0.0-beta.1-25-gec855a2b1 on 2022-10-10; Adafruit Feather ESP32-S2 TFT with ESP32S2
Adafruit CircuitPython 8.0.0-beta.1-20-g66f84f5f9 on 2022-10-07; Raspberry Pi Pico W with rp2040

Code/REPL

import socketpool
import wifi
import ipaddress
from secrets import secrets

HOSTS = ("adafruit.com", "adafruit.com.", "circuitpython.local", "circuitpython.local.",)

pool = socketpool.SocketPool(wifi.radio)

wifi.radio.connect(secrets["ssid"], secrets["password"])

for host in HOSTS:
    try:
        print(f"{ipaddress.ip_address(pool.getaddrinfo(host, 443)[0][4][0])}")
    except Exception as e:
        print(f"{e}")

Behavior

espressif:

Adafruit CircuitPython 8.0.0-beta.1-25-gec855a2b1 on 2022-10-10; Adafruit Feather ESP32-S2 TFT with ESP32S2
>>> import code
104.20.38.240
-2
192.168.6.196
-2

raspberrypi:

Adafruit CircuitPython 8.0.0-beta.1-20-g66f84f5f9 on 2022-10-07; Raspberry Pi Pico W with rp2040
>>> import code
104.20.38.240
104.20.38.240
[Errno 2] No such file/directory
[Errno 2] No such file/directory

Description

espressif resolves typical DNS (and mDNS) relative domain names., but does not resolve any FQDNs with the final dot.

raspberrypi resolves typical DNS relative domain names, and DNS FQDNs with the final dot.

Additional information

See: Multicast DNS

Most computer users neglect to type the trailing dot at the end of a fully qualified domain name, making it a relative domain name

This is probably not a significant issue in the big scheme of things. There may be occasions where FQDNs are linked or cut-and-pasted from a browser for use in CircuitPython code, and the final dot is easy to overlook. I mainly wanted to document this in case someone is poking in those areas of the code at some point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugespressifapplies to multiple Espressif chipsnetworkthird-partyAwaiting action on a third party for a fix or an answer to a request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions