Skip to content

Commit

Permalink
Add LoopPrevention per server (RADSECPROXY-1).
Browse files Browse the repository at this point in the history
TODO: Documentation and configuration example still missing.


git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@544 e88ac4ed-0b26-0410-9574-a7f39faa03bf
  • Loading branch information
linus authored and linus committed Mar 31, 2010
1 parent 196cad2 commit bd55e73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion radsecproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,9 @@ int radsrv(struct request *rq) {
goto exit;
}

if (options.loopprevention && !strcmp(from->conf->name, to->conf->name)) {
if ((to->conf->loopprevention == 1
|| (to->conf->loopprevention == UCHAR_MAX && options.loopprevention == 1))
&& !strcmp(from->conf->name, to->conf->name)) {
debug(DBG_INFO, "radsrv: Loop prevented, not forwarding request from client %s (%s) to server %s, discarding",
from->conf->name, addr2string(from->addr), to->conf->name);
goto exit;
Expand Down Expand Up @@ -2759,6 +2761,7 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
return 0;
}
memset(conf, 0, sizeof(struct clsrvconf));
conf->loopprevention = UCHAR_MAX; /* Uninitialized. */
resconf = (struct clsrvconf *)arg;
if (resconf) {
conf->statusserver = resconf->statusserver;
Expand All @@ -2784,6 +2787,7 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
"RetryInterval", CONF_LINT, &retryinterval,
"RetryCount", CONF_LINT, &retrycount,
"DynamicLookupCommand", CONF_STR, &conf->dynamiclookupcommand,
"LoopPrevention", CONF_BLN, &conf->loopprevention,
NULL
)) {
debug(DBG_ERR, "configuration error");
Expand Down
1 change: 1 addition & 0 deletions radsecproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ struct clsrvconf {
uint8_t dupinterval;
uint8_t certnamecheck;
uint8_t addttl;
uint8_t loopprevention;
struct rewrite *rewritein;
struct rewrite *rewriteout;
pthread_mutex_t *lock; /* only used for updating clients so far */
Expand Down

0 comments on commit bd55e73

Please sign in to comment.