From: Alan T. DeKok Date: Thu, 6 Mar 2025 11:57:46 +0000 (-0500) Subject: print out client name, and rate limit messages X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4aa69f5c3973382b0dd170ff86ca02602c43727f;p=thirdparty%2Ffreeradius-server.git print out client name, and rate limit messages As reported by Hideaki Goto. We do not want to spam the log with many of the same message. We want to include the client name, so that the administrator knows which client is making repeated connection attempts --- diff --git a/src/main/listen.c b/src/main/listen.c index b817248d71..a3855d1f05 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -1151,7 +1151,7 @@ static int dual_tcp_accept(rad_listen_t *listener) switch (listener->tls->radiusv11) { case FR_RADIUSV11_FORBID: if (client->radiusv11 == FR_RADIUSV11_REQUIRE) { - INFO("Ignoring new connection as client is marked as 'radiusv11 = require', and this socket has 'radiusv11 = forbid'"); + RATE_LIMIT(INFO("Ignoring new connection from client %s it is marked as 'radiusv11 = require', and this socket has 'radiusv11 = forbid'", client->shortname)); close(newfd); return 0; } @@ -1165,7 +1165,7 @@ static int dual_tcp_accept(rad_listen_t *listener) case FR_RADIUSV11_REQUIRE: if (client->radiusv11 == FR_RADIUSV11_FORBID) { - INFO("Ignoring new connection as client is marked as 'radiusv11 = forbid', and this socket has 'radiusv11 = require'"); + RATE_LIMIT(INFO("Ignoring new connection from client %s as it is marked as 'radiusv11 = forbid', and this socket has 'radiusv11 = require'", client->shortname)); close(newfd); return 0; } @@ -1184,7 +1184,7 @@ static int dual_tcp_accept(rad_listen_t *listener) /* * FIXME: Print client IP/port, and server IP/port. */ - INFO("Ignoring new connection due to client max_connections (%d)", client->limit.max_connections); + RATE_LIMIT(INFO("Ignoring new connection from client %s due to client max_connections (%d)", client->shortname, client->limit.max_connections)); close(newfd); return 0; } @@ -1195,7 +1195,7 @@ static int dual_tcp_accept(rad_listen_t *listener) /* * FIXME: Print client IP/port, and server IP/port. */ - INFO("Ignoring new connection due to socket max_connections"); + RATE_LIMIT(INFO("Ignoring new connection from client %s due to socket max_connections (%d)", client->shortname, sock->limit.num_connections)); close(newfd); return 0; }