summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/connection.cpp15
-rw-r--r--src/inspircd.cpp68
2 files changed, 74 insertions, 9 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 9ee559725..4867cc55b 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -70,10 +70,17 @@ bool connection::CreateListener(char* host, int p)
this->port = p;
- setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(const char*)&on,sizeof(on));
- linger.l_onoff = 1;
- linger.l_linger = 0;
- setsockopt(fd,SOL_SOCKET,SO_LINGER,(const char*)&linger,sizeof(linger));
+ setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(const char*)&on,sizeof(on));
+ linger.l_onoff = 1;
+ linger.l_linger = 0;
+ setsockopt(fd,SOL_SOCKET,SO_LINGER,(const char*)&linger,sizeof(linger));
+
+ // attempt to increase socket sendq and recvq as high as its possible
+ // to get them on linux.
+ int sendbuf = 32768;
+ int recvbuf = 32768;
+ setsockopt(fd,SOL_SOCKET,SO_SNDBUF,(const void *)&sendbuf,sizeof(sendbuf));
+ setsockopt(fd,SOL_SOCKET,SO_RCVBUF,(const void *)&recvbuf,sizeof(sendbuf));
return true;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 2996d5825..3cd832b89 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -3911,11 +3911,45 @@ void handle_kill(char **parameters, int pcnt, userrec *user)
log(DEBUG,"kill: %s %s",parameters[0],parameters[1]);
if (u)
{
- WriteTo(user, u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerName,user->dhost,user->nick,parameters[1]);
- // :Brain!brain@NetAdmin.chatspike.net KILL [Brain] :homer!NetAdmin.chatspike.net!Brain (test kill)
- WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)",user->nick,u->nick,u->ident,u->host,parameters[1]);
- sprintf(killreason,"Killed (%s (%s))",user->nick,parameters[1]);
- kill_link(u,killreason);
+ if (strcmp(ServerName,u->server))
+ {
+ // remote kill
+ WriteOpers("*** Remote kill: %s!%s@%s (%s)",user->nick,u->nick,u->ident,u->host,parameters[1]);
+ sprintf(killreason,"[%s] Killed (%s (%s))",u->server,user->nick,parameters[1]);
+ WriteCommonExcept(user,"QUIT :%s",killreason);
+ // K token must go to ALL servers!!!
+ char buffer[MAXBUF];
+ snprintf(buffer,MAXBUF,"K %s :%s",user->nick,killreason);
+ for (int j = 0; j < 255; j++)
+ {
+ if (servers[j] != NULL)
+ {
+ if (strcmp(servers[j]->name,ServerName))
+ {
+ me[defaultRoute]->SendPacket(buffer,servers[j]->internal_addr,servers[j]->internal_port,MyKey);
+ log(DEBUG,"Sent K token");
+ }
+ }
+ }
+ user_hash::iterator iter = clientlist.find(user->nick);
+ if (iter != clientlist.end())
+ {
+ log(DEBUG,"deleting user hash value %d",iter->second);
+ if ((iter->second) && (user->registered == 7)) {
+ delete iter->second;
+ }
+ clientlist.erase(iter);
+ }
+ purge_empty_chans();
+ }
+ else
+ {
+ // local kill
+ WriteTo(user, u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerName,user->dhost,user->nick,parameters[1]);
+ WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)",user->nick,u->nick,u->ident,u->host,parameters[1]);
+ sprintf(killreason,"Killed (%s (%s))",user->nick,parameters[1]);
+ kill_link(u,killreason);
+ }
}
else
{
@@ -6233,6 +6267,25 @@ void handle_L(char token,char* params,serverrec* source,serverrec* reply, char*
}
}
+void handle_K(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port)
+{
+ char* src = strtok(params," ");
+ char* nick = strtok(NULL," :");
+ char* reason = strtok(NULL,"\r\n");
+ reason++;
+
+ userrec* u = Find(nick);
+ userrec* user = Find(src);
+
+ if ((user) && (u))
+ {
+ WriteTo(user, u, "KILL %s :%s!%s!%s!%s (%s)", u->nick, source->name,ServerName,user->dhost,user->nick,reason);
+ WriteOpers("*** Remote kill from %s by %s: %s!%s@%s (%s)",source->name,user->nick,u->nick,u->ident,u->host,reason);
+ snprintf(reason,MAXQUIT,"[%s] Killed (%s (%s))",source->name,user->nick,reason);
+ kill_link(u,reason);
+ }
+}
+
void handle_Q(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port)
{
char* nick = strtok(params," :");
@@ -6501,6 +6554,11 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve
case 'Q':
handle_Q(token,params,source,reply,udp_host,udp_port);
break;
+ // K <SOURCE> :<REASON>
+ // remote kill
+ case 'K':
+ handle_K(token,params,source,reply,udp_host,udp_port);
+ break;
// F <TS>
// end netburst
case 'F':