ipv6: fix redefinition of in6_pktinfo and ip6_mtuinfo
Subsystems (3)
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
@@ -15,16 +15,19 @@* *under construction* */ - +#if __UAPI_DEF_IN6_PKTINFOstruct in6_pktinfo {struct in6_addr ipi6_addr;int ipi6_ifindex; }; +#endif +#if __UAPI_DEF_IP6_MTUINFOstruct 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
@@ -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
PATCH 1/1 doc: fix the compile error of txtimestamp.c
Vinson reported:
HOSTCC Documentation/networking/timestamping/txtimestampDocumentation/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
@@ -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
From: Cong Wang <[email protected]>
Date: Tue, 6 Jan 2015 15:45:31 -0800
Quoted 23 lines
Both
netinet/in.handlinux/ipv6.hdefine these two structs, if we include both of them, we got:
/usr/include/linux/ipv6.h:19:8: error: redefinition of ‘struct in6_pktinfo’
structin6_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
structin6_pktinfo
^
In file included from txtimestamp.c:40:0:
/usr/include/linux/ipv6.h:24:8: error: redefinition of ‘struct ip6_mtuinfo’
structip6_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
structip6_mtuinfo
^
So similarly to what we did forin6_addr, we need to sync with
libc header on their definitions.
Quoted 1 line
Signed-off-by Cong Wang <[email protected]>
Applied.
Re: [Patch net-next] doc: fix the compile error of txtimestamp.c
In reply to Cong WangFrom: Cong Wang <[email protected]>
Date: Tue, 6 Jan 2015 15:45:32 -0800
Quoted 11 lines
Vinson reported:
HOSTCC
Documentation/networking/timestamping/txtimestampDocumentation/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,
fromDocumentation/networking/timestamping/txtimestamp.c:33:/usr/include/netinet/in.h:456:8: note: originally defined here
structin6_pktinfo
Quoted 6 lines
^After we sync with libc header, we don't need this ugly hack any more.
Reported-by Vinson Lee <[email protected]>Signed-off-by Cong Wang <[email protected]>
Applied.
Quoted 26 lines · David Miller
From: Cong Wang <[email protected]>
Date: Tue, 6 Jan 2015 15:45:31 -0800Quoted 23 lines
Both
netinet/in.handlinux/ipv6.hdefine these two structs, if we include both of them, we got:
/usr/include/linux/ipv6.h:19:8: error: redefinition of ‘struct in6_pktinfo’
structin6_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
structin6_pktinfo
^
In file included from txtimestamp.c:40:0:
/usr/include/linux/ipv6.h:24:8: error: redefinition of ‘struct ip6_mtuinfo’
structip6_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
structip6_mtuinfo
^
So similarly to what we did forin6_addr, we need to sync with
libc header on their definitions.
Quoted 4 lines
Quoted 1 line
Signed-off-by Cong Wang <[email protected]>Applied.
I'm reviewing the glibc side and will apply there if nobody has done so yet.
Cheers,
Carlos.
Quoted 26 lines · David Miller
From: Cong Wang <[email protected]>
Date: Tue, 6 Jan 2015 15:45:31 -0800Quoted 23 lines
Both
netinet/in.handlinux/ipv6.hdefine these two structs, if we include both of them, we got:
/usr/include/linux/ipv6.h:19:8: error: redefinition of ‘struct in6_pktinfo’
structin6_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
structin6_pktinfo
^
In file included from txtimestamp.c:40:0:
/usr/include/linux/ipv6.h:24:8: error: redefinition of ‘struct ip6_mtuinfo’
structip6_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
structip6_mtuinfo
^
So similarly to what we did forin6_addr, we need to sync with
libc header on their definitions.
Quoted 4 lines
Quoted 1 line
Signed-off-by Cong Wang <[email protected]>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.
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.