[dns-operations] The Python 3 socket.getaddrinfo() Case Sensitivity Problem

Fred Morris m3047 at m3047.net
Thu Jul 4 21:46:21 UTC 2019


Every once in a while I come across an architectural issue on the
horizon, so to speak. Past examples have included the AWS VPC panel
"defaulting" to UDP-only for DNS, and the Firefox + Apache "." problem.

Today I bring to you the Python3 socket implementation, which appears to
be case sensitive when doing DNS resolutions:

    |# python3 Python 3.6.5 (default, Mar 31 2018, 19:45:04) [GCC] on
    linux Type "help", "copyright", "credits" or "license" for more
    information. >>> from socket import getaddrinfo >>>
    getaddrinfo('sophia.m3047',6379) [(<AddressFamily.AF_INET: 2>,
    <SocketKind.SOCK_STREAM: 1>, 6, '', ('209.221.140.128', 6379)),
    (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '',
    ('209.221.140.128', 6379)), (<AddressFamily.AF_INET: 2>,
    <SocketKind.SOCK_RAW: 3>, 0, '', ('209.221.140.128', 6379))] >>>
    getaddrinfo('SOPHIA.m3047',6379) [(<AddressFamily.AF_INET: 2>,
    <SocketKind.SOCK_STREAM: 1>, 6, '', ('10.0.0.224', 6379)),
    (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '',
    ('10.0.0.224', 6379)), (<AddressFamily.AF_INET: 2>,
    <SocketKind.SOCK_RAW: 3>, 0, '', ('10.0.0.224', 6379))] >>>
    getaddrinfo('does-not-exist.m3047',6379) [(<AddressFamily.AF_INET:
    2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('209.221.140.128', 6379)),
    (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '',
    ('209.221.140.128', 6379)), (<AddressFamily.AF_INET: 2>,
    <SocketKind.SOCK_RAW: 3>, 0, '', ('209.221.140.128', 6379))]|

I've taken to using dnspython when available:
https://github.com/m3047/shodohflo/blob/df61b838d82ca64aa49b1978236fad38ec273bd2/agents/pcap_agent.py#L155

--

Fred Morris


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dns-oarc.net/pipermail/dns-operations/attachments/20190704/b52a7c74/attachment.html>


More information about the dns-operations mailing list