Blob Blame History Raw
diff -up nfs-utils-1.3.0/support/export/client.c.save nfs-utils-1.3.0/support/export/client.c
--- nfs-utils-1.3.0/support/export/client.c.save	2016-06-07 14:02:11.244677000 -0400
+++ nfs-utils-1.3.0/support/export/client.c	2016-06-07 14:03:11.380193000 -0400
@@ -635,7 +635,7 @@ check_netgroup(const nfs_client *clp, co
 	const char *netgroup = clp->m_hostname + 1;
 	struct addrinfo *tmp = NULL;
 	struct hostent *hp;
-	char *dot, *hname;
+	char *dot, *hname, *ip;
 	int i, match;
 
 	match = 0;
@@ -682,6 +682,18 @@ check_netgroup(const nfs_client *clp, co
 		}
 	}
 
+	/* check whether the IP itself is in the netgroup */
+	ip = calloc(INET6_ADDRSTRLEN, 1);
+	if (inet_ntop(ai->ai_family, &(((struct sockaddr_in *)ai->ai_addr)->sin_addr), ip, INET6_ADDRSTRLEN) == ip) {
+		if (innetgr(netgroup, ip, NULL, NULL)) {
+			free(hname);
+			hname = ip;
+			match = 1;
+			goto out;
+		}
+	}
+	free(ip);
+
 	/* Okay, strip off the domain (if we have one) */
 	dot = strchr(hname, '.');
 	if (dot == NULL)