Date: Fri, 25 Oct 2002 12:35:22 -0700 From: Brooks Davis <brooks@one-eyed-alien.net> To: Bakul Shah <bakul@bitblocks.com> Cc: Brooks Davis <brooks@one-eyed-alien.net>, Dave Evans <devans@hclb.demon.co.uk>, freebsd-current@FreeBSD.ORG Subject: Re: pppd not working on latest current 2002-10-20 Message-ID: <20021025123522.B23521@Odin.AC.HMC.Edu> In-Reply-To: <200210251841.OAA09782@valiant.cnchost.com>; from bakul@bitblocks.com on Fri, Oct 25, 2002 at 11:41:33AM -0700 References: <20021025113137.A23521@Odin.AC.HMC.Edu> <200210251841.OAA09782@valiant.cnchost.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Fri, Oct 25, 2002 at 11:41:33AM -0700, Bakul Shah wrote:
> Until pppd is taught to create the interface if one doesn't
> exist, this information needs to be in /usr/src/UPDATING.
pppd doesn't need to be taught to create the interface. Rather it needed
to learn to check for ppp support in a non-stupid way. The following
patch should do it as well as making pppd do the right thing when
support isn't compiled in, but a module is available. It should make
things work with a GENERIC kernel.
If someone who actually uses pppd could test it, perferably in both
sceneios, I'll see about getting it commited.
-- Brooks
Index: sys-bsd.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pppd/sys-bsd.c,v
retrieving revision 1.18
diff -u -p -r1.18 sys-bsd.c
--- sys-bsd.c 17 Sep 2002 15:52:35 -0000 1.18
+++ sys-bsd.c 25 Oct 2002 19:30:20 -0000
@@ -44,6 +44,7 @@ static char rcsid[] = "$FreeBSD: src/usr
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
+#include <sys/module.h>
#ifdef NetBSD1_2
#include <util.h>
#endif
@@ -169,28 +170,24 @@ sys_check_options()
}
/*
- * ppp_available - check whether the system has any ppp interfaces
- * (in fact we check whether we can do an ioctl on ppp0).
+ * ppp_available - check whether the system has the ppp module loaded
+ * or compiled in. If it doesn't try loading it before giving up.
*/
int
ppp_available()
{
- int s, ok;
- struct ifreq ifr;
- extern char *no_ppp_msg;
+ const char *modname = "if_ppp";
+
+ if (modfind(modname) != -1) {
+ printf("module is loaded\n");
+ return 1;
+ }
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- return 1; /* can't tell */
+ printf("trying to load ppp mode\n");
+ if (kldload(modname) != -1)
+ return 1;
- strncpy(ifr.ifr_name, "ppp0", sizeof (ifr.ifr_name));
- ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >= 0;
- close(s);
-
- no_ppp_msg = "\
-This system lacks kernel support for PPP. To include PPP support\n\
-in the kernel, please follow the steps detailed in the README.bsd\n\
-file in the ppp-2.2 distribution.\n";
- return ok;
+ return 0;
}
/*
--
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9uZz6XY6L6fI4GtQRAmvcAJ0V/mIHLzxEKAbRjAX6qWDZB7ZahgCgtrIr
bcMIwYGO7X2L8bMouhREYwk=
=gU6X
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021025123522.B23521>
