-/* $OpenBSD: radiusd_eap2mschap.c,v 1.3 2024/08/16 09:52:16 yasuoka Exp $ */
+/* $OpenBSD: radiusd_eap2mschap.c,v 1.4 2024/09/15 05:31:23 yasuoka Exp $ */
/*
* Copyright (c) 2024 Internet Initiative Japan Inc.
goto fail;
case EAP_TYPE_MSCHAPV2:
if (msgsiz < offsetof(struct eap, value[1])) {
- log_warnx(
- "q=%u EAP state=%s Received message has wrong in "
- "size for EAP-MS-CHAPV2: received length %zu "
- "eap.length=%u", q_id, hex_string(state, statesiz,
- buf2, sizeof(buf2)), msgsiz, ntohs(eap->length));
+ log_warnx("q=%u EAP state=%s Received message has "
+ "wrong in size for EAP-MS-CHAPV2: received length "
+ "%zu eap.length=%u", q_id,
+ hex_string(state, statesiz, buf2, sizeof(buf2)),
+ msgsiz, ntohs(eap->length));
goto fail;
}
req = eap_recv_mschap(self, req, pkt, (struct eap_chap *)eap);
break;
default:
- log_warnx(
- "q=%u EAP state=%s EAP unknown type=%u receieved.",
+ log_warnx("q=%u EAP state=%s EAP unknown type=%u receieved.",
q_id, hex_string(state, statesiz, buf2, sizeof(buf2)),
eap->value[0]);
goto fail;
htons(resp->chap.length) <
sizeof(struct eap_mschap_response) -
offsetof(struct eap_mschap_response, chap)) {
- log_warnx(
- "q=%u EAP state=%s Received EAP message has wrong "
- "in size: received length %zu eap.length=%u "
+ log_warnx("q=%u EAP state=%s Received EAP message has "
+ "wrong in size: received length %zu eap.length=%u "
"chap.length=%u valuesize=%u", req->q_id,
hex_string(req->state, sizeof(req->state), buf,
sizeof(buf)), eapsiz, ntohs(resp->eap.length),
-/* $OpenBSD: radiusd_ipcp.c,v 1.16 2024/09/15 05:29:11 yasuoka Exp $ */
+/* $OpenBSD: radiusd_ipcp.c,v 1.17 2024/09/15 05:31:23 yasuoka Exp $ */
/*
* Copyright (c) 2024 Internet Initiative Japan Inc.
TAILQ_FOREACH(dae, &self->daes, next) {
if ((sock = socket(dae->nas_addr.sin4.sin_family,
SOCK_DGRAM, IPPROTO_UDP)) == -1) {
- log_warn("could not start dae: %s", strerror(errno));
+ log_warn("%s: could not start dae: socket()", __func__);
return;
}
if (connect(sock, (struct sockaddr *)&dae->nas_addr,
dae->nas_addr.sin4.sin_len) == -1) {
- log_warn("could not start dae: %s", strerror(errno));
+ log_warn("%s: could not start dae: connect()",
+ __func__);
return;
}
dae->sock = sock;
!IN6_ARE_ADDR_EQUAL(&assign->nas_ipv6, &nas_ipv6) ||
strcmp(assign->nas_id, nas_id) != 0)
continue;
- log_info("Delete record for %s", inet_ntop(AF_INET,
- &assign->ipv4, buf, sizeof(buf)));
+ log_info("q=%u Delete record for %s", q_id,
+ inet_ntop(AF_INET, &assign->ipv4, buf,
+ sizeof(buf)));
ipcp_ipv4_delete(self, assign,
(type == RADIUS_ACCT_STATUS_TYPE_ACCT_ON)
? "Receive Acct-On" : "Receive Acct-Off");
if (ipcp_notice_startstop(self, assign, 1, NULL) != 0)
goto fail;
- log_info("Start seq=%u user=%s duration=%dsec session=%s "
- "tunnel=%s from=%s auth=%s ip=%s", assign->seq,
- assign->user->name, delay, assign->session_id,
+ log_info("q=%u Start seq=%u user=%s duration=%dsec "
+ "session=%s tunnel=%s from=%s auth=%s ip=%s", q_id,
+ assign->seq, assign->user->name, delay, assign->session_id,
assign->tun_type, print_addr((struct sockaddr *)
&assign->tun_client, buf1, sizeof(buf1)),
assign->auth_method, inet_ntop(AF_INET, &addr4, buf,
strlcpy(stat.cause, radius_terminate_cause_string(uval),
sizeof(stat.cause));
- log_info("Stop seq=%u user=%s duration=%lldsec session=%s "
- "tunnel=%s from=%s auth=%s ip=%s datain=%"PRIu64"bytes,%"
- PRIu32"packets dataout=%"PRIu64"bytes,%"PRIu32"packets "
- "cause=\"%s\"",
+ log_info("q=%u Stop seq=%u user=%s duration=%lldsec "
+ "session=%s tunnel=%s from=%s auth=%s ip=%s "
+ "datain=%"PRIu64"bytes,%" PRIu32"packets dataout=%"PRIu64
+ "bytes,%"PRIu32"packets cause=\"%s\"", q_id,
assign->seq, assign->user->name, dur.tv_sec,
assign->session_id, assign->tun_type, print_addr(
(struct sockaddr *)&assign->tun_client, buf1, sizeof(buf1)),
if ((radres = radius_recv(dae->sock, 0)) == NULL) {
if (errno == EAGAIN)
return;
- log_warn("Failed to receive from %s", print_addr(
+ log_warn("%s: Failed to receive from %s", __func__, print_addr(
(struct sockaddr *)&dae->nas_addr, buf, sizeof(buf)));
return;
}
break;
}
if (assign == NULL) {
- log_warnx("Received RADIUS packet from %s has unknown id=%d",
- print_addr((struct sockaddr *)&dae->nas_addr, buf,
- sizeof(buf)), radius_get_id(radres));
+ log_warnx("%s: Received RADIUS packet from %s has unknown "
+ "id=%d", __func__, print_addr((struct sockaddr *)
+ &dae->nas_addr, buf, sizeof(buf)), radius_get_id(radres));
goto out;
}
radius_set_request_packet(radres, assign->dae_reqpkt);
if ((radius_check_response_authenticator(radres, dae->secret)) != 0) {
- log_warnx("Received RADIUS packet for seq=%u from %s has a bad "
- "authenticator", assign->seq, print_addr(
+ log_warnx("%s: Received RADIUS packet for seq=%u from %s has "
+ "a bad authenticator", __func__, assign->seq, print_addr(
(struct sockaddr *)&dae->nas_addr, buf,
sizeof(buf)));
goto out;
&dae->nas_addr, buf, sizeof(buf)), cause);
break;
case RADIUS_CODE_DISCONNECT_NAK:
- log_warnx("Received Disconnect-NAK for seq=%u from %s%s",
+ log_info("Received Disconnect-NAK for seq=%u from %s%s",
assign->seq, print_addr((struct sockaddr *)
&dae->nas_addr, buf, sizeof(buf)), cause);
break;
default:
- log_warn("Received unknown code=%d for id=%u from %s",
- code, assign->seq, print_addr((struct sockaddr *)
+ log_warn("%s: Received unknown code=%d for id=%u from %s",
+ __func__, code, assign->seq, print_addr((struct sockaddr *)
&dae->nas_addr, buf, sizeof(buf)));
break;
}