Re: if_tun failed to register

From: Brian Lynn <blynn42_at_comcast.net>
Date: Wed, 05 Nov 2003 17:25:07 -0500
          
On Wed, 05 Nov 2003 18:37 Michael Nottebrock wrote:
> On Tuesday 04 November 2003 15:32, Antoine Jacoutot wrote:
> > Matteo Riondato wrote:
> > >>Well, it did not change anything :(
> > >>What is really strange is that "tun" is compiled in the kernel, but the
> > >>module is started anyway ???
> > >
> > > I had the same problem last year and solved it by removing
> > > device tun
> > > from the kernel configuration file.
> >
> > Yes, I though about it. But still, it is a strange bug and I cannot
> > believe I (well, and you :) ) am the only one seeing this.
> 
> It's been there for quite a while, I see that behaviour in 5.1-RELEASE, too.
> 
> =2D-=20
>    ,_,   | Michael Nottebrock               | lofi_at_freebsd.org
>  (/^ ^\) | FreeBSD - The Power to Serve     | http://www.freebsd.org
>    \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org
> 

This looks like the opposite of a problem on STABLE.  On CURRENT ifconfig
checks for 'tun' in the kernel when you do e.g. 'ifconfig tun0' [1], but
the driver is registered as 'if_tun'.  At the moment I don't have any
5-* boxes, so I can't check this for sure, but it looks like ifconfig
will be run at startup if you have any ifconfig_tun* lines in rc.conf.
You can see if ifconfig is the culprit by booting single-user and doing
ifconfig tun0 (it is only the first attempt that gives the error message
in question).  If so, the following (Untested!) patch would presumably
fix it:

Index: sys/net/if_tun.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_tun.c,v
retrieving revision 1.129
diff -u -r1.129 if_tun.c
--- sys/net/if_tun.c       31 Oct 2003 18:32:08 -0000      1.129
+++ sys/net/if_tun.c       5 Nov 2003 21:59:10 -0000
_at__at_ -200,7 +200,7 _at__at_
        0
 };

-DECLARE_MODULE(if_tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+DECLARE_MODULE(tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);

 static void
 tunstart(struct ifnet *ifp)


===================================================================

A similar change would likely work for if_ppp.c.
Assuming I am right about this (hah :) a pr would seem to be in order.
Brian

[1] Per this commit:
mdodd       2003/04/14 23:25:58 PDT

  FreeBSD src repository

  Modified files:
    sbin/ifconfig        ifconfig.c 
  Log:
  Don't abuse module names to facilitate ifconfig module loading;
  such abuse isn't really needed.  (And if we do need type information
  associated with a module then we should make it explicit and not
  use hacks.)
  
  Revision  Changes    Path
  1.89      +1 -1      src/sbin/ifconfig/ifconfig.c
Received on Wed Nov 05 2003 - 13:25:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:27 UTC