Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 May 2003 14:04:19 -0700 (PDT)
From:      =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= <mbsd@pacbell.net>
To:        Attila Nagy <bra@fsn.hu>
Cc:        net@freebsd.org
Subject:   Re: A problem with too many network interfaces
Message-ID:  <20030526135441.U326@atlas.home>
In-Reply-To: <3ED1CB03.8010005@fsn.hu>
References:  <20030526010717.98E8391682@vineyard.net> <3ED1CB03.8010005@fsn.hu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 26 May 2003, Attila Nagy wrote:

> Eric W.Bates wrote:
> > I'm trying to build a router/filter on FreeBSD 4.8 with 4 real NIC and
> > 32 vlan interfaces.
> > Starting dhcpd generates an error after 15 interfaces:
> > "[interface] not found"
> > My C skills are lacking so while I'm grovelling thru dhcpd source to
> > find the problem; I was wondering if anyone knows of a kernel limit I
> > need to increase?
> It has nothing to do with FreeBSD.

It sort-of has...  See below.

> Take a look at common/discover.c to find the following code snippet:
>
> void discover_interfaces (state)
>          int state;
> {
>          struct interface_info *tmp, *ip;
>          struct interface_info *last, *next;
>          char buf [2048];
>                    ^^^^
> Increase the size of buf for example to 32768 and it will work.

Any static size will be too small at some point.  Note how the code
has some hacks to resize the buffer for certain cases (mainly for
assorted Linux flavors, by the look of it).  But there is no handling
of the BSD behavior of silently truncating the result if it won't fit,
nor to handle OSes that return an error.

A proper BSD port could use something like the trick in Stevens[1] and
keep retrying the call with a larger bufer until the length of the
result is the same as in the previous call.

Simply making the buffer "large enough" is of course easier... :-)

  $.02,
  /Mikko

1) W. Richard Stevens, UNIX Network Programming 2nd Ed. vol1, p434-435



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