From: hjl Date: Wed, 18 Oct 2000 06:16:02 +0000 (+0000) Subject: 2000-10-17 Scott McDermott X-Git-Tag: nfs-utils-0-3~22 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=a19d80373216f3257c1b5ef59e41279f94744377;p=nfs-utils.git 2000-10-17 Scott McDermott * support/export/client.c (client_init): Support CIDR netmask in /etc/exports. --- diff --git a/ChangeLog b/ChangeLog index 6088634..ab7c336 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-10-17 Scott McDermott + + * support/export/client.c (client_init): Support CIDR netmask + in /etc/exports. + 2000-10-11 H.J. Lu * aclocal.m4 (AC_TCP_WRAPPER): Fix a typo. diff --git a/support/export/client.c b/support/export/client.c index a7f9d02..3afd4f2 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -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) {