diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-06-17 21:31:10 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-06-17 21:31:10 +0400 |
commit | d5776039b12c3c1016b3bb6ccede69bacf23ae1e (patch) | |
tree | 7c4b41d1cefc0f42438e61e6403a480d082ef3c7 /accel-pppd | |
parent | c69fb2ed39346fd5091a4e30606cb5bb866aa432 (diff) | |
download | accel-ppp-d5776039b12c3c1016b3bb6ccede69bacf23ae1e.tar.gz accel-ppp-d5776039b12c3c1016b3bb6ccede69bacf23ae1e.zip |
radius: introduced attr-tunnel-type option
If specified then accel-ppp will send tunnel type as string (pppoe,pptp,l2tp,ipoe).
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/CMakeLists.txt | 2 | ||||
-rw-r--r-- | accel-pppd/accel-ppp.conf | 1 | ||||
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 3 | ||||
-rw-r--r-- | accel-pppd/radius/radius.c | 4 | ||||
-rw-r--r-- | accel-pppd/radius/radius_p.h | 1 | ||||
-rw-r--r-- | accel-pppd/radius/req.c | 4 |
6 files changed, 14 insertions, 1 deletions
diff --git a/accel-pppd/CMakeLists.txt b/accel-pppd/CMakeLists.txt index 7a016ef..d82f8d2 100644 --- a/accel-pppd/CMakeLists.txt +++ b/accel-pppd/CMakeLists.txt @@ -50,6 +50,7 @@ INCLUDE(CheckIncludeFile) CHECK_INCLUDE_FILE("linux/netfilter/ipset/ip_set.h" HAVE_IPSET) ADD_EXECUTABLE(accel-pppd + memdebug.c session.c session_backup.c ifcfg.c @@ -93,7 +94,6 @@ ADD_EXECUTABLE(accel-pppd log.c main.c - memdebug.c ) TARGET_LINK_LIBRARIES(accel-pppd triton rt pthread ${crypto_lib} pcre) diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf index e3639d6..4af92ca 100644 --- a/accel-pppd/accel-ppp.conf +++ b/accel-pppd/accel-ppp.conf @@ -147,6 +147,7 @@ verbose=1 #acct-timeout=120 #acct-delay-time=0 #acct-on=0 +#attr-tunnel-type=My-Tunnel-Type [client-ip-range] 10.0.0.0/8 diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index c386f77..965116f 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -632,6 +632,9 @@ Append specified realm to username. .TP .BI "acct-on=" 0|1 Specifies whether radius client should send Account-Request with Acct-Status-Type=Accounting-On on startup and Acct-Status-Type=Accounting-Off on shutdown. +.TP +.BI "attr-tunnel-type=" name +Specifies custom attribute name to be used to send tunnel type (as string). .SH [log] .br Configuration of log and log_file modules. diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index 26e59ba..a3b211e 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -45,6 +45,8 @@ int conf_req_limit; static const char *conf_default_realm; static int conf_default_realm_len; +const char *conf_attr_tunnel_type; + static LIST_HEAD(sessions); static pthread_rwlock_t sessions_lock = PTHREAD_RWLOCK_INITIALIZER; @@ -632,6 +634,8 @@ static int load_config(void) if (opt) conf_req_limit = atoi(opt); + conf_attr_tunnel_type = conf_get_opt("radius", "attr-tunnel-type"); + conf_default_realm = conf_get_opt("radius", "default-realm"); if (conf_default_realm) conf_default_realm_len = strlen(conf_default_realm); diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h index f626213..8ad69da 100644 --- a/accel-pppd/radius/radius_p.h +++ b/accel-pppd/radius/radius_p.h @@ -138,6 +138,7 @@ extern int conf_acct_interim_interval; extern int conf_accounting; extern int conf_fail_time; extern int conf_req_limit; +extern const char *conf_attr_tunnel_type; int rad_check_nas_pack(struct rad_packet_t *pack); struct radius_pd_t *rad_find_session(const char *sessionid, const char *username, const char *port_id, int port, in_addr_t ipaddr, const char *csid); diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c index 818252e..d688f58 100644 --- a/accel-pppd/radius/req.c +++ b/accel-pppd/radius/req.c @@ -109,6 +109,10 @@ static struct rad_req_t *__rad_req_alloc(struct radius_pd_t *rpd, int code, cons if (rpd->attr_class) if (rad_packet_add_octets(req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len)) goto out_err; + + if (conf_attr_tunnel_type) + if (rad_packet_add_str(req->pack, NULL, conf_attr_tunnel_type, rpd->ses->ctrl->name)) + goto out_err; list_for_each_entry(plugin, &req->rpd->plugin_list, entry) { switch (code) { |