From owner-freebsd-bugs Tue Oct 22 20:56:42 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id UAA00138 for bugs-outgoing; Tue, 22 Oct 1996 20:56:42 -0700 (PDT) Received: (from scrappy@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id UAA00127; Tue, 22 Oct 1996 20:56:40 -0700 (PDT) Date: Tue, 22 Oct 1996 20:56:40 -0700 (PDT) From: "Marc G. Fournier" Message-Id: <199610230356.UAA00127@freefall.freebsd.org> To: pjchilds@imforei.apana.org.au, scrappy, freebsd-bugs Subject: Re: bin/1316 Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Synopsis: 10 tunnel device limit State-Changed-From-To: open-feedback State-Changed-By: scrappy State-Changed-When: Tue Oct 22 20:44:06 PDT 1996 State-Changed-Why: This problem is supposedly fixed in 2.2-CURRENT, and looking at the code, the function OpenTunnel() seems to have had the initial 15 or so lines rewritten, but nothing that looks like a "structural" change. Would it be safe to apply the following to fix/close this PR, which is a diff of the changes (will make a context diff before I apply it) between 2.2-CURRENT's usr.sbin/ppp/os.c and 2.1.5-RELEASE's: 257a258,263 > > #define MAX_TUN 256 > /* MAX_TUN is set at an arbitrarily large value * > * as the loop aborts when it reaches the first * > * 'Device not configured' (ENXIO), or the third * > * 'No such file or directory' (ENOENT) error. */ 263,264d268 < char *cp; < char *suffix = "0123456789"; 266c270,271 < char devname[12]; --- > char devname[14]; /* sufficient room for "/dev/tun65535" */ > unsigned unit, enoentcount=0; 268,270c273,274 < strcpy(devname, "/dev/tun0"); < for (cp = suffix; *cp; cp++) { < devname[8] = *cp; --- > for( unit=0; unit <= MAX_TUN ; unit++ ) { > sprintf( devname, "/dev/tun%d", unit ); 272,273c276,284 < if (tun_out >= 0) < break; --- > if( tun_out >= 0 ) > break; > if( errno == ENXIO ) > unit=MAX_TUN+1; > else if( errno == ENOENT ) { > enoentcount++; > if( enoentcount > 2 ) > unit=MAX_TUN+1; > } 275,276c286 < *ptun = cp - suffix; < if (*cp == '\0') { --- > if( unit > MAX_TUN ) { 279a290 > *ptun = unit;