From osa@freebsd.org.ru  Wed Aug  1 03:09:30 2001
Return-Path: <osa@freebsd.org.ru>
Received: from freebsd.org.ru (sweet.etrust.ru [194.84.67.5])
	by hub.freebsd.org (Postfix) with ESMTP id DEAFA37B40A
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  1 Aug 2001 03:09:28 -0700 (PDT)
	(envelope-from osa@freebsd.org.ru)
Received: by freebsd.org.ru (Postfix, from userid 1000)
	id 36294208; Wed,  1 Aug 2001 14:09:25 +0400 (MSD)
Message-Id: <20010801100925.36294208@freebsd.org.ru>
Date: Wed,  1 Aug 2001 14:09:25 +0400 (MSD)
From: Sergey A.Osokin <osa@FreeBSD.org.ru>
Reply-To: Sergey A.Osokin <osa@FreeBSD.org.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: startslip can't load if_sl.ko
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         29361
>Category:       bin
>Synopsis:       startslip can't load if_sl.ko
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ceri
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 01 03:10:07 PDT 2001
>Closed-Date:    Sun Jun 08 11:01:58 PDT 2003
>Last-Modified:  Sun Jun 08 11:01:58 PDT 2003
>Originator:     Sergey A. Osokin
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Russian FreeBSD Team
>Environment:
System: FreeBSD 5.0-CURRENT i386


>Description:
	startslip can't load if_sl.ko

>How-To-Repeat:
	1) build and install kernel without 'pseudo-device sl'
	2) try to use startslip and you find TIOCSETD

>Fix:

--- src/sbin/startslip/startslip.c.orig	Tue Jul 31 23:58:38 2001
+++ src/sbin/startslip/startslip.c	Tue Jul 31 23:58:16 2001
@@ -428,6 +428,21 @@
 	 * Attach
 	 */
 	printd("setd");
+
+	/*
+	 * Attempt to load the SLIP interface KLD if it isn't loaded
+	 * already.
+	 */
+#if defined(__FreeBSD__) && !defined(NOKLDLOAD)
+	if (modfind("if_sl") == -1) {
+ 		if (kldload("if_sl") == -1) {
+			syslog(LOG_ERR, "kldload if_sl: %s\n",
+			   strerror(errno));
+			down(2);
+		}
+	}
+#endif
+
 	disc = SLIPDISC;
 	if (ioctl(fd, TIOCSETD, &disc) < 0) {
 		syslog(LOG_ERR, "%s: ioctl (%s, TIOCSETD): %m",
>Release-Note:
>Audit-Trail:

From: Dima Dorfman <dima@unixfreak.org>
To: "Sergey A.Osokin" <osa@FreeBSD.org.ru>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/29361: startslip can't load if_sl.ko 
Date: Thu, 06 Sep 2001 05:32:11 -0700

 "Sergey A.Osokin" <osa@FreeBSD.org.ru> wrote:
 > @@ -428,6 +428,21 @@
 >  	 * Attach
 >  	 */
 >  	printd("setd");
 > +
 > +	/*
 > +	 * Attempt to load the SLIP interface KLD if it isn't loaded
 > +	 * already.
 > +	 */
 > +#if defined(__FreeBSD__) && !defined(NOKLDLOAD)
 
 What's the point of this conditional?  This program doesn't check
 __FreeBSD__ anywhere else, and it operates on a kernel device, so I
 think it's rather pointless.  Ditto for NOKLDLOAD.  The only thing
 that checks these is ppp(8), and ppp(8) *is* expected to work on
 systems other than FreeBSD.  All other programs that do something like
 this (e.g., ccdconfig, ifconfig) don't perform these checks.
 
 > +	if (modfind("if_sl") == -1) {
 > + 		if (kldload("if_sl") == -1) {
 
 You should probably check that the module was really loaded, since the
 mapping between klds and modules isn't clear.  For example, the
 "if_sl" module doesn't have to exist in the file called if_sl.ko.
 Most other programs do something like this:
 
         if (modfind(MODULE) < 0) {
                 /* Not present in kernel, try loading it */
                 if (kldload(MODULE) < 0 || modfind(MODULE) < 0)
                         warn("module not available!");
 
 Ignore the "< 0" tests; those are wrong.  They should be "== -1" like
 in your patch.
 
 > +			syslog(LOG_ERR, "kldload if_sl: %s\n",
 > +			   strerror(errno));
 > +			down(2);
 
 As above, most programs don't consider it a fatal error if they can't
 find the module.  I don't see why this should, either.
 
 Thanks.
State-Changed-From-To: open->feedback 
State-Changed-By: schweikh 
State-Changed-When: Sun Sep 1 01:35:00 PDT 2002 
State-Changed-Why:  
Sergey, if this is still an issue, could you please 
modify your patch and incorporate Dima's suggestions? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=29361 
State-Changed-From-To: feedback->closed 
State-Changed-By: ceri 
State-Changed-When: Sun Jun 8 11:01:56 PDT 2003 
State-Changed-Why:  
Feedback timeout (6 months or more). 
I will handle any feedback that this closure generates. 


Responsible-Changed-From-To: freebsd-bugs->ceri 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Sun Jun 8 11:01:56 PDT 2003 
Responsible-Changed-Why:  
Feedback timeout (6 months or more). 
I will handle any feedback that this closure generates. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=29361 
>Unformatted:
