<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>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.</p>
<p>Today I bring to you the Python3 socket implementation, which
appears to be case sensitive when doing DNS resolutions:</p>
<blockquote>
<pre><code># 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))]</code></pre>
</blockquote>
<p>I've taken to using <tt>dnspython</tt> when available:
<a class="moz-txt-link-freetext" href="https://github.com/m3047/shodohflo/blob/df61b838d82ca64aa49b1978236fad38ec273bd2/agents/pcap_agent.py#L155">https://github.com/m3047/shodohflo/blob/df61b838d82ca64aa49b1978236fad38ec273bd2/agents/pcap_agent.py#L155</a></p>
<p>--</p>
<p>Fred Morris</p>
<p><br>
</p>
</body>
</html>