Hello. > brian 2002/03/30 04:30:11 PST
> Modified files: > usr.sbin/ppp Makefile async.c async.h atm.c bundle.c > ccp.c ccp.h chap.c chap.h chat.c > command.c datalink.c datalink.h defs.c > defs.h ether.c exec.c i4b.c lcp.c lcp.h > main.c mppe.c physical.c physical.h > route.c tcp.c tty.c udp.c : > 1.126 +13 -17 src/usr.sbin/ppp/bundle.c In the 6th chunk, a decrement to bundle.unit after succeeding ID0kldload() is lost. This results in the unit number of tun device set to 1(tun1) instead of 0(tun0) when if_tun.ko is not yet kldload'ed() before ppp is invoked. If I exit from ppp and start it again, ppp uses tun0, leaving tun1 behind. After that and receiving a few megabytes, I've experienced a mysterious panic (getnewvnode: free vnode isn't). The panic itself, though, is something similar to that I'm always seeing whenever I didn't kill pccardd before doing acpiconf -s3, so it might be unrelated to this issue. Anyway, a patch is attached. Regards.
Index: usr.sbin/ppp/bundle.c =================================================================== RCS file: /home/cvs/freebsd/src/usr.sbin/ppp/bundle.c,v retrieving revision 1.127 diff -u -r1.127 bundle.c --- usr.sbin/ppp/bundle.c 30 Mar 2002 12:52:55 -0000 1.127 +++ usr.sbin/ppp/bundle.c 14 Apr 2002 05:46:37 -0000 @@ -711,7 +711,8 @@ * 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) > 0) + bundle.unit--; continue; } #endif Index: usr.sbin/ppp/defs.c =================================================================== RCS file: /home/cvs/freebsd/src/usr.sbin/ppp/defs.c,v retrieving revision 1.45 diff -u -r1.45 defs.c --- usr.sbin/ppp/defs.c 30 Mar 2002 12:30:09 -0000 1.45 +++ usr.sbin/ppp/defs.c 14 Apr 2002 05:46:13 -0000 @@ -420,19 +420,26 @@ } } -void +/* return: number of modules kldload'ed */ +int loadmodules(int how, const char *module, ...) { #if defined(__FreeBSD__) && !defined(NOKLDLOAD) va_list ap; + int loaded = 0; 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; } Index: usr.sbin/ppp/defs.h =================================================================== RCS file: /home/cvs/freebsd/src/usr.sbin/ppp/defs.h,v retrieving revision 1.65 diff -u -r1.65 defs.h --- usr.sbin/ppp/defs.h 30 Mar 2002 12:30:09 -0000 1.65 +++ usr.sbin/ppp/defs.h 14 Apr 2002 05:31:00 -0000 @@ -139,4 +139,4 @@ 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 *, ...);