richb-hanover / ndt

Automatically exported from code.google.com/p/ndt
Other
1 stars 0 forks source link

pcap filter fails for IPs with reverse but without forward lookup #81

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If a client connects from an IP that has a valid DNS reverse lookup but an 
invalid forward lookup, the pcap filter will fail and the NDT client test will 
fail.

For example:

# host 209.66.96.66 
66.96.66.209.in-addr.arpa domain name pointer 209.66.96.66.available.above.net.
# host 209.66.96.66.available.above.net
Host 209.66.96.66.available.above.net not found: 3(NXDOMAIN)

src/web100-pcap.c creates a pcap filter using the reverse-resolved DNS name, 
i.e.:

   "host 209.66.96.66.available.above.net and port 44656"

But fails to resolve the hostname, and the test fails.

I do not believe that client DNS should cause an NDT test failure.

A fix could be to use the IP (rather than DNS name) for 'host' in the pcap 
filter.

The only risk I can imagine is if there might be problems with IPv4/IPv6.  Does 
anyone know of a reason that the pcap filter should NOT use the client IP 
directly?

Original issue reported on code.google.com by solt...@opentechinstitute.org on 19 Apr 2013 at 5:52

GoogleCodeExporter commented 9 years ago
I've got a patch that should do filtering on IP instead of hostname. I've 
attached the patch, and tested it on one of my boxes here. It seemed to work 
for me, but it'd be good if others tested.

Did you install via RPM or tarball? If the former, I can generate RPMs for you 
to test.

Original comment by AaronMat...@gmail.com on 21 Apr 2013 at 3:56

Attachments:

GoogleCodeExporter commented 9 years ago
It's probably simpler to use getnameinfo here.

Something along the lines of

// In case getnameinfo fails make sure we null-terminate namebuf
namebuf[0] = 0;
getnameinfo(sock_addr, I2AddrSockLen(sockAddr), namebuf, sizeof(namebuf), NULL, 
0, NI_NUMERICHOST)

This avoids separate IPv4 and IPv6 cases.

Original comment by rsanger...@gmail.com on 24 Apr 2013 at 2:15

GoogleCodeExporter commented 9 years ago
Sigh. I managed to forget about getnameinfo function...

Original comment by AaronMat...@gmail.com on 24 Apr 2013 at 3:04

GoogleCodeExporter commented 9 years ago

Original comment by jslawin...@soldevelo.com on 25 Jun 2014 at 8:28