summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-16 14:24:42 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-16 14:24:42 +0000
commitc1d478f928e202dadf717fd3552a136192d6fe17 (patch)
treea929aab462d28c3f70c98a692c1a4b051fd5ccc8
parenta9682a795a548eee1db19f424f1cb1ef236538dd (diff)
Fixes to only send SQUIT tokens to servers that are still alive to avoid routing loops
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@614 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd.h1
-rw-r--r--src/connection.cpp2
-rw-r--r--src/inspircd.cpp26
3 files changed, 28 insertions, 1 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index cfdb313f0..bc62f1d31 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -121,6 +121,7 @@ void ChangeDisplayedHost(userrec* user, const char* host);
void NetSendToCommon(userrec* u, char* s);
void NetSendToAll(char* s);
+void NetSendToAllAlive(char* s);
void NetSendToOne(char* target,char* s);
void NetSendToAllExcept(char* target,char* s);
void NetSendMyRoutingTable();
diff --git a/src/connection.cpp b/src/connection.cpp
index a36e9a1df..da8974be3 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -354,7 +354,7 @@ bool connection::SendPacket(char *message, const char* host)
}
char buffer[MAXBUF];
snprintf(buffer,MAXBUF,"& %s",host);
- NetSendToAll(buffer);
+ NetSendToAllAlive(buffer);
log(DEBUG,"There are no routes to %s, we're gonna boot the server off!",host);
return false;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 92ebb4771..70a4735fd 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -929,6 +929,32 @@ void NetSendToAll(char* s)
}
}
+void NetSendToAllAlive(char* s)
+{
+ char buffer[MAXBUF];
+ snprintf(buffer,MAXBUF,"%s",s);
+
+ log(DEBUG,"NetSendToAllAlive: '%s'",s);
+
+ for (int j = 0; j < 32; j++)
+ {
+ if (me[j] != NULL)
+ {
+ for (int k = 0; k < me[j]->connectors.size(); k++)
+ {
+ if (me[j]->connectors[k].GetState() != STATE_DISCONNECTED)
+ {
+ me[j]->SendPacket(buffer,me[j]->connectors[k].GetServerName().c_str());
+ }
+ else
+ {
+ log(DEBUG,"%s is dead, not sending to it.",me[j]->connectors[k].GetServerName.c_str());
+ }
+ }
+ }
+ }
+}
+
void NetSendToOne(char* target,char* s)
{