Bug 29361

Summary: startslip can't load if_sl.ko
Product: Base System Reporter: osa <osa>
Component: binAssignee: Ceri Davies <ceri>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description osa 2001-08-01 11:10:07 UTC
	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
Comment 1 dima 2001-09-06 13:32:11 UTC
"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.
Comment 2 Jens Schweikhardt freebsd_committer freebsd_triage 2002-09-01 09:35:00 UTC
State Changed
From-To: open->feedback

Sergey, if this is still an issue, could you please 
modify your patch and incorporate Dima's suggestions?
Comment 3 Ceri Davies freebsd_committer freebsd_triage 2003-06-08 19:01:56 UTC
State Changed
From-To: feedback->closed

Feedback timeout (6 months or more). 
I will handle any feedback that this closure generates. 


Comment 4 Ceri Davies freebsd_committer freebsd_triage 2003-06-08 19:01:56 UTC
Responsible Changed
From-To: freebsd-bugs->ceri

Feedback timeout (6 months or more). 
I will handle any feedback that this closure generates.