diff options
author | brian <brian@FreeBSD.org> | 1999-01-28 01:56:34 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-01-28 01:56:34 +0000 |
commit | c970e06ccf646c8d420b2216f605eefeef3cdc0d (patch) | |
tree | bb4ef8e30fe918a76dda062613ff6dce7f4acf28 /usr.sbin/ppp/route.c | |
parent | bada4b37ff3f7d5effb75895357b4276798f82de (diff) | |
download | FreeBSD-src-c970e06ccf646c8d420b2216f605eefeef3cdc0d.zip FreeBSD-src-c970e06ccf646c8d420b2216f605eefeef3cdc0d.tar.gz |
Initial RADIUS support (using libradius). See the man page for
details. Compiling with -DNORADIUS (the default for `release')
removes support.
TODO: The functionality in libradius::rad_send_request() needs
to be supplied as a set of routines so that ppp doesn't
have to wait indefinitely for the radius server(s). Instead,
we need to get a descriptor back, select() on the descriptor,
and ask libradius to service it when necessary.
For now, ppp blocks SIGALRM while in rad_send_request(), so
it misses PAP/CHAP retries & timeouts if they occur.
Only PAP is functional. When CHAP is attempted, libradius
complains that no User-Password has been specified... rfc2138
says that it *mustn't* be used for CHAP :-(
Sponsored by: Internet Business Solutions Ltd., Switzerland
Diffstat (limited to 'usr.sbin/ppp/route.c')
-rw-r--r-- | usr.sbin/ppp/route.c | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index 7f70efb..5b366d2 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -17,11 +17,11 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: route.c,v 1.53 1998/08/17 06:42:40 brian Exp $ + * $Id: route.c,v 1.54 1998/10/22 02:32:50 brian Exp $ * */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/socket.h> #include <net/if_types.h> #include <net/route.h> @@ -58,6 +58,9 @@ #include "filter.h" #include "descriptor.h" #include "mp.h" +#ifndef NORADIUS +#include "radius.h" +#endif #include "bundle.h" #include "route.h" #include "prompt.h" @@ -486,29 +489,29 @@ void route_Add(struct sticky_route **rp, int type, struct in_addr dst, struct in_addr mask, struct in_addr gw) { - if (type != ROUTE_STATIC) { - struct sticky_route *r; - int dsttype = type & ROUTE_DSTANY; - - r = NULL; - while (*rp) { - if ((dsttype && dsttype == ((*rp)->type & ROUTE_DSTANY)) || - (!dsttype && (*rp)->dst.s_addr == dst.s_addr)) { - r = *rp; - *rp = r->next; - } else - rp = &(*rp)->next; - } + struct sticky_route *r; + int dsttype = type & ROUTE_DSTANY; - if (!r) - r = (struct sticky_route *)malloc(sizeof(struct sticky_route)); - r->type = type; - r->next = NULL; - r->dst = dst; - r->mask = mask; - r->gw = gw; - *rp = r; + r = NULL; + while (*rp) { + if ((dsttype && dsttype == ((*rp)->type & ROUTE_DSTANY)) || + (!dsttype && (*rp)->dst.s_addr == dst.s_addr)) { + /* Oops, we already have this route - unlink it */ + free(r); /* impossible really */ + r = *rp; + *rp = r->next; + } else + rp = &(*rp)->next; } + + if (!r) + r = (struct sticky_route *)malloc(sizeof(struct sticky_route)); + r->type = type; + r->next = NULL; + r->dst = dst; + r->mask = mask; + r->gw = gw; + *rp = r; } void @@ -541,15 +544,22 @@ route_DeleteAll(struct sticky_route **rp) } void -route_ShowSticky(struct prompt *p, struct sticky_route *r) +route_ShowSticky(struct prompt *p, struct sticky_route *r, const char *tag, + int indent) { int def; + int tlen = strlen(tag); + + if (tlen + 2 > indent) + prompt_Printf(p, "%s:\n%*s", tag, indent, ""); + else + prompt_Printf(p, "%s:%*s", tag, indent - tlen - 1, ""); - prompt_Printf(p, "Sticky routes:\n"); for (; r; r = r->next) { def = r->dst.s_addr == INADDR_ANY && r->mask.s_addr == INADDR_ANY; - prompt_Printf(p, " add "); + prompt_Printf(p, "%*sadd ", tlen ? 0 : indent, ""); + tlen = 0; if (r->type & ROUTE_DSTMYADDR) prompt_Printf(p, "MYADDR"); else if (r->type & ROUTE_DSTHISADDR) |