summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-06-28 10:53:02 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-06-28 10:53:02 +0000
commit4d394250d983ab25fd6e52c45204d61b22e5335e (patch)
tree7f2cb74c8f53ade6cc2ff374fdb1153f3c58b47d
parenta5d5953824b948b62c2d899812fd9f27603784d6 (diff)
Allow binding to hosts again in <bind> and <link>
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4074 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/inspsocket.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 012fc38de..651a02b71 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -26,6 +26,7 @@
#include "inspstring.h"
#include "helperfuncs.h"
#include "socketengine.h"
+#include "message.h"
extern InspIRCd* ServerInstance;
@@ -177,9 +178,21 @@ bool InspSocket::BindAddr()
std::string IP = Conf.ReadValue("bind","address",j);
if (Type == "servers")
{
- if ((IP != "*") && (IP != "127.0.0.1"))
+ if ((IP != "*") && (IP != "127.0.0.1") && (IP != ""))
{
insp_sockaddr s;
+ char resolved_addr[MAXBUF];
+
+ if (!inet_aton(IP.c_str(),&n))
+ {
+ /* If they gave a hostname, bind to the IP it resolves to */
+ log(DEBUG,"Resolving host %s",IP.c_str());
+ if (CleanAndResolve(resolved_addr, IP.c_str(), true))
+ {
+ log(DEBUG,"Resolved host %s to %s",IP.c_str(),resolved_addr);
+ IP = resolved_addr;
+ }
+ }
if (inet_aton(IP.c_str(),&n))
{