Skip to content

Commit 53dc65d

Browse files
mcfriskdavem330
authored andcommitted
include/uapi/linux/ipx.h: fix conflicting defitions with glibc netipx/ipx.h
Fixes these compiler warnings via libc-compat.h when glibc netipx/ipx.h is included before linux/ipx.h: ./linux/ipx.h:9:8: error: redefinition of ‘struct sockaddr_ipx’ ./linux/ipx.h:26:8: error: redefinition of ‘struct ipx_route_definition’ ./linux/ipx.h:32:8: error: redefinition of ‘struct ipx_interface_definition’ ./linux/ipx.h:49:8: error: redefinition of ‘struct ipx_config_data’ ./linux/ipx.h:58:8: error: redefinition of ‘struct ipx_route_def’ Signed-off-by: Mikko Rapeli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a1d1f65 commit 53dc65d

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

include/uapi/linux/ipx.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#ifndef _IPX_H_
22
#define _IPX_H_
3+
#include <linux/libc-compat.h> /* for compatibility with glibc netipx/ipx.h */
34
#include <linux/types.h>
45
#include <linux/sockios.h>
56
#include <linux/socket.h>
67
#define IPX_NODE_LEN 6
78
#define IPX_MTU 576
89

10+
#if __UAPI_DEF_SOCKADDR_IPX
911
struct sockaddr_ipx {
1012
__kernel_sa_family_t sipx_family;
1113
__be16 sipx_port;
@@ -14,6 +16,7 @@ struct sockaddr_ipx {
1416
__u8 sipx_type;
1517
unsigned char sipx_zero; /* 16 byte fill */
1618
};
19+
#endif /* __UAPI_DEF_SOCKADDR_IPX */
1720

1821
/*
1922
* So we can fit the extra info for SIOCSIFADDR into the address nicely
@@ -23,12 +26,15 @@ struct sockaddr_ipx {
2326
#define IPX_DLTITF 0
2427
#define IPX_CRTITF 1
2528

29+
#if __UAPI_DEF_IPX_ROUTE_DEFINITION
2630
struct ipx_route_definition {
2731
__be32 ipx_network;
2832
__be32 ipx_router_network;
2933
unsigned char ipx_router_node[IPX_NODE_LEN];
3034
};
35+
#endif /* __UAPI_DEF_IPX_ROUTE_DEFINITION */
3136

37+
#if __UAPI_DEF_IPX_INTERFACE_DEFINITION
3238
struct ipx_interface_definition {
3339
__be32 ipx_network;
3440
unsigned char ipx_device[16];
@@ -45,16 +51,20 @@ struct ipx_interface_definition {
4551
#define IPX_INTERNAL 2
4652
unsigned char ipx_node[IPX_NODE_LEN];
4753
};
48-
54+
#endif /* __UAPI_DEF_IPX_INTERFACE_DEFINITION */
55+
56+
#if __UAPI_DEF_IPX_CONFIG_DATA
4957
struct ipx_config_data {
5058
unsigned char ipxcfg_auto_select_primary;
5159
unsigned char ipxcfg_auto_create_interfaces;
5260
};
61+
#endif /* __UAPI_DEF_IPX_CONFIG_DATA */
5362

5463
/*
5564
* OLD Route Definition for backward compatibility.
5665
*/
5766

67+
#if __UAPI_DEF_IPX_ROUTE_DEF
5868
struct ipx_route_def {
5969
__be32 ipx_network;
6070
__be32 ipx_router_network;
@@ -67,6 +77,7 @@ struct ipx_route_def {
6777
#define IPX_RT_BLUEBOOK 2
6878
#define IPX_RT_ROUTED 1
6979
};
80+
#endif /* __UAPI_DEF_IPX_ROUTE_DEF */
7081

7182
#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
7283
#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1)

include/uapi/linux/libc-compat.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,25 @@
139139

140140
#endif /* _NETINET_IN_H */
141141

142+
/* Coordinate with glibc netipx/ipx.h header. */
143+
#if defined(__NETIPX_IPX_H)
144+
145+
#define __UAPI_DEF_SOCKADDR_IPX 0
146+
#define __UAPI_DEF_IPX_ROUTE_DEFINITION 0
147+
#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0
148+
#define __UAPI_DEF_IPX_CONFIG_DATA 0
149+
#define __UAPI_DEF_IPX_ROUTE_DEF 0
150+
151+
#else /* defined(__NETIPX_IPX_H) */
152+
153+
#define __UAPI_DEF_SOCKADDR_IPX 1
154+
#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1
155+
#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1
156+
#define __UAPI_DEF_IPX_CONFIG_DATA 1
157+
#define __UAPI_DEF_IPX_ROUTE_DEF 1
158+
159+
#endif /* defined(__NETIPX_IPX_H) */
160+
142161
/* Definitions for xattr.h */
143162
#if defined(_SYS_XATTR_H)
144163
#define __UAPI_DEF_XATTR 0
@@ -179,6 +198,13 @@
179198
#define __UAPI_DEF_IN6_PKTINFO 1
180199
#define __UAPI_DEF_IP6_MTUINFO 1
181200

201+
/* Definitions for ipx.h */
202+
#define __UAPI_DEF_SOCKADDR_IPX 1
203+
#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1
204+
#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1
205+
#define __UAPI_DEF_IPX_CONFIG_DATA 1
206+
#define __UAPI_DEF_IPX_ROUTE_DEF 1
207+
182208
/* Definitions for xattr.h */
183209
#define __UAPI_DEF_XATTR 1
184210

0 commit comments

Comments
 (0)