]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
print out client name, and rate limit messages
authorAlan T. DeKok <aland@freeradius.org>
Thu, 6 Mar 2025 11:57:46 +0000 (06:57 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 6 Mar 2025 11:57:46 +0000 (06:57 -0500)
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

src/main/listen.c

index b817248d71906f14efa7951157207268d268b104..a3855d1f05c4febd92c819926be4bdfcb5cba03c 100644 (file)
@@ -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;
        }