diff --git a/Changes b/Changes index 24dcec4d2..b0ee2a995 100644 --- a/Changes +++ b/Changes @@ -286,3 +286,5 @@ (acptr is not cptr) - Made set::modes-on-connect work :) (strip out MODE_X and stuff plz?) - Moved dynconf stuff from s_svs.c to s_conf.c, on popular request +- Made NAME_SERVER (set::dns::nameserver work). The IRCd no longer + uses /etc/resolv.conf as reference. diff --git a/src/res.c b/src/res.c index fa16bd000..04229b12c 100644 --- a/src/res.c +++ b/src/res.c @@ -111,12 +111,12 @@ int op; if (op & RES_CALLINIT) { ret = res_init(); - if (!_res.nscount) - { + /*if (!_res.nscount) + {*/ _res.nscount = 1; _res.nsaddr_list[0].SIN_ADDR.S_ADDR = - inet_addr("127.0.0.1"); - } + inet_addr(NAME_SERVER); + /* }*/ } if (op & RES_INITSOCK) diff --git a/src/s_conf.c b/src/s_conf.c index 095f698ea..5b190890a 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -2432,6 +2432,7 @@ void validate_configuration(void) ConfigItem_link *link_ptr; ConfigItem t; short hide_host = 1; + struct in_addr in; /* Let us validate dynconf first */ if (!KLINE_ADDRESS || (*KLINE_ADDRESS == '\0')) @@ -2456,6 +2457,20 @@ void validate_configuration(void) iNAH = 0; Warning("set::host-on-oper-op is invalid. Disabling by default"); } + if (!NAME_SERVER) + { + Warning("set::dns::nameserver is missing. Using 127.0.0.1 as default"); + NAME_SERVER = strdup("127.0.0.1"); + } + else + { + in.s_addr = inet_addr(NAME_SERVER); + if (strcmp((char *)inet_ntoa(in), NAME_SERVER)) + { + Warning("set::dns::nameserver (%s) is not an valid IP. Using 127.0.0.1 as default", NAME_SERVER); + ircstrdup(NAME_SERVER, "127.0.0.1"); + } + } if (HOST_TIMEOUT < 0 || HOST_TIMEOUT > 180) { HOST_TIMEOUT = 2; Warning("set::dns::timeout is invalid. Using default of 2 seconds");