diff options
author | brian <brian@FreeBSD.org> | 2002-05-14 12:55:39 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2002-05-14 12:55:39 +0000 |
commit | c2da7c8697491402af4f8ab3082d2c047114ccad (patch) | |
tree | 213dbf675b601fdd2934367847c24da5854fd2d9 /usr.sbin/ppp/route.c | |
parent | 4e0ba1d0e6f3418e983e80b52552d0cd201048bb (diff) | |
download | FreeBSD-src-c2da7c8697491402af4f8ab3082d2c047114ccad.zip FreeBSD-src-c2da7c8697491402af4f8ab3082d2c047114ccad.tar.gz |
o Clean up some #includes
o Bump version number to 3.0.4
o When talking to a RADIUS server, provide a NAS-Port-Type.
When the NAS-Port-Type is Ethernet, provide a NAS-Port value equal
to the SESSIONID from the environment in direct mode or the
NGM_PPPOE_SESSIONID message in other modes. If no SESSIONID is found,
default to the interface index in client mode or zero in server mode.
When the NAS-Port-Type is ISDN, set the NAS-Port to the minor number
of the physical device (ie, the N in /dev/i4brbchN).
This makes it easier for the RADIUS server to identify the client
WRT accounting data etc.
Prompted by: lsz8425 <lsz8425@mail.cd.hn.cn>
Diffstat (limited to 'usr.sbin/ppp/route.c')
-rw-r--r-- | usr.sbin/ppp/route.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index a75cabd..e1a99c1 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -39,7 +39,6 @@ #include <netinet/in_systm.h> #include <netinet/ip.h> #include <sys/un.h> -#include <netdb.h> #include <errno.h> #include <stdio.h> @@ -65,7 +64,6 @@ #include "link.h" #include "slcompress.h" #include "ncpaddr.h" -#include "ip.h" #include "ipcp.h" #include "filter.h" #include "descriptor.h" @@ -200,6 +198,8 @@ p_flags(struct prompt *prompt, u_int32_t f, int max) prompt_Printf(prompt, "%-*.*s", max, max, name); } +static int route_nifs = -1; + const char * Index2Nam(int idx) { @@ -210,9 +210,9 @@ Index2Nam(int idx) * the PCCARD insert/remove events can signal ppp. */ static char **ifs; /* Figure these out once */ - static int nifs, debug_done; /* Figure out how many once, and debug once */ + static int debug_done; /* Debug once */ - if (idx > nifs || (idx > 0 && ifs[idx-1] == NULL)) { + if (idx > route_nifs || (idx > 0 && ifs[idx-1] == NULL)) { int mib[6], have, had; size_t needed; char *buf, *ptr, *end; @@ -222,7 +222,7 @@ Index2Nam(int idx) if (ifs) { free(ifs); ifs = NULL; - nifs = 0; + route_nifs = 0; } debug_done = 0; @@ -264,7 +264,7 @@ Index2Nam(int idx) newifs = (char **)malloc(sizeof(char *) * have); if (!newifs) { log_Printf(LogDEBUG, "Index2Nam: %s\n", strerror(errno)); - nifs = 0; + route_nifs = 0; if (ifs) { free(ifs); ifs = NULL; @@ -279,8 +279,8 @@ Index2Nam(int idx) ifs[ifm->ifm_index-1] = (char *)malloc(dl->sdl_nlen+1); memcpy(ifs[ifm->ifm_index-1], dl->sdl_data, dl->sdl_nlen); ifs[ifm->ifm_index-1][dl->sdl_nlen] = '\0'; - if (nifs < ifm->ifm_index) - nifs = ifm->ifm_index; + if (route_nifs < ifm->ifm_index) + route_nifs = ifm->ifm_index; } } else if (log_IsKept(LogDEBUG)) log_Printf(LogDEBUG, "Skipping out-of-range interface %d!\n", @@ -293,13 +293,13 @@ Index2Nam(int idx) int f; log_Printf(LogDEBUG, "Found the following interfaces:\n"); - for (f = 0; f < nifs; f++) + for (f = 0; f < route_nifs; f++) if (ifs[f] != NULL) log_Printf(LogDEBUG, " Index %d, name \"%s\"\n", f+1, ifs[f]); debug_done = 1; } - if (idx < 1 || idx > nifs || ifs[idx-1] == NULL) + if (idx < 1 || idx > route_nifs || ifs[idx-1] == NULL) return NumStr(idx, NULL, 0); return ifs[idx-1]; @@ -529,11 +529,10 @@ int GetIfIndex(char *name) { int idx; - const char *got; idx = 1; - while (strcmp(got = Index2Nam(idx), "???")) - if (!strcmp(got, name)) + while (route_nifs == -1 || idx < route_nifs) + if (strcmp(Index2Nam(idx), name) == 0) return idx; else idx++; |