diff options
-rw-r--r-- | accel-pppd/accel-ppp.conf | 5 | ||||
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 8 | ||||
-rw-r--r-- | accel-pppd/radius/radius_p.h | 2 | ||||
-rw-r--r-- | accel-pppd/radius/serv.c | 14 |
4 files changed, 23 insertions, 6 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf index b833aae..2cec7d7 100644 --- a/accel-pppd/accel-ppp.conf +++ b/accel-pppd/accel-ppp.conf @@ -138,10 +138,7 @@ interface=eth0 nas-identifier=accel-ppp nas-ip-address=127.0.0.1 gw-ip-address=192.168.100.1 -#auth-server=127.0.0.1:1812,testing123 (obsolete) -#acct-server=127.0.0.1:1813,testing123 (obsolete) -#server=127.0.0.1,testing123 (obsolete) -server=127.0.0.1,testing123,auth-port=1812,acct-port=1813,req-limit=0,fail-time=0 +server=127.0.0.1,testing123,auth-port=1812,acct-port=1813,req-limit=0,fail-time=0,weight=1 dae-server=127.0.0.1:3799,testing123 verbose=1 #timeout=3 diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 0b3ac31..c386f77 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -578,7 +578,7 @@ Specifies IP address, port and secret of authentication RADIUS server. (obsolete .BI "acct-server=" x.x.x.x:port,secret Specifies IP address, port and secret of accounting RADIUS server. (obsolete) .TP -.BI "server=" address,secret[,auth-port=1812][,acct-port=1813][,req-limit=0][,fail-time=0] +.BI "server=" address,secret[,auth-port=1812][,acct-port=1813][,req-limit=0][,fail-time=0][,weight=1][,backup] Specifies IP address, secret, ports of RADIUS server. .br .B req-limit @@ -587,6 +587,12 @@ Specifies IP address, secret, ports of RADIUS server. .B fail-time - if server doesn't responds mark it as unavailable for this time (sec). .br +.B weight +- specifies weight of server for multi-server configuration. +.br +.B backup +- mark server as backup server f.e. use this server only when all other servers are failed. +.br If you want to specify only authentication or accounting server then set auth-port/acct-port to zero. You may specify multiple radius servers. .TP diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h index 4654c78..f626213 100644 --- a/accel-pppd/radius/radius_p.h +++ b/accel-pppd/radius/radius_p.h @@ -82,6 +82,7 @@ struct rad_server_t { time_t fail_time; int conf_fail_time; int timeout_cnt; + double weight; pthread_mutex_t lock; unsigned long stat_auth_sent; @@ -107,6 +108,7 @@ struct rad_server_t { struct stat_accm_t *stat_interim_query_1m; struct stat_accm_t *stat_interim_query_5m; + int backup:1; int starting:1; int acct_on:1; int need_free:1; diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c index 6a08070..46d064a 100644 --- a/accel-pppd/radius/serv.c +++ b/accel-pppd/radius/serv.c @@ -63,7 +63,7 @@ static struct rad_server_t *__rad_server_get(int type, struct rad_server_t *excl continue; } - if (s->client_cnt[type] < s0->client_cnt[type]) + if (s0->backup || s->weight*s->client_cnt[type] < s0->weight*s0->client_cnt[type]) s0 = s; } @@ -648,6 +648,18 @@ static int parse_server2(const char *_opt, struct rad_server_t *s) goto out; } else s->conf_fail_time = conf_fail_time; + + ptr3 = strstr(ptr2, ",weight="); + if (ptr3) + s->weight = 1.0/atoi(ptr3 + 8); + else + s->weight = 1; + + ptr3 = strstr(ptr2, ",backup"); + if (ptr3) + s->backup = 1; + else + s->backup = 0; if (ptr2) *ptr2 = 0; |