From owner-freebsd-current Sun Dec 10 11:45:35 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id LAA05054 for current-outgoing; Sun, 10 Dec 1995 11:45:35 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id LAA05047 for ; Sun, 10 Dec 1995 11:45:33 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id MAA01505; Sun, 10 Dec 1995 12:43:33 -0700 From: Terry Lambert Message-Id: <199512101943.MAA01505@phaeton.artisoft.com> Subject: Re: [CRITICAL] patch for /usr/src/sys/net/if_tun.c To: scrappy@hub.org (Marc G. Fournier) Date: Sun, 10 Dec 1995 12:43:33 -0700 (MST) Cc: current@FreeBSD.org In-Reply-To: from "Marc G. Fournier" at Dec 9, 95 11:02:14 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@FreeBSD.org Precedence: bulk > The string 'name' isn't defined in /usr/src/sys/net/if_tun.c. > since it is being used in: > > #ifdef DEVFS > sprintf(name, "tun%d", i ); > tun_devfs_token[i] = devfs_add_devsw( > "/", name, &tun_cdevsw , i, > DV_CHR, 0, 0, 0600); > #endif > > The following patch makes the assumption (this is my first attempt > at doing *anything* in the kernel) that tun will never become tun9999 and > declares name as being an 8 character string. > > > *** net/if_tun.c.orig Sat Dec 9 22:55:56 1995 > --- net/if_tun.c Sat Dec 9 22:58:10 1995 > *************** > *** 108,113 **** > --- 108,116 ---- > register int i; > struct ifnet *ifp; > dev_t dev; > + #ifdef DEVFS > + char name[8]; > + #endif > > if( tun_devsw_installed ) return; > dev = makedev(CDEV_MAJOR, 0); This makes sense if it is "#ifdef'able" (fixes the i > 5 digits bug, too): #ifdef DEVFS { char name[ 8]; sprintf(name, "tun%5d", i ); tun_devfs_token[i] = devfs_add_devsw( "/", name, &tun_cdevsw , i, DV_CHR, 0, 0, 0600); } #endif Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.