summaryrefslogtreecommitdiff
path: root/accel-pppd/radius
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2019-08-30 16:49:07 +0500
committerVladislav Grishenko <themiron@mail.ru>2019-08-30 16:49:07 +0500
commit76819cf1dceb6f4181536073e0e42da0d2f89134 (patch)
tree9694be3c8044768bebd0f015efbf7614a211ced7 /accel-pppd/radius
parentb955a5c1b35268afd1f6f7ae6aa28ab8e091e28d (diff)
downloadaccel-ppp-76819cf1dceb6f4181536073e0e42da0d2f89134.tar.gz
accel-ppp-76819cf1dceb6f4181536073e0e42da0d2f89134.zip
radius: dm/coa: add invalid packet logging
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r--accel-pppd/radius/dm_coa.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c
index f967ec64..003a691d 100644
--- a/accel-pppd/radius/dm_coa.c
+++ b/accel-pppd/radius/dm_coa.c
@@ -217,21 +217,21 @@ static int dm_coa_read(struct triton_md_handler_t *h)
if (!pack)
continue;
- if (pack->code != CODE_DISCONNECT_REQUEST && pack->code != CODE_COA_REQUEST) {
+ if (pack->code != CODE_DISCONNECT_REQUEST && pack->code != CODE_COA_REQUEST) {
log_warn("radius:dm_coa: unexpected code (%i) received\n", pack->code);
goto out_err_no_reply;
}
- if (dm_coa_check_RA(pack, conf_dm_coa_secret)) {
- log_warn("radius:dm_coa: RA validation failed\n");
- goto out_err_no_reply;
- }
-
if (conf_verbose) {
log_debug("recv ");
rad_packet_print(pack, NULL, log_debug);
}
+ if (dm_coa_check_RA(pack, conf_dm_coa_secret)) {
+ log_warn("radius:dm_coa: RA validation failed\n");
+ goto out_err_no_reply;
+ }
+
if (rad_check_nas_pack(pack)) {
log_warn("radius:dm_coa: NAS identification failed\n");
err_code = 403;
@@ -293,29 +293,29 @@ static void init(void)
}
serv.hnd.fd = socket (PF_INET, SOCK_DGRAM, 0);
- if (serv.hnd.fd < 0) {
- log_emerg("radius:dm_coa: socket: %s\n", strerror(errno));
- return;
- }
+ if (serv.hnd.fd < 0) {
+ log_emerg("radius:dm_coa: socket: %s\n", strerror(errno));
+ return;
+ }
fcntl(serv.hnd.fd, F_SETFD, fcntl(serv.hnd.fd, F_GETFD) | FD_CLOEXEC);
- addr.sin_family = AF_INET;
- addr.sin_port = htons (conf_dm_coa_port);
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons (conf_dm_coa_port);
if (conf_dm_coa_server)
- addr.sin_addr.s_addr = conf_dm_coa_server;
+ addr.sin_addr.s_addr = conf_dm_coa_server;
else
addr.sin_addr.s_addr = htonl (INADDR_ANY);
- if (bind (serv.hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
- log_emerg("radius:dm_coa: bind: %s\n", strerror(errno));
+ if (bind (serv.hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
+ log_emerg("radius:dm_coa: bind: %s\n", strerror(errno));
close(serv.hnd.fd);
- return;
- }
+ return;
+ }
if (fcntl(serv.hnd.fd, F_SETFL, O_NONBLOCK)) {
- log_emerg("radius:dm_coa: failed to set nonblocking mode: %s\n", strerror(errno));
+ log_emerg("radius:dm_coa: failed to set nonblocking mode: %s\n", strerror(errno));
close(serv.hnd.fd);
- return;
+ return;
}
triton_context_register(&serv.ctx, NULL);