X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Facess2.git;a=blobdiff_plain;f=Usermode%2FLibraries%2Flibnet.so_src%2Fhostnames.c;fp=Usermode%2FLibraries%2Flibnet.so_src%2Fhostnames.c;h=c3c962681164ac02dbc769c9718792cc107a6424;hp=88093de37d1a3eb3a398564a22c1be784608c392;hb=508aa7d2f1f441ab4c9a7cc4540eb418bc2f9da7;hpb=341d51ca40a4a26ed89914feaacc940c64b22197 diff --git a/Usermode/Libraries/libnet.so_src/hostnames.c b/Usermode/Libraries/libnet.so_src/hostnames.c index 88093de3..c3c96268 100644 --- a/Usermode/Libraries/libnet.so_src/hostnames.c +++ b/Usermode/Libraries/libnet.so_src/hostnames.c @@ -8,7 +8,9 @@ #include #include "include/dns.h" #include +#include // malloc (for loading config) #include +#include // _SysDebug // === TYPES === struct sDNSServer @@ -74,9 +76,16 @@ int int_lookupany_callback(void *info_v, int AddrType, const void *Addr) int Net_Lookup_Addrs(const char *Name, void *cb_info, tNet_LookupAddrs_Callback *callback) { + _SysDebug("Net_Lookup_Addrs(Name='%s')", Name); // 1. Load (if not loaded) the DNS config from "/Acess/Conf/dns" // - "* " for DNS server(s) // - "127.0.0.1 localhost localhost.localdomain" + if( !gaDNSServers ) + { + giNumDNSServers = 1; + gaDNSServers = malloc( 1 * sizeof(gaDNSServers[0]) ); + gaDNSServers[0].AddrType = Net_ParseAddress("192.168.1.1", gaDNSServers[0].AddrData); + } // 2. Check the hosts list for( int i = 0; i < giNumHostEntries; i ++ ) @@ -121,6 +130,7 @@ int Net_Lookup_Addrs(const char *Name, void *cb_info, tNet_LookupAddrs_Callback void int_DNS_callback(void *info_v, const char *name, enum eTypes type, enum eClass class, unsigned int ttl, size_t rdlength, const void *rdata) { struct sDNSCallbackInfo *info = info_v; + _SysDebug("int_DNS_callback(name='%s', type=%i, class=%i)", name, type, class); // Check type matches (if pattern was provided) if( info->desired_type != QTYPE_STAR && type != info->desired_type )