Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 May 1999 08:10:01 -0700 (PDT)
From:      "Mark J. Taylor" <mtaylor@cybernet.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/11525: [PATCH] Networking patches to increase # interfa
Message-ID:  <199905061510.IAA29692@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/11525; it has been noted by GNATS.

From: "Mark J. Taylor" <mtaylor@cybernet.com>
To: "Justin T. Gibbs" <gibbs@plutotech.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: misc/11525: [PATCH] Networking patches to increase # interfa
Date: Thu, 06 May 1999 11:10:27 -0400 (EDT)

 "Band-aid" is basically correct.  There is a sysctl() that gets the
 number of interfaces (I don't know what it is).  This number can then
 be used to allocate the size of the array.  I was interested in getting
 client programs "working" and "functional", instead of writing very
 pretty code.  It really sucks when you increase the number of networking
 interfaces in your kernel (like more ppp, slip, and tun, as an ISP
 might do) and things like "portmap" stop working.  I've seen it not
 find ANY local IP addresses (src/usr.sbin/portmap/from_local.c is one
 of the patched files).
 
 However, because I wanted to do "less damage" (read: minimal changes),
 and most of the code that was patched determined the size of the array
 at variable declaration time, as in:
   struct ifreq array[16];
 
 I decided to not malloc() the array, because of multiple exit points
 in the routines, I might have forgotten to free() the array.  Each
 additional ifreq structure is 32 bytes, so I figured a few more kb of
 stack didn't matter too much.  POSIX threads, I am told, limits the
 stack size to 1 MB, and 6 KB (192 ifreq structs) is nowhere near that
 limit.  :)
 
 I guess that I could have alloca()'ed the array, and not worried about
 free().
 
 If someone would point me at the sysctl() (or a program that uses it),
 and declare the "correct" way that they want this patched, I'll be glad
 to do it!  1) as-is, 2) alloca(),  3) sysctl()+alloca(),
 4) sysctl()+malloc()+free(), or 5) alternative?
 
 It's not like I'm against positive progress!  Let me know what -core
 would like!  I've got more patches coming, but I'd like to get this
 "basic" set out of the way first...
 
 
 
 -Mark Taylor
 NetMAX Developer
 mtaylor@cybernet.com
 
 
 On 06-May-99 Justin T. Gibbs wrote:
 >>>Synopsis:       [PATCH] Networking patches to increase # interfaces in SIOCGIFCONF calls
 > 
 > Wouldn't a better solution be to add another API that takes a 
 > starting interface number and allows you to make multiple calls
 > to retrieve all interfaces regardless of the number in the system?
 > Bumping the limit seems like a band-aid at best.
 > 
 > --
 > Justin
 
 
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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