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