Skip site navigation (1)Skip section navigation (2)
Date:      24 May 2004 01:06:17 +0200
From:      "Arno J. Klaassen" <arno@heho.snv.jussieu.fr>
To:        freebsd-hackers@freebsd.org
Subject:   early attaching tap0 
Message-ID:  <wp7jv2pwuu.fsf@heho.snv.jussieu.fr>

next in thread | raw e-mail | index | archive | help
--=-=-=

Hello,

ehmm, i hesitate writing to this list since I'm really
not a hacker, but I have a problem I seemingly cannot
resolve :

I would like the "device tap" entry of my kernel-config
to create and open an ethernet-device, rather
than just initialising the necessary kernel structures.

I made the following diff (needs "COPTFLAGS = -O -pipe -DTAP_INIT_ETHER"
since I do not know how to implement correctly
a kernel option ...) :


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=tap.patch

Index: net/if_tap.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_tap.c,v
retrieving revision 1.42
diff -r1.42 if_tap.c
125a126,132
> #if defined (TAP_INIT_ETHER)
> #include <net/if_types.h>
> static int tap_need_init = 1;
> dev_t tap0dev;
> void tapether(void);
> #endif /* defined (TAP_INIT_ETHER) */
> 
140c147
< 	int			 s;
---
> 	intrmask_t		 s;
156a164,168
> #if defined (TAP_INIT_ETHER)
> 		tap0dev =  make_dev(&tap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
> 		"tap0");
> 		tapcreate (tap0dev);
> #endif /* defined (TAP_INIT_ETHER) */
264c276
< static void
---
> void
315a328,336
> #if defined (TAP_INIT_ETHER)
> 	if (tap_need_init == 1) {
> 		ifp->if_type = IFT_ETHER;
> 		ifp->if_baudrate = 1200;
> 		tp->tap_flags |= TAP_OPEN;
> 		tp->tap_pid = 0; /* curproc->p_pid; */
> 		tap_need_init = 0;
> 	}
> #endif
325a347
> 
892a915
> 

--=-=-=


A kernel with this patch boots OK single user, but when going
multi-user it panics randomly
(sorry Thomas for blaming atapicam, I thouht I doublechecked
outcommenting COPTFLAGS before contacting you, I'm not sure
I did everything well ...)

I made similar changes to -stable and RELENG_5_2 which work
OK (i.e. no panics, stable system), but against -current
I am in the mist.
If ever someone has a quick idea about what I am doing wrong,
thanx a lot in advance.

Regards, Arno


--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?wp7jv2pwuu.fsf>