summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-08-26 20:01:20 +0000
committerbrian <brian@FreeBSD.org>1999-08-26 20:01:20 +0000
commitadcdd2a153ba0fae530bc9f8eba138af4e269dbf (patch)
tree2af8a5d1d39e219ba3407ee22c01b37d220c6e28 /usr.sbin/ppp
parent9e654e1019b063fcd4e369ed888eef57d59acd1a (diff)
downloadFreeBSD-src-adcdd2a153ba0fae530bc9f8eba138af4e269dbf.zip
FreeBSD-src-adcdd2a153ba0fae530bc9f8eba138af4e269dbf.tar.gz
Rebuild the list of interface numbers to names if we're trying
to evaluate an interface number that didn't previously exist.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/route.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c
index a20ec2a..99ce691 100644
--- a/usr.sbin/ppp/route.c
+++ b/usr.sbin/ppp/route.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: route.c,v 1.55 1999/01/28 01:56:34 brian Exp $
+ * $Id: route.c,v 1.56 1999/05/08 11:07:36 brian Exp $
*
*/
@@ -208,13 +208,20 @@ Index2Nam(int idx)
static char **ifs; /* Figure these out once */
static int nifs, debug_done; /* Figure out how many once, and debug once */
- if (!nifs) {
+ if (idx > nifs || (idx > 0 && ifs[idx-1] == NULL)) {
int mib[6], have, had;
size_t needed;
char *buf, *ptr, *end;
struct sockaddr_dl *dl;
struct if_msghdr *ifm;
+ if (ifs) {
+ free(ifs);
+ ifs = NULL;
+ nifs = 0;
+ }
+ debug_done = 0;
+
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
mib[2] = 0;
@@ -252,8 +259,11 @@ Index2Nam(int idx)
if (!newifs) {
log_Printf(LogDEBUG, "Index2Nam: %s\n", strerror(errno));
nifs = 0;
- if (ifs)
+ if (ifs) {
free(ifs);
+ ifs = NULL;
+ }
+ free(buf);
return "???";
}
ifs = newifs;
OpenPOWER on IntegriCloud