Re: A problem with too many network interfaces

From: Mikko Työläjärvi (mbsd_at_pacbell.net)
Date: 05/26/03

  • Next message: Roger 'Rocky' Vetterberg: "Re: 3 NICs NAT setup, almost there ..."
    Date: Mon, 26 May 2003 14:04:19 -0700 (PDT)
    To: Attila Nagy <bra@fsn.hu>
    
    

    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
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Roger 'Rocky' Vetterberg: "Re: 3 NICs NAT setup, almost there ..."