summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-01 11:46:19 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-01 11:46:19 +0000
commit4488e477136ea3daa60a744bac272cc37a604136 (patch)
tree49ec2884832cea192feb6a667f9ec8d352c14199 /src/modules
parent4789b3f6536ef8267c79c7cb3ee6678546c2150b (diff)
The IPV6 stuff compiles now, with compile-correct ipv6 code. I dont know if this works yet.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4611 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_mysql.cpp17
-rw-r--r--src/modules/m_cgiirc.cpp16
-rw-r--r--src/modules/m_check.cpp11
-rw-r--r--src/modules/m_ident.cpp6
-rw-r--r--src/modules/m_spanningtree.cpp8
-rw-r--r--src/modules/m_userip.cpp2
6 files changed, 43 insertions, 17 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index e3639436b..7f2b96227 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -667,7 +667,11 @@ class Notifier : public InspSocket
public:
/* Create a socket on a random port. Let the tcp stack allocate us an available port */
+#ifdef IPV6
+ Notifier(Server* S) : InspSocket("::1", 0, true, 3000), Srv(S)
+#else
Notifier(Server* S) : InspSocket("127.0.0.1", 0, true, 3000), Srv(S)
+#endif
{
uslen = sizeof(sock_us);
if (getsockname(this->fd,(sockaddr*)&sock_us,&uslen))
@@ -684,7 +688,11 @@ class Notifier : public InspSocket
/* Using getsockname and ntohs, we can determine which port number we were allocated */
int GetPort()
{
+#ifdef IPV6
+ return ntohs(sock_us.sin6_port);
+#else
return ntohs(sock_us.sin_port);
+#endif
}
virtual int OnIncomingConnection(int newsock, char* ip)
@@ -842,11 +850,18 @@ void* DispatcherThread(void* arg)
log(DEBUG,"Initialize QueueFD to %d",QueueFD);
insp_sockaddr addr;
+
+#ifdef IPV6
+ insp_aton("::1", &addr.sin6_addr);
+ addr.sin6_family = AF_FAMILY;
+ addr.sin6_port = htons(MessagePipe->GetPort());
+#else
insp_inaddr ia;
- inet_aton("127.0.0.1", &ia);
+ insp_aton("127.0.0.1", &ia);
addr.sin_family = AF_FAMILY;
addr.sin_addr = ia;
addr.sin_port = htons(MessagePipe->GetPort());
+#endif
if (connect(QueueFD, (sockaddr*)&addr,sizeof(addr)) == -1)
{
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 7da83c610..6426e054a 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -198,16 +198,16 @@ public:
virtual void OnUserRegister(userrec* user)
{
- log(DEBUG, "m_cgiirc.so: User %s registering, %s %s", user->nick,user->host,inet_ntoa(user->ip4));
+ log(DEBUG, "m_cgiirc.so: User %s registering, %s %s", user->nick,user->host,insp_ntoa(user->ip4));
for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++)
{
- log(DEBUG, "m_cgiirc.so: Matching %s against (%s or %s)", iter->hostmask.c_str(), user->host, inet_ntoa(user->ip4));
+ log(DEBUG, "m_cgiirc.so: Matching %s against (%s or %s)", iter->hostmask.c_str(), user->host, insp_ntoa(user->ip4));
- if(Srv->MatchText(user->host, iter->hostmask) || Srv->MatchText(inet_ntoa(user->ip4), iter->hostmask))
+ if(Srv->MatchText(user->host, iter->hostmask) || Srv->MatchText(insp_ntoa(user->ip4), iter->hostmask))
{
// Deal with it...
- log(DEBUG, "m_cgiirc.so: Handling CGI:IRC user: %s (%s) matched %s", user->GetFullRealHost(), inet_ntoa(user->ip4), iter->hostmask.c_str());
+ log(DEBUG, "m_cgiirc.so: Handling CGI:IRC user: %s (%s) matched %s", user->GetFullRealHost(), insp_ntoa(user->ip4), iter->hostmask.c_str());
if(iter->type == PASS)
{
@@ -240,11 +240,11 @@ public:
if(IsValidHost(user->password))
{
user->Extend("cgiirc_realhost", new std::string(user->host));
- user->Extend("cgiirc_realip", new std::string(inet_ntoa(user->ip4)));
+ user->Extend("cgiirc_realip", new std::string(insp_ntoa(user->ip4)));
strlcpy(user->host, user->password, 64);
strlcpy(user->dhost, user->password, 64);
- if(inet_aton(user->password, &user->ip4))
+ if(insp_aton(user->password, &user->ip4))
{
/* We were given a IP in the password, we don't do DNS so they get this is as their host as well. */
log(DEBUG, "m_cgiirc.so: Got an IP in the user's password");
@@ -305,8 +305,8 @@ public:
snprintf(newip, 16, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
user->Extend("cgiirc_realhost", new std::string(user->host));
- user->Extend("cgiirc_realip", new std::string(inet_ntoa(user->ip4)));
- inet_aton(newip, &user->ip4);
+ user->Extend("cgiirc_realip", new std::string(insp_ntoa(user->ip4)));
+ insp_aton(newip, &user->ip4);
try
{
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 29aaaa6dc..e41e60b80 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -160,8 +160,11 @@ class cmd_check : public command_t
/* /check on an IP address, or something that doesn't exist */
insp_sockaddr addr;
long x = 0;
-
- if (inet_aton(parameters[0], &addr.sin_addr) == 0)
+#ifdef IPV6
+ if (insp_aton(parameters[0], &addr.sin6_addr) == 0)
+#else
+ if (insp_aton(parameters[0], &addr.sin_addr) == 0)
+#endif
{
/* hostname or other */
for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++)
@@ -178,11 +181,15 @@ class cmd_check : public command_t
/* IP address */
for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++)
{
+#ifdef IPV6
+ /* TODO: Clone matching for IPV6 ips */
+#else
if (addr.sin_addr.s_addr == a->second->ip4.s_addr)
{
/* same IP. */
Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
}
+#endif
}
}
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 270457af7..76518d5c1 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -43,7 +43,7 @@ class RFC1413 : public InspSocket
userrec* u; // user record that the lookup is associated with
int ufd;
- RFC1413(userrec* user, int maxtime, Server* S) : InspSocket((char*)inet_ntoa(user->ip4), 113, false, maxtime), Srv(S), u(user), ufd(user->fd)
+ RFC1413(userrec* user, int maxtime, Server* S) : InspSocket((char*)insp_ntoa(user->ip4), 113, false, maxtime), Srv(S), u(user), ufd(user->fd)
{
Srv->Log(DEBUG,"Ident: associated.");
}
@@ -149,7 +149,11 @@ class RFC1413 : public InspSocket
else
{
// send the request in the following format: theirsocket,oursocket
+#ifdef IPV6
+ snprintf(ident_request,127,"%d,%d\r\n",ntohs(sock_them.sin6_port),ntohs(sock_us.sin6_port));
+#else
snprintf(ident_request,127,"%d,%d\r\n",ntohs(sock_them.sin_port),ntohs(sock_us.sin_port));
+#endif
this->Write(ident_request);
Srv->Log(DEBUG,"Sent ident request, waiting for reply");
return true;
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index c55662f9f..0725d7b51 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1560,9 +1560,9 @@ class TreeSocket : public InspSocket
{
clientlist[tempnick]->modes[(*v)-65] = 1;
}
- inet_aton(params[6].c_str(),&clientlist[tempnick]->ip4);
+ insp_aton(params[6].c_str(),&clientlist[tempnick]->ip4);
- WriteOpers("*** Client connecting at %s: %s!%s@%s [%s]",clientlist[tempnick]->server,clientlist[tempnick]->nick,clientlist[tempnick]->ident,clientlist[tempnick]->host, inet_ntoa(clientlist[tempnick]->ip4));
+ WriteOpers("*** Client connecting at %s: %s!%s@%s [%s]",clientlist[tempnick]->server,clientlist[tempnick]->nick,clientlist[tempnick]->ident,clientlist[tempnick]->host, insp_ntoa(clientlist[tempnick]->ip4));
params[7] = ":" + params[7];
DoOneToAllButSender(source,"NICK",params,source);
@@ -1767,7 +1767,7 @@ class TreeSocket : public InspSocket
{
if (u->second->registered == REG_ALL)
{
- snprintf(data,MAXBUF,":%s NICK %lu %s %s %s %s +%s %s :%s",u->second->server,(unsigned long)u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->FormatModes(),inet_ntoa(u->second->ip4),u->second->fullname);
+ snprintf(data,MAXBUF,":%s NICK %lu %s %s %s %s +%s %s :%s",u->second->server,(unsigned long)u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->FormatModes(),insp_ntoa(u->second->ip4),u->second->fullname);
this->WriteLine(data);
if (*u->second->oper)
{
@@ -4055,7 +4055,7 @@ class ModuleSpanningTree : public Module
params.push_back(user->dhost);
params.push_back(user->ident);
params.push_back("+"+std::string(user->FormatModes()));
- params.push_back((char*)inet_ntoa(user->ip4));
+ params.push_back((char*)insp_ntoa(user->ip4));
params.push_back(":"+std::string(user->fullname));
DoOneToMany(Srv->GetServerName(),"NICK",params);
diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp
index 4775b518c..d7126684d 100644
--- a/src/modules/m_userip.cpp
+++ b/src/modules/m_userip.cpp
@@ -45,7 +45,7 @@ class cmd_userip : public command_t
userrec *u = Find(parameters[i]);
if (u)
{
- snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,*u->oper ? "*" : "",u->ident,(char*)inet_ntoa(u->ip4));
+ snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,*u->oper ? "*" : "",u->ident,(char*)insp_ntoa(u->ip4));
strlcat(Return,junk,MAXBUF);
}
}