From owner-freebsd-current Fri Oct 25 15:23: 4 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 676A037B401 for ; Fri, 25 Oct 2002 15:23:01 -0700 (PDT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1E2543E3B for ; Fri, 25 Oct 2002 15:23:00 -0700 (PDT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.3/8.12.3) with ESMTP id g9PMMMs7014533; Fri, 25 Oct 2002 15:22:22 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.3/8.12.3/Submit) id g9PMMMaq014532; Fri, 25 Oct 2002 15:22:22 -0700 Date: Fri, 25 Oct 2002 15:22:22 -0700 From: Brooks Davis To: Brooks Davis Cc: Bakul Shah , Dave Evans , freebsd-current@FreeBSD.ORG Subject: Re: pppd not working on latest current 2002-10-20 Message-ID: <20021025152221.A8479@Odin.AC.HMC.Edu> References: <20021025113137.A23521@Odin.AC.HMC.Edu> <200210251841.OAA09782@valiant.cnchost.com> <20021025123522.B23521@Odin.AC.HMC.Edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="ZGiS0Q5IWpPtfppv" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20021025123522.B23521@Odin.AC.HMC.Edu>; from brooks@one-eyed-alien.net on Fri, Oct 25, 2002 at 12:35:22PM -0700 X-Virus-Scanned: by amavisd-milter (http://amavis.org/) on odin.ac.hmc.edu Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 25, 2002 at 12:35:22PM -0700, Brooks Davis wrote: > If someone who actually uses pppd could test it, perferably in both > sceneios, I'll see about getting it commited. Here's a new patch that gives the user more of a hint at how to add PPP support and only loads the module if they are actully root. How's this look? -- Brooks Index: sys-bsd.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 22:21:47 -0000 @@ -44,6 +44,7 @@ static char rcsid[] =3D "$FreeBSD: src/usr #include #include #include +#include #ifdef NetBSD1_2 #include #endif @@ -169,28 +170,29 @@ sys_check_options() } =20 /* - * 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, and we're actually root (not just SUID + * root) try loading it before giving up. */ int ppp_available() { - int s, ok; - struct ifreq ifr; + const char *modname =3D "if_ppp"; extern char *no_ppp_msg; =20 - if ((s =3D socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return 1; /* can't tell */ + if (modfind(modname) !=3D -1) { + return 1; + } =20 - strncpy(ifr.ifr_name, "ppp0", sizeof (ifr.ifr_name)); - ok =3D ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >=3D 0; - close(s); + if (getuid() =3D=3D 0 && kldload(modname) !=3D -1) + return 1; =20 no_ppp_msg =3D "\ 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; +in the kernel, please add \"device ppp\" to your kernel config or \n\ +load the if_ppp module.\n"; + + return 0; } =20 /* --=20 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 --ZGiS0Q5IWpPtfppv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9ucQdXY6L6fI4GtQRAtL5AJ0R0mWDMiPy/MvJRAHXLDLkVHRuIgCfdkXK SkDNHicz6ElhzTZw9FDCLDQ= =30xE -----END PGP SIGNATURE----- --ZGiS0Q5IWpPtfppv-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message