From a40e00a16cf43245953ad6d43a4f260a47e6d198 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sat, 23 Jun 2012 21:58:36 +0200
Subject: [PATCH] Add missing INET6 conditional

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 src/rpc_generic.c |    2 ++
 src/svc_dg.c      |    4 ++++
 2 files changed, 6 insertions(+)

diff --git a/src/rpc_generic.c b/src/rpc_generic.c
index 509fb36..2eb91ad 100644
--- a/src/rpc_generic.c
+++ b/src/rpc_generic.c
@@ -535,7 +535,9 @@ __rpc_nconf2fd_flags(const struct netconfig *nconf, int flags)
 	    si.si_af == AF_INET6) {
 		int val = 1;
 
+#ifdef INET6
 		setsockopt(fd, SOL_IPV6, IPV6_V6ONLY, &val, sizeof(val));
+#endif
 	}
 	return fd;
 }
diff --git a/src/svc_dg.c b/src/svc_dg.c
index 66a56ee..e8faf33 100644
--- a/src/svc_dg.c
+++ b/src/svc_dg.c
@@ -627,9 +627,11 @@ svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
 		(void) setsockopt(fd, SOL_IP, IP_PKTINFO, &val, sizeof(val));
 		break;
 
+#ifdef INET6
 	case AF_INET6:
 		(void) setsockopt(fd, SOL_IPV6, IPV6_PKTINFO, &val, sizeof(val));
 		break;
+#endif
 	}
 }
 
@@ -667,6 +669,7 @@ svc_dg_valid_pktinfo(struct msghdr *msg)
 		}
 		break;
 
+#ifdef INET6
 	case AF_INET6:
 		if (cmsg->cmsg_level != SOL_IPV6
 		 || cmsg->cmsg_type != IPV6_PKTINFO
@@ -679,6 +682,7 @@ svc_dg_valid_pktinfo(struct msghdr *msg)
 			pkti->ipi6_ifindex = 0;
 		}
 		break;
+#endif
 
 	default:
 		return 0;
-- 
1.7.9.5

