Date: Tue, 22 Oct 1996 20:56:40 -0700 (PDT) From: "Marc G. Fournier" <scrappy> To: pjchilds@imforei.apana.org.au, scrappy, freebsd-bugs Subject: Re: bin/1316 Message-ID: <199610230356.UAA00127@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610230356.UAA00127>
