commited Patch from JEBs with additional comments to bnetd.conf

This commit is contained in:
pandaemonium 2006-11-11 20:30:04 +00:00
parent 0a3910feaa
commit 098a79b2f4
4 changed files with 10 additions and 8 deletions

View file

@ -463,6 +463,7 @@ use_keepalive = false
# Limit maximum number of connections per IP (0 = unlimited)
# this feature is new, so no recommended value so far
# (d2cs connections are exempted from this limitation)
max_conns_per_IP = 0
# This is a comma delimited list of hostnames that the server should

View file

@ -441,6 +441,7 @@ use_keepalive = false
# Limit maximum number of connections per IP (0 = unlimited)
# this feature is new, so no recommended value so far
# (d2cs connections are exempted from this limitation)
max_conns_per_IP = 0
# This is a comma delimited list of hostnames that the server should

View file

@ -24,6 +24,7 @@
#include "common/bn_type.h"
#include "common/addr.h"
#include "prefs.h"
#include "connection.h"
#include "realm.h"
#include "handle_d2cs.h"
@ -53,6 +54,13 @@ extern int handle_init_packet(t_connection * c, t_packet const * const packet)
eventlog(eventlog_level_error,__FUNCTION__,"[%d] got bad packet (class %d)",conn_get_socket(c),(int)packet_get_class(packet));
return -1;
}
if ((prefs_get_max_conns_per_IP()!=0) &&
bn_byte_get(packet->u.client_initconn.cclass)!=CLIENT_INITCONN_CLASS_D2CS_BNETD &&
(connlist_count_connections(conn_get_addr(c)) > prefs_get_max_conns_per_IP()))
{
eventlog(eventlog_level_error,__FUNCTION__,"[%d] too many connections from address %s (closing connection)",conn_get_socket(c),addr_num_to_addr_str(conn_get_addr(c),conn_get_port(c)));
return -1;
}
switch (packet_get_type(packet))
{

View file

@ -271,14 +271,6 @@ static int sd_accept(t_addr const * curr_laddr, t_laddr_info const * laddr_info,
return -1;
}
if ((prefs_get_max_conns_per_IP()!=0) &&
(connlist_count_connections(ntohl(caddr.sin_addr.s_addr)) > prefs_get_max_conns_per_IP()))
{
eventlog(eventlog_level_error,__FUNCTION__,"[%d] too many connections from address %s (closing connection)",csocket,inet_ntoa(caddr.sin_addr));
psock_close(csocket);
return -1;
}
eventlog(eventlog_level_info,__FUNCTION__,"[%d] accepted connection from %s on %s",csocket,addr_num_to_addr_str(ntohl(caddr.sin_addr.s_addr),ntohs(caddr.sin_port)),tempa);
if (prefs_get_use_keepalive())