summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2002-04-15 00:14:40 +0000
committerbrian <brian@FreeBSD.org>2002-04-15 00:14:40 +0000
commit99e79d7fa0bf74e995f0f4db81d90c3795f6b259 (patch)
treec08a48b296b784be8bba63609d75706ec949b801 /usr.sbin
parent2ff28d13ad521facf74c76edf050d83053409768 (diff)
downloadFreeBSD-src-99e79d7fa0bf74e995f0f4db81d90c3795f6b259.zip
FreeBSD-src-99e79d7fa0bf74e995f0f4db81d90c3795f6b259.tar.gz
When it's necessary to kldload tun(4), don't forget to re-try to open
tun0. Submitted by: qhwt@myrealbox.com
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/bundle.c7
-rw-r--r--usr.sbin/ppp/defs.c14
-rw-r--r--usr.sbin/ppp/defs.h2
3 files changed, 15 insertions, 8 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 64cce9d..48c2a68 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -708,10 +708,11 @@ bundle_Create(const char *prefix, int type, int unit)
#if defined(__FreeBSD__) && !defined(NOKLDLOAD)
if (bundle.unit == minunit && !kldtried++) {
/*
- * Attempt to load the tunnel interface KLD if it isn't loaded
- * already.
+ * Attempt to load the tunnel interface KLD if it isn't loaded
+ * already.
*/
- loadmodules(LOAD_VERBOSLY, "if_tun", NULL);
+ if (loadmodules(LOAD_VERBOSLY, "if_tun", NULL))
+ bundle.unit--;
continue;
}
#endif
diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c
index b61b7de..a4929cc 100644
--- a/usr.sbin/ppp/defs.c
+++ b/usr.sbin/ppp/defs.c
@@ -420,19 +420,25 @@ Concatinate(char *buf, size_t sz, int argc, const char *const *argv)
}
}
-void
+int
loadmodules(int how, const char *module, ...)
{
+ int loaded = 0;
#if defined(__FreeBSD__) && !defined(NOKLDLOAD)
va_list ap;
va_start(ap, module);
while (module != NULL) {
- if (modfind(module) == -1 && ID0kldload(module) == -1 &&
- how == LOAD_VERBOSLY)
- log_Printf(LogWARN, "%s: Cannot load module\n", module);
+ if (modfind(module) == -1) {
+ if (ID0kldload(module) == -1) {
+ if (how == LOAD_VERBOSLY)
+ log_Printf(LogWARN, "%s: Cannot load module\n", module);
+ } else
+ loaded++;
+ }
module = va_arg(ap, const char *);
}
va_end(ap);
#endif
+ return loaded;
}
diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h
index 31a4011..2be7686 100644
--- a/usr.sbin/ppp/defs.h
+++ b/usr.sbin/ppp/defs.h
@@ -139,4 +139,4 @@ extern void SetTitle(const char *);
extern fd_set *mkfdset(void);
extern void zerofdset(fd_set *);
extern void Concatinate(char *, size_t, int, const char *const *);
-extern void loadmodules(int, const char *, ...);
+extern int loadmodules(int, const char *, ...);
OpenPOWER on IntegriCloud