Skip to contentSkip to conversation

ipv6: fix redefinition of in6_pktinfo and ip6_mtuinfo

PATCH Applied Cong Wang 3 participants 7 messages Jan 6, 2015 – Feb 7, 2015

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 ipv6: fix redefinition of in6_pktinfo and ip6_mtuinfo

Both netinet/in.h and linux/ipv6.h define these two structs, if we include both of them, we got:

/usr/include/linux/ipv6.h:19:8: error: redefinition of ‘struct in6_pktinfo’
struct in6_pktinfo {
^
In file included from /usr/include/arpa/inet.h:22:0,
from txtimestamp.c:33:
/usr/include/netinet/in.h:524:8: note: originally defined here
struct in6_pktinfo
^
In file included from txtimestamp.c:40:0:
/usr/include/linux/ipv6.h:24:8: error: redefinition of ‘struct ip6_mtuinfo’
struct ip6_mtuinfo {
^
In file included from /usr/include/arpa/inet.h:22:0,
from txtimestamp.c:33:
/usr/include/netinet/in.h:531:8: note: originally defined here
struct ip6_mtuinfo
^
So similarly to what we did for in6_addr, we need to sync with
libc header on their definitions.

---
 include/uapi/linux/ipv6.h        | 5 ++++-
 include/uapi/linux/libc-compat.h | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
include/uapi/linux/ipv6.h +4 -1
index e863d08..b9b1b7d 100644
@@ -15,16 +15,19 @@
  *	*under construction*
  */
 
-
+#if __UAPI_DEF_IN6_PKTINFO
 struct in6_pktinfo {
 	struct in6_addr	ipi6_addr;
 	int		ipi6_ifindex;
 };
+#endif
 
+#if __UAPI_DEF_IP6_MTUINFO
 struct ip6_mtuinfo {
 	struct sockaddr_in6	ip6m_addr;
 	__u32			ip6m_mtu;
 };
+#endif
 
 struct in6_ifreq {
 	struct in6_addr	ifr6_addr;
include/uapi/linux/libc-compat.h +6 -0
index e28807a..fa673e9 100644
@@ -70,6 +70,8 @@
 #define __UAPI_DEF_IPV6_MREQ		0
 #define __UAPI_DEF_IPPROTO_V6		0
 #define __UAPI_DEF_IPV6_OPTIONS		0
+#define __UAPI_DEF_IN6_PKTINFO		0
+#define __UAPI_DEF_IP6_MTUINFO		0
 
 #else
 
@@ -84,6 +86,8 @@
 #define __UAPI_DEF_IPV6_MREQ		1
 #define __UAPI_DEF_IPPROTO_V6		1
 #define __UAPI_DEF_IPV6_OPTIONS		1
+#define __UAPI_DEF_IN6_PKTINFO		1
+#define __UAPI_DEF_IP6_MTUINFO		1
 
 #endif /* _NETINET_IN_H */
 
@@ -106,6 +110,8 @@
 #define __UAPI_DEF_IPV6_MREQ		1
 #define __UAPI_DEF_IPPROTO_V6		1
 #define __UAPI_DEF_IPV6_OPTIONS		1
+#define __UAPI_DEF_IN6_PKTINFO		1
+#define __UAPI_DEF_IP6_MTUINFO		1
 
 /* Definitions for xattr.h */
 #define __UAPI_DEF_XATTR		1
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/1 doc: fix the compile error of txtimestamp.c

Vinson reported:

HOSTCC Documentation/networking/timestamping/txtimestamp
Documentation/networking/timestamping/txtimestamp.c:64:8: error:
redefinition of ‘struct in6_pktinfo’

 struct in6_pktinfo {
        ^

In file included from /usr/include/arpa/inet.h:23:0,
from Documentation/networking/timestamping/txtimestamp.c:33:
/usr/include/netinet/in.h:456:8: note: originally defined here
struct in6_pktinfo

        ^

After we sync with libc header, we don't need this ugly hack any more.

---
 Documentation/networking/timestamping/txtimestamp.c | 8 --------
 1 file changed, 8 deletions(-)
Documentation/networking/timestamping/txtimestamp.c +0 -8
index 876f71c..8778e68 100644
@@ -59,14 +59,6 @@
 #include <time.h>
 #include <unistd.h>
 
-/* ugly hack to work around netinet/in.h and linux/ipv6.h conflicts */
-#ifndef in6_pktinfo
-struct in6_pktinfo {
-	struct in6_addr	ipi6_addr;
-	int		ipi6_ifindex;
-};
-#endif
-
 /* command line parameters */
 static int cfg_proto = SOCK_STREAM;
 static int cfg_ipproto = IPPROTO_TCP;
Signature · 1 line
1.8.3.1
maintainer Applied
#2 lore raw

Re: [Patch net-next] doc: fix the compile error of txtimestamp.c

From: Cong Wang <[email protected]>
Date: Tue, 6 Jan 2015 15:45:32 -0800

Quoted 11 lines

Vinson reported:

HOSTCC Documentation/networking/timestamping/txtimestamp
Documentation/networking/timestamping/txtimestamp.c:64:8: error:
redefinition of ‘struct in6_pktinfo’

 struct in6_pktinfo {
        ^

In file included from /usr/include/arpa/inet.h:23:0,
from Documentation/networking/timestamping/txtimestamp.c:33:
/usr/include/netinet/in.h:456:8: note: originally defined here
struct in6_pktinfo

Quoted 6 lines
        ^

After we sync with libc header, we don't need this ugly hack any more.

Applied.

maintainer Applied
#3 lore raw
In reply to Cong Wang

From: Cong Wang <[email protected]>
Date: Tue, 6 Jan 2015 15:45:31 -0800

Quoted 23 lines

Both netinet/in.h and linux/ipv6.h define these two structs, if we include both of them, we got:

/usr/include/linux/ipv6.h:19:8: error: redefinition of ‘struct in6_pktinfo’
struct in6_pktinfo {
^
In file included from /usr/include/arpa/inet.h:22:0,
from txtimestamp.c:33:
/usr/include/netinet/in.h:524:8: note: originally defined here
struct in6_pktinfo
^
In file included from txtimestamp.c:40:0:
/usr/include/linux/ipv6.h:24:8: error: redefinition of ‘struct ip6_mtuinfo’
struct ip6_mtuinfo {
^
In file included from /usr/include/arpa/inet.h:22:0,
from txtimestamp.c:33:
/usr/include/netinet/in.h:531:8: note: originally defined here
struct ip6_mtuinfo
^
So similarly to what we did for in6_addr, we need to sync with
libc header on their definitions.

Quoted 1 line

Applied.

#4 lore raw
Quoted 26 lines · David Miller

From: Cong Wang <[email protected]>
Date: Tue, 6 Jan 2015 15:45:31 -0800

Quoted 23 lines

Both netinet/in.h and linux/ipv6.h define these two structs, if we include both of them, we got:

/usr/include/linux/ipv6.h:19:8: error: redefinition of ‘struct in6_pktinfo’
struct in6_pktinfo {
^
In file included from /usr/include/arpa/inet.h:22:0,
from txtimestamp.c:33:
/usr/include/netinet/in.h:524:8: note: originally defined here
struct in6_pktinfo
^
In file included from txtimestamp.c:40:0:
/usr/include/linux/ipv6.h:24:8: error: redefinition of ‘struct ip6_mtuinfo’
struct ip6_mtuinfo {
^
In file included from /usr/include/arpa/inet.h:22:0,
from txtimestamp.c:33:
/usr/include/netinet/in.h:531:8: note: originally defined here
struct ip6_mtuinfo
^
So similarly to what we did for in6_addr, we need to sync with
libc header on their definitions.

Quoted 4 lines
Quoted 1 line

Applied.

I'm reviewing the glibc side and will apply there if nobody has done so yet.

Cheers,
Carlos.

#5 lore raw
In reply to David Miller
Quoted 26 lines · David Miller

From: Cong Wang <[email protected]>
Date: Tue, 6 Jan 2015 15:45:31 -0800

Quoted 23 lines

Both netinet/in.h and linux/ipv6.h define these two structs, if we include both of them, we got:

/usr/include/linux/ipv6.h:19:8: error: redefinition of ‘struct in6_pktinfo’
struct in6_pktinfo {
^
In file included from /usr/include/arpa/inet.h:22:0,
from txtimestamp.c:33:
/usr/include/netinet/in.h:524:8: note: originally defined here
struct in6_pktinfo
^
In file included from txtimestamp.c:40:0:
/usr/include/linux/ipv6.h:24:8: error: redefinition of ‘struct ip6_mtuinfo’
struct ip6_mtuinfo {
^
In file included from /usr/include/arpa/inet.h:22:0,
from txtimestamp.c:33:
/usr/include/netinet/in.h:531:8: note: originally defined here
struct ip6_mtuinfo
^
So similarly to what we did for in6_addr, we need to sync with
libc header on their definitions.

Quoted 4 lines
Quoted 1 line

Applied.

When does this hit mainline? I've got Cong's patch ready for glibc, but the usual procedure is to commit after mainline has the matching patch. Not that it really matters, but it's just a useful thing to be able to say the trickle down is linux->glibc.

Cheers,
Carlos.

author
#6 lore raw

Hi, Carlos

Quoted 6 lines · Carlos O'Donell

When does this hit mainline? I've got Cong's patch ready for glibc, but the usual procedure is to commit after mainline has the matching patch. Not that it really matters, but it's just a useful thing to be able to say the trickle down is linux->glibc.

It will be merged in the next merge window, currently it is just in net-next.

Thanks.