-/* $OpenBSD: radiusd_ipcp.c,v 1.11 2024/08/16 09:52:16 yasuoka Exp $ */
+/* $OpenBSD: radiusd_ipcp.c,v 1.12 2024/08/16 09:54:21 yasuoka Exp $ */
/*
* Copyright (c) 2024 Internet Initiative Japan Inc.
static void ipcp_del_db(struct module_ipcp *, struct assigned_ipv4 *);
static void ipcp_db_dump_fill_record(struct radiusd_ipcp_db_dump *, int,
struct assigned_ipv4 *);
+static void ipcp_update_time(struct module_ipcp *);
static void ipcp_on_timer(int, short, void *);
static void ipcp_schedule_timer(struct module_ipcp *);
static void ipcp_dae_send_disconnect_request(struct assigned_ipv4 *);
TAILQ_INIT(&self->daes);
self->seq = 1;
self->no_session_timeout = true;
+ ipcp_update_time(self);
}
void
struct module_ipcp_dae *dae;
int sock;
+ ipcp_update_time(self);
if (self->start_wait == 0)
self->start_wait = RADIUSD_IPCP_START_WAIT;
struct module_ipcp *self = ctx;
struct module_ipcp_dae *dae;
+ ipcp_update_time(self);
/* stop the sockets for DAE */
TAILQ_FOREACH(dae, &self->daes, next) {
if (dae->sock >= 0) {
struct radiusctl_client *client;
const char *cause;
+ ipcp_update_time(self);
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
switch (imsg->hdr.type) {
case IMSG_RADIUSD_MODULE_CTRL_UNBIND:
struct user *user = NULL;
struct assigned_ipv4 *assigned = NULL, *assign;
- clock_gettime(CLOCK_BOOTTIME, &self->uptime);
+ ipcp_update_time(self);
if ((radres = radius_convert_packet(res, reslen)) == NULL) {
log_warn("%s: radius_convert_packet() failed", __func__);
stat;
struct module_ipcp_dae *dae;
- clock_gettime(CLOCK_BOOTTIME, &self->uptime);
+ ipcp_update_time(self);
if ((radpkt = radius_convert_packet(pkt, pktlen)) == NULL) {
log_warn("%s: radius_convert_packet() failed", __func__);
/***********************************************************************
* Timer
***********************************************************************/
+void
+ipcp_update_time(struct module_ipcp *self)
+{
+ clock_gettime(CLOCK_BOOTTIME, &self->uptime);
+}
+
void
ipcp_on_timer(int fd, short ev, void *ctx)
{
struct module_ipcp *self = ctx;
- clock_gettime(CLOCK_BOOTTIME, &self->uptime);
+ ipcp_update_time(self);
ipcp_schedule_timer(self);
}
const char *cause = "";
struct radiusctl_client *client;
+ ipcp_update_time(self);
+
if ((ev & EV_READ) == 0)
return;