From 340e98a9ed7e10a893201baedfc21bdb5464668c Mon Sep 17 00:00:00 2001 From: YASUOKA Masahiko Date: Thu, 7 Nov 2024 06:37:19 +0000 Subject: Log the username when rejecting by ipcp. --- usr.sbin/radiusd/radiusd_ipcp.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/radiusd/radiusd_ipcp.c b/usr.sbin/radiusd/radiusd_ipcp.c index 58a42c7b895..d2adfb4c168 100644 --- a/usr.sbin/radiusd/radiusd_ipcp.c +++ b/usr.sbin/radiusd/radiusd_ipcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiusd_ipcp.c,v 1.17 2024/09/15 05:31:23 yasuoka Exp $ */ +/* $OpenBSD: radiusd_ipcp.c,v 1.18 2024/11/07 06:37:18 yasuoka Exp $ */ /* * Copyright (c) 2024 Internet Initiative Japan Inc. @@ -780,9 +780,9 @@ ipcp_resdeco(void *ctx, u_int q_id, const u_char *req, size_t reqlen, msraserr = 935; if (self->max_sessions != 0) { if (self->nsessions >= self->max_sessions) { - log_info("q=%u rejected: number of " + log_info("q=%u user=%s rejected: number of " "sessions reached the limit(%d)", q_id, - self->max_sessions); + user->name, self->max_sessions); goto reject; } } @@ -791,9 +791,9 @@ ipcp_resdeco(void *ctx, u_int q_id, const u_char *req, size_t reqlen, TAILQ_FOREACH(assign, &user->ipv4s, next) n++; if (n >= self->user_max_sessions) { - log_info("q=%u rejected: number of " + log_info("q=%u user=%s rejected: number of " "sessions per a user reached the limit(%d)", - q_id, self->user_max_sessions); + q_id, user->name, self->user_max_sessions); goto reject; } } @@ -802,8 +802,9 @@ ipcp_resdeco(void *ctx, u_int q_id, const u_char *req, size_t reqlen, if (radius_get_ipv4_attr(radres, RADIUS_TYPE_FRAMED_IP_ADDRESS, &addr4) == 0) { if (ipcp_ipv4_find(self, addr4) != NULL) - log_info("q=%u rejected: server requested IP " - "address is busy", q_id); + log_info("q=%u user=%s rejected: server " + "requested IP address is busy", q_id, + user->name); else { /* compare in host byte order */ addr4.s_addr = ntohl(addr4.s_addr); @@ -816,9 +817,10 @@ ipcp_resdeco(void *ctx, u_int q_id, const u_char *req, size_t reqlen, break; } if (addr == NULL) - log_info("q=%u rejected: server " - "requested IP address is out of " - "the range", q_id); + log_info("q=%u user=%s rejected: " + "server requested IP address is " + "out of the range", q_id, + user->name); else found = true; /* revert the addr to the network byte order */ @@ -855,8 +857,8 @@ ipcp_resdeco(void *ctx, u_int q_id, const u_char *req, size_t reqlen, } } if (!found) { - log_info("q=%u rejected: ran out of the " - "address pool", q_id); + log_info("q=%u user=%s rejected: ran out of " + "the address pool", q_id, user->name); goto reject; } } -- cgit v1.2.3