From 6a87d1a34cc0913c13acdcb5da7aa3a4362c29cb Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi@cloudius-systems.com>
Date: Thu, 3 Oct 2013 00:13:24 +0200
Subject: [PATCH] netinet/in.h: reconcile osv and bsd headers

Some structures are duplicated; move the duplicates to a common header
<netinet/__in.h>.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
---
 bsd/sys/netinet/in.h       | 19 +------------------
 include/api/netinet/__in.h | 23 +++++++++++++++++++++++
 include/api/netinet/in.h   | 13 +------------
 3 files changed, 25 insertions(+), 30 deletions(-)
 create mode 100644 include/api/netinet/__in.h

diff --git a/bsd/sys/netinet/in.h b/bsd/sys/netinet/in.h
index 8c8915ce5..ee5fb3412 100644
--- a/bsd/sys/netinet/in.h
+++ b/bsd/sys/netinet/in.h
@@ -468,24 +468,7 @@ __END_DECLS
 #define	IP_MAX_SOCK_SRC_FILTER		128	/* sources per socket/group */
 #define	IP_MAX_SOCK_MUTE_FILTER		128	/* XXX no longer used */
 
-/*
- * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
- */
-struct ip_mreq {
-	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
-	struct	in_addr imr_interface;	/* local IP address of interface */
-};
-
-/*
- * Modified argument structure for IP_MULTICAST_IF, obtained from Linux.
- * This is used to specify an interface index for multicast sends, as
- * the IPv4 legacy APIs do not support this (unless IP_SENDIF is available).
- */
-struct ip_mreqn {
-	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
-	struct	in_addr imr_address;	/* local IP address of interface */
-	int		imr_ifindex;	/* Interface index; cast to uint32_t */
-};
+#include <netinet/__in.h>
 
 /*
  * Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678]
diff --git a/include/api/netinet/__in.h b/include/api/netinet/__in.h
new file mode 100644
index 000000000..a2c6f2946
--- /dev/null
+++ b/include/api/netinet/__in.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2013 Cloudius Systems, Ltd.
+ *
+ * This work is open source software, licensed under the terms of the
+ * BSD license as described in the LICENSE file in the top-level directory.
+ */
+
+
+#ifndef OSV__IN_H_
+#define OSV__IN_H_
+
+struct ip_mreq {
+        struct  in_addr imr_multiaddr;  /* IP multicast address of group */
+        struct  in_addr imr_interface;  /* local IP address of interface */
+};
+
+struct ip_mreqn {
+        struct  in_addr imr_multiaddr;  /* IP multicast address of group */
+        struct  in_addr imr_address;    /* local IP address of interface */
+        int             imr_ifindex;    /* Interface index; cast to uint32_t */
+};
+
+#endif /* OSV__IN_H_ */
diff --git a/include/api/netinet/in.h b/include/api/netinet/in.h
index 32f9ff222..4d01afef1 100644
--- a/include/api/netinet/in.h
+++ b/include/api/netinet/in.h
@@ -242,18 +242,7 @@ struct ip_opts
 	char ip_opts[40];
 };
 
-struct ip_mreq
-{
-	struct in_addr imr_multiaddr;
-	struct in_addr imr_interface;
-};
-
-struct ip_mreqn
-{
-	struct in_addr imr_multiaddr;
-	struct in_addr imr_address;
-	int imr_ifindex;
-};
+#include <netinet/__in.h>
 
 struct in_pktinfo
 {
-- 
GitLab