]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
2000-10-17 Scott McDermott <mcdermot@questra.com>
authorhjl <hjl>
Wed, 18 Oct 2000 06:16:02 +0000 (06:16 +0000)
committerhjl <hjl>
Wed, 18 Oct 2000 06:16:02 +0000 (06:16 +0000)
* support/export/client.c (client_init): Support CIDR netmask
in /etc/exports.

ChangeLog
support/export/client.c

index 60886341d7edd9e0953ac296c35e305de99f5794..ab7c336f8873a173fbad5fb2285b017bbc99353a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-10-17  Scott McDermott <mcdermot@questra.com>
+
+       * support/export/client.c (client_init): Support CIDR netmask
+       in /etc/exports.
+
 2000-10-11  H.J. Lu <hjl@lucon.org>
 
        * aclocal.m4 (AC_TCP_WRAPPER): Fix a typo.
index a7f9d020c390a3e6f25643e32ce6cb959281b2da..3afd4f2940c0455af93975d55b39590a09389b0f 100644 (file)
@@ -118,7 +118,20 @@ client_init(nfs_client *clp, const char *hname, struct hostent *hp)
 
                *cp = '\0';
                clp->m_addrlist[0].s_addr = inet_addr(clp->m_hostname);
-               clp->m_addrlist[1].s_addr = inet_addr(cp+1);
+               if (strchr(cp + 1, '.')) {
+                       clp->m_addrlist[1].s_addr = inet_addr(cp+1);
+               }
+               else {
+                       int netmask = atoi(cp + 1);
+                       if (0 < netmask && netmask <= 32) {
+                               clp->m_addrlist[1].s_addr =
+                                       htonl ((uint32_t) ~0 << (32 - netmask));
+                       }
+                       else {
+                               xlog(L_FATAL, "invalid netmask `%s' for %s",
+                                    cp + 1, clp->m_hostname);
+                       }
+               }
                *cp = '/';
                clp->m_naddr = 0;
        } else if (!hp) {