Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Dec 1995 12:43:33 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        scrappy@hub.org (Marc G. Fournier)
Cc:        current@FreeBSD.org
Subject:   Re: [CRITICAL] patch for /usr/src/sys/net/if_tun.c
Message-ID:  <199512101943.MAA01505@phaeton.artisoft.com>
In-Reply-To: <Pine.BSF.3.91.951209225932.14418B-100000@hub.org> from "Marc G. Fournier" at Dec 9, 95 11:02:14 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 	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.



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