[...]
> From: Archie Cobbs [mailto:[EMAIL PROTECTED]]
> Julian Elischer writes:
> > > i was working on integration of Ethernet TAP driver and NETGRAPH
> > > and found strange thing. the problem is that NG_ETHER nodes do not
> > > detach correctly when interface is gone. i was taking a very quick
> > > look at it, and, it seems to me that we are missing one reference
> > > to a node. i think it is ng_name_node/ng_unname pair.
> >
> > This is quite possible because until recently interfaces could never
> > be removed. Therefore the act of removing a node was really
> > just a case of RESETTING the node. It was not removed.
>
> Here's some more info that may be helpful.
[...]
the problem still exists :( i tried to collect some information that,
i think, could be helpful.
first, my system
fly# uname -a
FreeBSD fly.private.org 5.0-CURRENT FreeBSD 5.0-CURRENT #2: Tue Jul 18
20:21:57
EST 2000 [EMAIL PROTECTED]:/usr/src/sys/compile/FLY i386
now modules and interfaces
fly# kldstat
Id Refs Address Size Name
1 3 0xc0100000 1cd99c kernel
2 1 0xc0974000 4000 logo_saver.ko
fly# ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
now i will load if_tap module and create virtual interface
fly# kldload -v ./if_tap.ko
Loaded ./if_tap.ko, id=3
fly# cat /dev/tap0
^C
fly# ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
tap0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
ether 00:bd:dd:25:00:00
now i will load ng_ether and check NETGRAPH nodes
fly# kldload -v ng_ether
Loaded ng_ether, id=4
fly# ngctl list
There are 2 total nodes:
Name: ngctl183 Type: socket ID: 00000002 Num hooks: 0
Name: tap0 Type: ether ID: 00000001 Num hooks: 0
fly# ngctl types
There are 2 total types:
Type name Number of living nodes
--------- ----------------------
socket 1
ether 1
so far so good :) now i will unload if_tap module
fly# kldunload if_tap
fly# ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
fly# cat /dev/tap0
cat: /dev/tap0: Device not configured
ok, both device and interface are gone, what about NETGRAPH nodes
fly# ngctl list
There are 1 total nodes:
Name: ngctl210 Type: socket ID: 00000004 Num hooks: 0
fly# ngctl types
There are 2 total types:
Type name Number of living nodes
--------- ----------------------
socket 1
ether 1
fly# kldunload ng_ether
kldunload: can't unload file: Device busy
ooops :( there is still 1 ``ether'' node :(
i did put some debug printf in ng_base and ng_ether. here is an output
ng_ether_detach: start node->refs = 2 --- ng_ether_detach()
ng_unref: node->refs = 3 --- ng_unfer(). ng_rmnode() it will add one extra
reference
ng_ether_detach: before final ng_unref() node->refs = 2 ---
ng_ether_detach() just before last ng_unref()
ng_unref: node->refs = 2 --- ng_unref()
so i think that shows that last ng_unref() was called with node->refs
equal to 2, and, i think, that is not correct :(
again, here is one of the millions of possible patches that works for me :)
*** ng_ether.c.old Tue Jul 18 21:17:54 2000
--- ng_ether.c Tue Jul 18 21:48:46 2000
***************
*** 293,298 ****
--- 293,299 ----
bzero(priv, sizeof(*priv));
FREE(priv, M_NETGRAPH);
node->private = NULL;
+ ng_unname(node); /* remove node name */
ng_unref(node); /* free node itself */
}
if_tap module sources can be found at
http://home.earthlink.net/~evmax/tap-fbsd5b1.tar.gz
sorry for long letter :) hope that helps :)
thanks,
emax
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message