Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Jan 1997 11:27:13 +0800
From:      Peter Wemm <peter@spinner.DIALix.COM>
To:        davidn@blaze.net.au
Cc:        grog@lemis.de, FreeBSD current users <FreeBSD-current@freebsd.org>
Subject:   Re: What's happened to nfsd and mountd? 
Message-ID:  <199701090327.LAA10608@spinner.DIALix.COM>
In-Reply-To: Your message of "Thu, 09 Jan 1997 13:27:30 %2B1100." <Pine.BSF.3.95.970109131808.775A-100000@labs.usn.blaze.net.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
David Nugent wrote:
> We're suffering the same problem here. ifconfig -a shows:
[..]

> The first interface is up and operational. Nothing funky with IP
> aliases on this box. Another one (with nothing but loopback and
> ethernet) which *does* have several IP aliases on ed0 is using
> the exact same build, but mountd/nfsd load and work fine there. 
> 
> Regards,
> David

OK, time to run a quick test..  What do you guys get from this quick hack..

pwroot@spinner[11:04am]~-227# cc -o gma gma.c
pwroot@spinner[11:04am]~-228# ./gma 

get_myaddress() returns 0
sin_family = 2 (AF_INET = 2)
sin_len = 16 (16)
sin_port = 111
sin_addr = 127.0.0.1
SIOCFIGCONF used 316 bytes of a buffer 1024 long

pwroot@spinner[11:04am]~-229# cat gma.c

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <net/if.h>
main()
{
        struct sockaddr_in mya;
        int r, s;
        char buf[BUFSIZ];
        struct ifconf ifc;

        r = get_myaddress(&mya);
        printf("get_myaddress() returns %d\n", r);

        printf("sin_family = %d (AF_INET = %d)\n", mya.sin_family, AF_INET);
        printf("sin_len = %d (%d)\n", mya.sin_len, sizeof(mya));
        printf("sin_port = %d\n", ntohs(mya.sin_port));
        printf("sin_addr = %s\n", inet_ntoa(mya.sin_addr.s_addr));

        s = socket(AF_INET, SOCK_DGRAM, 0);
        if (s < 0)
                err(1, "socket");
        ifc.ifc_len = sizeof (buf);
        ifc.ifc_buf = buf;
        if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
                err(1, "SIOCGIFCONF");
        printf("SIOCFIGCONF used %d bytes of a buffer %d long\n", ifc.ifc_len,
                sizeof(buf));
}

One of my systems nearby uses 992 bytes of the SIOCGIFCONF 1024 byte buffer
(as used in get_myaddress).  It would be interesting to know what happens
if it is overflowing on the systems that are failing. 

Just to make things even more bizzare, the system that returns 992 bytes
(struct ifreq = 32 bytes), which is 31 ifreq's, actually has 49 interfaces,
and yet SIOCGIFCONF returned a "short" list with only 31 entries and no
indication of error or overflow.  (the actual number of slots of
SIOCGIFCONF data comes from  "netstat -in | grep -v Name | wc -l", don't
forget that SIOCGIFCONF also returns AF_LINK entries)

On my own system here, I have 5 interfaces, yet SIOCGIFCONF returns 9 ifreq
structs. 

Garrett suggested redoing get_myaddress() to use sysctl(), which is
starting to sound more appealing.. 

Something to try on the machines that are failing..  In lib/libc/rpc/
get_myaddress.c, change "char buf[BUFSIZ];" to something bigger,
eg: "char buf[10240];"   If you got about "992 used" for the test program
above, make the change there too.

Cheers,
-Peter





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