To help test “Project: Sippy-Cup [1],” I wrote a mock component [2] to return precanned data releated to our test data. The mock component is basically a specialized DNS (Domain Name Service) server that only expects a certain type of query. I wrote it so it would be easier to configure and run than a full blown bind [3] installation.
But for the past few weeks it was crashing and pretty much the only report I would get back is “it crashed.” Sigh. I did find the error path in the mock component to be a bit spotty, but this was never intended to be a full blown product but rather something that would work just well enough to get the testing done. I never tested it with bogus queries because I never expected it to get bogus queries. We had control over all the data. The mock component would only talk to programs we were testing.
Even after fixing some “how did I not see that error?” type problems, the mock component was still crashing, and the only way that could happen is if the queries being sent were too large (over 512 bytes), the query was corrupted or malformed and could not be decoded, or if the query wasn't the single query type supported by the mock component. And there was no way any of that could happen. We controlled all the data!
Or so I thought.
It turns out the mock component was receiving God knows what from random computers on the Internet, which is incredible when the computer the mock component is running on **doesn't have a public IP (Internet Procotol) address!**
Well, okay, it does have a public address, but it's a public IPv6 (Internet Procotol version 6) address, but the queries causing the crashes were all coming from IPv4 (Internet Procotol version 4) addresses.
Wow.
About the only thing I got to explain that behavior is the IPv6 address is routed via a tunnel, and perhaps there's some routing leakage that lets public IPv4 packets through. Other than that, I got nothing.
At the very least, I did fix the dodgy error handling so the mock component doesn't crash from data that it shouldn't get.
[2] http://en.wikipedia.org/wiki/Mock_object