Module: ngircd.git
Branch: master
Commit: 30b32e84fe352f7c39ceca1a9c6df60ca50e83ab
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=30b32e84…
Author: Alexander Barton <alex(a)barton.de>
Date: Mon Oct 29 11:44:45 2012 +0100
Fix warning message introduced when cleaning up IRC_SERVER()
This reverts a not intentional code change and fixes the following compiler
warning message (tested with gcc 4.4.5):
irc-server.c: In function "IRC_SERVER":
irc-server.c:142: warning: suggest parentheses around operand of "!"
or change "&" to "&&" or "!" to "~"
---
src/ngircd/irc-server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ngircd/irc-server.c b/src/ngircd/irc-server.c
index 02e3ae8..a587c52 100644
--- a/src/ngircd/irc-server.c
+++ b/src/ngircd/irc-server.c
@@ -139,7 +139,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
if (Client_Type(Client) == CLIENT_GOTPASS) {
/* We got a "simple" PASS command, so the peer is
* using the protocol as defined in RFC 1459. */
- if (!Conn_Options(Client_Conn(Client)) & CONN_RFC1459)
+ if (! (Conn_Options(Client_Conn(Client)) & CONN_RFC1459))
Log(LOG_INFO,
"Switching connection %d (\"%s\") to RFC 1459 compatibility mode.",
Client_Conn(Client), Client_ID(Client));
Module: ngircd.git
Branch: master
Commit: fb924933765238808feb05fb7178402058026897
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=fb924933…
Author: Alexander Barton <alex(a)barton.de>
Date: Sun Oct 28 20:19:57 2012 +0100
Make server reconnect time a little bit more random
Add randomly up to 15 seconds to the reconnect delay for outgoing server
links when the connection has been "short" and therefore the "ConnectRetry"
delay is being enforced.
This should make it even more unlikely that two servers deadlock each
other when both are trying to connect to the other one at the same time,
for example in test environments.
---
src/ngircd/conf.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
index 6a7f633..8152512 100644
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -481,8 +481,12 @@ Conf_UnsetServer( CONN_ID Idx )
* require the next attempt to be delayed. */
Conf_Server[i].lasttry =
t - Conf_ConnectRetry + RECONNECT_DELAY;
- } else
- Conf_Server[i].lasttry = t;
+ } else {
+ /* "Short" connection, enforce "ConnectRetry"
+ * but randomize it a little bit: 15 seconds. */
+ Conf_Server[i].lasttry =
+ t + rand() / (RAND_MAX / 15);
+ }
}
}
}
Module: ngircd.git
Branch: master
Commit: eb4f9eac0c35071838c9367f1204db0d0b98ad2e
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=eb4f9eac…
Author: Alexander Barton <alex(a)barton.de>
Date: Sun Oct 28 19:48:24 2012 +0100
Don't accept connections for servers already beeing linked
If two servers try to link each other, there was a time frame that
could result in one connection overwriting the other, e. g. the incoming
connection overwriting the status of the outgoing one. And this could
lead to all kind of weirdness (even crashes!) later on.
So now such incoming connections are dropped. But this most probably
prevents the two servers from linking until timing changes somehow
(network latency?) because each server drops the incoming connection of
the other one, so no connection survives in the end.
But this has to be addressed by an other patch ...
---
src/ngircd/conf.c | 14 ++++++++------
src/ngircd/conf.h | 2 +-
src/ngircd/conn.c | 3 ++-
src/ngircd/irc-server.c | 7 ++++---
4 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
index b600570..6a7f633 100644
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -490,7 +490,7 @@ Conf_UnsetServer( CONN_ID Idx )
/**
* Set connection information for specified configured server.
*/
-GLOBAL void
+GLOBAL bool
Conf_SetServer( int ConfServer, CONN_ID Idx )
{
assert( ConfServer > NONE );
@@ -498,13 +498,15 @@ Conf_SetServer( int ConfServer, CONN_ID Idx )
if (Conf_Server[ConfServer].conn_id > NONE &&
Conf_Server[ConfServer].conn_id != Idx) {
- Log(LOG_ALERT,
- "Trying to update connection index for already registered server \"%s\": %d/%d - ignored.",
- Conf_Server[ConfServer].name,
- Conf_Server[ConfServer].conn_id, Idx);
- return;
+ Log(LOG_ERR,
+ "Connection %d: Server configuration of \"%s\" already in use by connection %d!",
+ Idx, Conf_Server[ConfServer].name,
+ Conf_Server[ConfServer].conn_id);
+ Conn_Close(Idx, NULL, "Server configuration already in use", true);
+ return false;
}
Conf_Server[ConfServer].conn_id = Idx;
+ return true;
}
/**
diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h
index 541fdb2..7860f01 100644
--- a/src/ngircd/conf.h
+++ b/src/ngircd/conf.h
@@ -242,7 +242,7 @@ GLOBAL bool Conf_Rehash PARAMS((void));
GLOBAL int Conf_Test PARAMS((void));
GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
-GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
+GLOBAL bool Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 5d08685..80b085a 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -2079,7 +2079,8 @@ New_Server( int Server , ng_ipaddr_t *dest)
Client_SetToken( c, TOKEN_OUTBOUND );
/* Register connection */
- Conf_SetServer(Server, new_sock);
+ if (!Conf_SetServer(Server, new_sock))
+ return;
My_Connections[new_sock].sock = new_sock;
My_Connections[new_sock].addr = *dest;
My_Connections[new_sock].client = c;
diff --git a/src/ngircd/irc-server.c b/src/ngircd/irc-server.c
index 79facf5..02e3ae8 100644
--- a/src/ngircd/irc-server.c
+++ b/src/ngircd/irc-server.c
@@ -104,6 +104,10 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
if (!Client_CheckID(Client, Req->argv[0]))
return DISCONNECTED;
+ /* Mark this connection as belonging to an configured server */
+ if (!Conf_SetServer(i, Client_Conn(Client)))
+ return DISCONNECTED;
+
Client_SetID( Client, Req->argv[0] );
Client_SetHops( Client, 1 );
Client_SetInfo( Client, Req->argv[Req->argc - 1] );
@@ -131,9 +135,6 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
Client_SetToken(Client, atoi(Req->argv[1]));
}
- /* Mark this connection as belonging to an configured server */
- Conf_SetServer(i, Client_Conn(Client));
-
/* Check protocol level */
if (Client_Type(Client) == CLIENT_GOTPASS) {
/* We got a "simple" PASS command, so the peer is
Module: ngircd.git
Branch: master
Commit: 8ff153d7d40e4933e5ac66016ac30d35cbde3227
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=8ff153d7…
Author: Alexander Barton <alex(a)barton.de>
Date: Sun Oct 28 20:36:58 2012 +0100
Document new configuration option "MaxListSize"
---
ChangeLog | 2 ++
NEWS | 2 ++
man/ngircd.conf.5.tmpl | 3 +++
3 files changed, 7 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index a14f9f7..1e2392e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,8 @@
ngIRCd
+ - New configuration option "MaxListSize" to configure the maximum number
+ of channels returned by a LIST command. The default is 100, as before.
- Implement user mode "b", "block messages": when a user has set mode "b",
all private messages and notices to this user are blocked if they don't
originate from a registered user, an IRC Op, server or service. The
diff --git a/NEWS b/NEWS
index fd906b2..95d5372 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@
ngIRCd
+ - New configuration option "MaxListSize" to configure the maximum number
+ of channels returned by a LIST command. The default is 100, as before.
- Implement user mode "b", "block messages": when a user has set mode "b",
all private messages and notices to this user are blocked if they don't
originate from a registered user, an IRC Op, server or service. The
diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl
index 5f9d6dd..03fac57 100644
--- a/man/ngircd.conf.5.tmpl
+++ b/man/ngircd.conf.5.tmpl
@@ -182,6 +182,9 @@ Maximum length of an user nick name (Default: 9, as in RFC 2812). Please
note that all servers in an IRC network MUST use the same maximum nick name
length!
.TP
+\fBMaxListSize\fR (number)
+Maximum number of channels returned in response to a LIST command. Default: 100.
+.TP
\fBPingTimeout\fR (number)
After <PingTimeout> seconds of inactivity the server will send a PING to
the peer to test whether it is alive or not. Default: 120.
Module: ngircd.git
Branch: master
Commit: 58abd0777b0924e5cb8fa6c01b56305d9b175608
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=58abd077…
Author: DNS <dns(a)rbose.org>
Date: Thu Oct 11 01:53:20 2012 +0200
Increased maximum number of possible user and channel modes
Currntly ngIRCd supports 13 user and 15 channel modes, because there
have been quite a few additions since our last release. But our data
structures can only hold 15 user and -- even worse! -- only 9 channel
modes! So enlarge the buffers to 20 bytes (actually 21 including NULL)
to allow storing of all mode characters and to have some space left
for more modes to come ...
(cherry picked from commit 8996d777621d88d4bcc439ab4792b2814920687f)
---
src/ngircd/defines.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ngircd/defines.h b/src/ngircd/defines.h
index 977bc74..b387493 100644
--- a/src/ngircd/defines.h
+++ b/src/ngircd/defines.h
@@ -108,7 +108,7 @@
#define CLIENT_HOST_LEN 64
/** Max. length of all client modes (including NULL). */
-#define CLIENT_MODE_LEN 16
+#define CLIENT_MODE_LEN 21
/** Max. length of server info texts (including NULL). */
#define CLIENT_INFO_LEN 64
@@ -123,7 +123,7 @@
#define CHANNEL_NAME_LEN 51
/** Max. length of channel modes (including NULL). */
-#define CHANNEL_MODE_LEN 9
+#define CHANNEL_MODE_LEN 21
/** Max. IRC command length (including NULL), see. RFC 2812 section 3.2. */
#define COMMAND_LEN 513