--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -39,12 +39,14 @@
 #include <sys/socket.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
+#ifdef IPV6_SUPPORTED
 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24))
 /* Cannot safely include linux/in6.h in old glibc, so hardcode the needed values */
 # define IPV6_PREFER_SRC_PUBLIC 2
 # define IPV6_ADDR_PREFERENCES 72
 #else
 # include <linux/in6.h>
+#endif
 #endif
 #include <netinet/in.h>
 #include <rpc/rpc.h>
@@ -1123,6 +1125,7 @@
 		if (bind(sock, SAFE_SOCKADDR(&sin), sizeof(sin)) < 0)
 			goto out;
 		break;
+#ifdef IPV6_SUPPORTED
 	case AF_INET6:
 		/* Make sure the call-back address is public/permanent */
 		val = IPV6_PREFER_SRC_PUBLIC;
@@ -1130,6 +1133,7 @@
 		if (bind(sock, SAFE_SOCKADDR(&sin6), sizeof(sin6)) < 0)
 			goto out;
 		break;
+#endif
 	default:
 		errno = EAFNOSUPPORT;
 		goto out;