Ethernet DNSClient returning garbage IP

I’ve been having issues connecting to a couple of websites, I’ve traced it down to the DNSClient returning garbage addresses if for some reason it can’t connect to the DNS server. I’ve got the below code running on a Freetronic’s Etherten (Uno), the below code responds with the IP of 113.0.0.0, even though I don’t even have a network cable plugged in to the Etherten.

A few website’s I’ve tried respond with a random number in the first octet, but other sites are returning 0.0.0.0 as I would expect. One such example is “whirlpool.net.au”, returning 0.0.0.0. This code, without a network cable plugged in always returns 113.0.0.0 on the first and second try for “google.com

This code is being run on OSX 1.0.5, but I’ve also had my main program code do this, using Window’s 1.0.4 of the arduino software. My main program seems to only do it, when the net is being flakey, otherwise it works fine.

Note: This is the 4th Etherten I’ve tried that is exhibiting this behaviour, and all of them have done it so far.

Anyone able to shed some light on this please? I’m guessing at a memory leak somewhere, but nothing has jumped out at me yet.

#include <Ethernet.h>
#include <Dns.h>
#include <SPI.h>

byte MAC[6] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress IP(10, 3, 1, 201);
IPAddress GATEWAY(10, 3, 1, 1);
IPAddress DNS(8, 8, 8, 8);
IPAddress SUBNET(255, 255, 255, 0);

unsigned long dns_loop_retry = 0UL;
IPAddress dnsIP1 = INADDR_NONE;
IPAddress dnsIP2 = INADDR_NONE;
boolean dnsGood = false;

void setup()
{
  
  Ethernet.begin(MAC, IP, DNS, GATEWAY, SUBNET);
  Serial.begin(115200);
  delay(200);
}

void loop()
{
    //INADDR_NONE
  if (!dnsGood && millis() - dns_loop_retry > 1000UL) {
    DNSClient dns;
    dns.begin(Ethernet.dnsServerIP());
    if (dnsIP1 == INADDR_NONE) {
      dns.getHostByName("google.com", dnsIP1);
      Serial.print("1: ");
      Serial.println(dnsIP1);
    } else {
      dns.getHostByName("google.com", dnsIP2);
      Serial.print("2: ");
      Serial.println(dnsIP2);
    }
    if (!(dnsIP1 == INADDR_NONE) && dnsIP1 == dnsIP2) {
      //Serial << "PVOutput IP: " << PVOutputIP1 << endl;
      //xprintf("PVOutput IP: %s\n", PVOutputIP1);
      Serial.print("PVOutput IP: ");
      Serial.println(dnsIP1);
      dnsGood = true;
    }
    dns_loop_retry = millis();
  }
}

Bump, anyone at least get a similar result as to what I'm getting?