summaryrefslogtreecommitdiff
path: root/accel-pppd/radius
diff options
context:
space:
mode:
authorSergey V. Lobanov <sergey@lobanov.in>2022-04-20 13:36:08 +0300
committerSergey V. Lobanov <sergey@lobanov.in>2022-04-20 15:09:58 +0300
commit6f5f75e70ce10dd41c47af8a3b4b179813020d4c (patch)
tree54e023a5de810747b62b0fda8668986bbb88f991 /accel-pppd/radius
parentf027b16325a11c988b4224bb8648dec8c0af2f69 (diff)
downloadaccel-ppp-6f5f75e70ce10dd41c47af8a3b4b179813020d4c.tar.gz
accel-ppp-6f5f75e70ce10dd41c47af8a3b4b179813020d4c.zip
add switch to disable sending NAS-Port-Id
This patch introduces nas-port-id-in-req switch to disable sending NAS-Port-Id attribute in radauth and radacct messages. New switch might be useful if radius server cannot properly handle this attrubite. Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r--accel-pppd/radius/radius.c5
-rw-r--r--accel-pppd/radius/radius_p.h1
-rw-r--r--accel-pppd/radius/req.c6
3 files changed, 10 insertions, 2 deletions
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index e074b98..786faa5 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -42,6 +42,7 @@ char conf_dm_coa_bind_device[IFNAMSIZ];
unsigned int conf_dm_coa_bind_default;
int conf_sid_in_auth;
+int conf_nas_port_id_in_req = 1;
int conf_require_nas_ident;
int conf_acct_interim_interval;
int conf_acct_interim_jitter;
@@ -1070,6 +1071,10 @@ static int load_config(void)
if (opt && atoi(opt) >= 0)
conf_strip_realm = atoi(opt) > 0;
+ opt = conf_get_opt("radius", "nas-port-id-in-req");
+ if (opt)
+ conf_nas_port_id_in_req = atoi(opt);
+
return 0;
}
diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h
index 9ea54b1..988f154 100644
--- a/accel-pppd/radius/radius_p.h
+++ b/accel-pppd/radius/radius_p.h
@@ -185,6 +185,7 @@ extern char *conf_dm_coa_secret;
extern char conf_dm_coa_bind_device[IFNAMSIZ];
extern unsigned int conf_dm_coa_bind_default;
extern int conf_sid_in_auth;
+extern int conf_nas_port_id_in_req;
extern int conf_require_nas_ident;
extern in_addr_t conf_dm_coa_server;
extern int conf_dm_coa_port;
diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c
index 688a6b2..11abf8c 100644
--- a/accel-pppd/radius/req.c
+++ b/accel-pppd/radius/req.c
@@ -89,8 +89,10 @@ static struct rad_req_t *__rad_req_alloc(struct radius_pd_t *rpd, int code, cons
if (rpd->ses->unit_idx != -1 && rad_packet_add_int(req->pack, NULL, "NAS-Port", rpd->ses->unit_idx))
goto out_err;
- if (*rpd->ses->ifname && rad_packet_add_str(req->pack, NULL, "NAS-Port-Id", rpd->ses->ifname))
- goto out_err;
+ if (conf_nas_port_id_in_req) {
+ if (*rpd->ses->ifname && rad_packet_add_str(req->pack, NULL, "NAS-Port-Id", rpd->ses->ifname))
+ goto out_err;
+ }
if (req->rpd->ses->ctrl->type == CTRL_TYPE_IPOE) {
if (rad_packet_add_val(req->pack, NULL, "NAS-Port-Type", "Ethernet"))