netgroup limits on -current ... [mountd(8)]

From: Wilkinson, Alex <alex.wilkinson_at_dsto.defence.gov.au>
Date: Tue, 21 Feb 2006 12:24:35 +1030
OS: FreeBSD 7.0-CURRENT #24: Thu Feb 16 12:28:58 CST 2006

Hi all,

We are currently experiencing problems with FreeBSD -CURRENT and mountd(8).
When we export a filesystem via NFS to a netgroup with a 'large' number of hosts
in it we get all sorts of truncation. There looks like a limit on the number of
hosts in a netgroup FreeBSD's mountd(8) can export to. e.g.

NFS Export
----------

/export/home/username my_netgroup

mountd(8) In Debugging Mode
---------------------------

Feb 21 12:10:49 host mountd[83451]: can't get address info for host hostname.dsto.defence.g
Feb 21 12:10:49 host mountd[83451]: bad host host.dsto.defence.g in netgroup my_netgroup, skipping

This happens as mountd(8) builds its exports list via:

mountd: getting export list
mountd: got line /export/home/username my_netgroup
mountd: making new ep fs=0x4297314f,0x57f85ac
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au
got host host.dsto.defence.gov.au

...

relevant code producing this error:

/usr/src/usr.sbin/mountd

   get_host(cp, grp, tgrp)
           char *cp;
           struct grouplist *grp;
           struct grouplist *tgrp;
   {
           struct grouplist *checkgrp;
           struct addrinfo *ai, *tai, hints;
           int ecode;
           char host[NI_MAXHOST];

           if (grp->gr_type != GT_NULL) {
                   syslog(LOG_ERR, "Bad netgroup type for ip host %s", cp);
                   return (1);
           }
           memset(&hints, 0, sizeof hints);
           hints.ai_flags = AI_CANONNAME;
           hints.ai_protocol = IPPROTO_UDP;
           ecode = getaddrinfo(cp, NULL, &hints, &ai);
           if (ecode != 0) {
                   syslog(LOG_ERR,"can't get address info for host %s", cp);
                   return 1;
           }
           grp->gr_ptr.gt_addrinfo = ai;
           while (ai != NULL) {
                   if (ai->ai_canonname == NULL) {
                           if (getnameinfo(ai->ai_addr, ai->ai_addrlen, host,
                               sizeof host, NULL, 0, NI_NUMERICHOST) != 0)
                                   strlcpy(host, "?", sizeof(host));
                           ai->ai_canonname = strdup(host);
                           ai->ai_flags |= AI_CANONNAME;
                   }
                   if (debug)
                           fprintf(stderr, "got host %s\n", ai->ai_canonname);
                   /*
                    * Sanity check: make sure we don't already have an entry
                    * for this host in the grouplist.
                    */
                   for (checkgrp = tgrp; checkgrp != NULL;
                       checkgrp = checkgrp->gr_next) {
                           if (checkgrp->gr_type != GT_HOST)
                                   continue;
                           for (tai = checkgrp->gr_ptr.gt_addrinfo; tai != NULL;
                               tai = tai->ai_next) {
                                   if (sacmp(tai->ai_addr, ai->ai_addr, NULL) != 0)
                                           continue;
                                   if (debug)
                                           fprintf(stderr,
                                               "ignoring duplicate host %s\n",
                                               ai->ai_canonname);
                                   grp->gr_type = GT_IGNORE;
                                   return (0);
                           }
                   }
                   ai = ai->ai_next;
           }


Can someone please tell me if there is a limit on the number characters or hosts
that mountd(8) can build an export list from ? And if so can we increase it ?

Cheers

 - aW
Received on Tue Feb 21 2006 - 00:56:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:52 UTC