From owner-freebsd-current Wed Jul 19 6: 7:40 2000 Delivered-To: freebsd-current@freebsd.org Received: from kcmso1.proxy.att.com (kcmso1.att.com [192.128.133.69]) by hub.freebsd.org (Postfix) with ESMTP id DD24137BDDC for ; Wed, 19 Jul 2000 06:07:25 -0700 (PDT) (envelope-from myevmenkin@att.com) Received: from njb140r1.ems.att.com ([135.65.202.58]) by kcmso1.proxy.att.com (AT&T IPNS/MSO-2.2) with ESMTP id JAA14791; Wed, 19 Jul 2000 09:07:23 -0400 (EDT) Received: from njb140bh1.ems.att.com by njb140r1.ems.att.com (8.8.8+Sun/ATTEMS-1.4.1 sol2) id JAA15374; Wed, 19 Jul 2000 09:06:14 -0400 (EDT) Received: by njb140bh1.ems.att.com with Internet Mail Service (5.5.2650.21) id <3352XVV9>; Wed, 19 Jul 2000 09:07:23 -0400 Message-ID: From: "Yevmenkin, Maksim N, CSCIO" To: "'Archie Cobbs'" , Julian Elischer Cc: "'freebsd-current@freebsd.org'" Subject: RE: possible NETGRAPH/NG_ETHER bug Date: Wed, 19 Jul 2000 09:07:19 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [...] > From: Archie Cobbs [mailto:archie@whistle.com] > 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 root@fly.private.org:/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 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 mtu 16384 inet 127.0.0.1 netmask 0xff000000 tap0: flags=8802 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 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 majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message