Fix net header dependencies
Subsystems (7)
v2 cover Fix net header dependencies
Various networking headers depend on definitions from others which they don't include. We can't fix all of these, because some definitions are duplicated between kernel headers and glibc headers and we cannot tell which is the right one to include. We also have to be wary of introducing a dependency cycle.
Since v1, I've dropped the patches to <linux/scc.h> and <linux/if_ppp.h> and added the acknowledgements I got last time.
Ben.
Ben Hutchings (10):
headers, pppox: Add missing #include to <linux/if_pppox.h> headers, ax25: Add missing #include to <linux/netrom.h>,
<linux/rose.h>
headers, pppol2tp: Use __kernel_pid_t in <linux/pppol2tp.h> headers, net: Use __kernel_sa_family_t in more definitions shared
with userland
headers, net: Define struct __kernel_sockaddr, replacing struct
sockaddr
headers, netfilter: Use kernel type names __u8, __u16, __u32 headers, tipc: Add missing #include to <linux/tipc_config.h> for
userland
headers, netfilter: Add missing #include <limits.h> for userland headers, xtables: Add missing #include <linux/netfilter.h> headers, can: Add missing #include to <linux/can/bcm.h>
include/linux/atalk.h | 3 ++- include/linux/ax25.h | 2 +- include/linux/caif/caif_socket.h | 7 +------ include/linux/can.h | 2 +- include/linux/can/bcm.h | 1 + include/linux/if.h | 12 ++++++------ include/linux/if_pppol2tp.h | 2 +- include/linux/if_pppox.h | 9 +++++---- include/linux/in.h | 2 +- include/linux/ipx.h | 2 +- include/linux/irda.h | 9 +++------ include/linux/l2tp.h | 7 ++++--- include/linux/llc.h | 10 +++++++--- include/linux/netfilter/xt_connlimit.h | 1 + include/linux/netfilter/xt_conntrack.h | 1 + include/linux/netfilter/xt_iprange.h | 1 + include/linux/netfilter_arp/arp_tables.h | 14 +++++++------- include/linux/netfilter_decnet.h | 3 +++ include/linux/netfilter_ipv4.h | 3 +++ include/linux/netfilter_ipv4/ip_tables.h | 20 ++++++++++---------- include/linux/netfilter_ipv6.h | 3 +++ include/linux/netfilter_ipv6/ip6_tables.h | 22 +++++++++++----------- include/linux/netlink.h | 2 +- include/linux/netrom.h | 2 ++ include/linux/phonet.h | 6 ++++-- include/linux/rose.h | 7 +++++-- include/linux/socket.h | 17 +++++++++-------- include/linux/tipc_config.h | 4 ++++ include/linux/un.h | 4 +++- include/linux/x25.h | 3 ++- 30 files changed, 104 insertions(+), 77 deletions(-)
Signature · 1 line
1.7.5.4
PATCH v2 1/10 headers, pppox: Add missing #include to <linux/if_pppox.h>
<linux/if_ppox.h> uses ETH_ALEN, defined in <linux/if_ether.h>.
--- include/linux/if_pppox.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/if_pppox.h +1 -1
@@ -20,8 +20,8 @@#include <linux/types.h> #include <asm/byteorder.h> -#ifdef __KERNEL__#include <linux/if_ether.h> +#ifdef __KERNEL__#include <linux/if.h> #include <linux/netdevice.h> #include <linux/ppp_channel.h>
Signature · 1 line
1.7.5.4
PATCH v2 2/10 headers, ax25: Add missing #include to <linux/netrom.h>, <linux/rose.h>
In reply to Ben HutchingsThese headers use the ax25_address type defined in <linux/ax25.h>.
--- include/linux/netrom.h | 2 ++ include/linux/rose.h | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
include/linux/netrom.h +2 -0
@@ -7,6 +7,8 @@#ifndef NETROM_KERNEL_H #define NETROM_KERNEL_H +#include <linux/ax25.h> +#define NETROM_MTU 236#define NETROM_T1 1
include/linux/rose.h +2 -0
@@ -7,6 +7,8 @@#ifndef ROSE_KERNEL_H #define ROSE_KERNEL_H +#include <linux/ax25.h> +#define ROSE_MTU 251#define ROSE_MAX_DIGIS 6
Signature · 1 line
1.7.5.4
PATCH v2 3/10 headers, pppol2tp: Use __kernel_pid_t in <linux/pppol2tp.h>
In reply to Ben Hutchings<linux/types.h> defines __kernel_pid_t for userland; pid_t is defined elsewhere (and potentially differently).
--- include/linux/if_pppol2tp.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/if_pppol2tp.h +1 -1
@@ -39,7 +39,7 @@ struct pppol2tp_addr {* bits. So we need a different sockaddr structure. */ struct pppol2tpv3_addr { -pid_t pid;/* pid that owns the fd. +__kernel_pid_t pid;/* pid that owns the fd. * 0 => current */ int fd;/* FD of UDP or IP socket to use */
Signature · 1 line
1.7.5.4
PATCH v2 4/10 headers, net: Use __kernel_sa_family_t in more definitions shared with userland
In reply to Ben HutchingsComplete the work started with commit 6602a4baf4d1a73cc4685a39ef859e1c5ddf654c ('net: Make userland include of netlink.h more sane').
--- include/linux/atalk.h | 3 ++- include/linux/ax25.h | 2 +- include/linux/caif/caif_socket.h | 7 +------ include/linux/can.h | 2 +- include/linux/if_pppox.h | 7 ++++--- include/linux/in.h | 2 +- include/linux/ipx.h | 2 +- include/linux/irda.h | 9 +++------ include/linux/l2tp.h | 7 ++++--- include/linux/llc.h | 10 +++++++--- include/linux/netlink.h | 2 +- include/linux/phonet.h | 5 +++-- include/linux/rose.h | 5 +++-- include/linux/un.h | 4 +++- include/linux/x25.h | 3 ++- 15 files changed, 37 insertions(+), 33 deletions(-)
include/linux/atalk.h +2 -1
@@ -3,6 +3,7 @@#include <linux/types.h> #include <asm/byteorder.h> +#include <linux/socket.h> /* * AppleTalk networking structures
@@ -28,7 +29,7 @@ struct atalk_addr { };struct sockaddr_at { -sa_family_t sat_family; +__kernel_sa_family_t sat_family;__u8 sat_port;struct atalk_addr sat_addr;char sat_zero[8 ];
include/linux/ax25.h +1 -1
@@ -47,7 +47,7 @@ typedef struct { } ax25_address;struct sockaddr_ax25 { -sa_family_t sax25_family; +__kernel_sa_family_t sax25_family;ax25_address sax25_call;int sax25_ndigis;/* Digipeater ax25_address sets follow */
include/linux/caif/caif_socket.h +1 -6
@@ -9,12 +9,7 @@#define _LINUX_CAIF_SOCKET_H#include <linux/types.h> - -#ifdef __KERNEL__#include <linux/socket.h> -#else -#include <sys/socket.h> -#endif /** * enum caif_link_selector - Physical Link Selection.
@@ -144,7 +139,7 @@ enum caif_debug_service {* CAIF Channel. It defines the service to connect to on the modem. */ struct sockaddr_caif { - sa_family_t family; + __kernel_sa_family_t family; union { struct { __u8 type; /* type: enum caif_at_type */
include/linux/can.h +1 -1
@@ -78,7 +78,7 @@ struct can_frame {* @can_addr: protocol specific address information */ struct sockaddr_can { -sa_family_t can_family; +__kernel_sa_family_t can_family;int can_ifindex;union {/* transport protocol class address information (e.g. ISOTP) */
include/linux/if_pppox.h +4 -3
@@ -20,6 +20,7 @@#include <linux/types.h> #include <asm/byteorder.h> +#include <linux/socket.h> #include <linux/if_ether.h> #ifdef __KERNEL__#include <linux/if.h>
@@ -63,7 +64,7 @@ struct pptp_addr {#define PX_MAX_PROTO 3struct sockaddr_pppox { -sa_family_t sa_family;/* address family, AF_PPPOX */ +__kernel_sa_family_t sa_family;/* address family, AF_PPPOX */ unsigned int sa_protocol;/* protocol identifier */ union {struct pppoe_addr pppoe;
@@ -77,7 +78,7 @@ struct sockaddr_pppox {* type instead. */ struct sockaddr_pppol2tp { -sa_family_t sa_family;/* address family, AF_PPPOX */ +__kernel_sa_family_t sa_family;/* address family, AF_PPPOX */ unsigned int sa_protocol;/* protocol identifier */ struct pppol2tp_addr pppol2tp; } __attribute__((packed));
@@ -86,7 +87,7 @@ struct sockaddr_pppol2tp {* bits. So we need a different sockaddr structure. */ struct sockaddr_pppol2tpv3 { -sa_family_t sa_family;/* address family, AF_PPPOX */ +__kernel_sa_family_t sa_family;/* address family, AF_PPPOX */ unsigned int sa_protocol;/* protocol identifier */ struct pppol2tpv3_addr pppol2tp; } __attribute__((packed));
include/linux/in.h +1 -1
@@ -182,7 +182,7 @@ struct in_pktinfo {/* Structure describing an Internet (IP) socket address. */ #define __SOCK_SIZE__ 16/* sizeof(struct sockaddr) */ struct sockaddr_in { -sa_family_t sin_family;/* Address family */ +__kernel_sa_family_t sin_family;/* Address family */ __be16 sin_port;/* Port number */ struct in_addr sin_addr;/* Internet address */
include/linux/ipx.h +1 -1
@@ -7,7 +7,7 @@#define IPX_MTU 576struct sockaddr_ipx { -sa_family_t sipx_family; +__kernel_sa_family_t sipx_family;__be16 sipx_port;__be32 sipx_network;unsigned char sipx_node[IPX_NODE_LEN ];
include/linux/irda.h +3 -6
@@ -26,12 +26,9 @@#define KERNEL_IRDA_H #include <linux/types.h> +#include <linux/socket.h> -/* Please do *not* add any #include in this file, this file is -* included as-is in user space. -* Please fix the calling file to properly included needed files before -* this one, or preferably to include <net/irda/irda.h> instead. -* Jean II */ +/* Note that this file is shared with user space. */ /* Hint bit positions for first hint byte */ #define HINT_PNP 0x01
@@ -125,7 +122,7 @@ enum {#define LSAP_ANY 0xffstruct sockaddr_irda { -sa_family_t sir_family;/* AF_IRDA */ +__kernel_sa_family_t sir_family;/* AF_IRDA */ __u8 sir_lsap_sel;/* LSAP selector */ __u32 sir_addr;/* Device address */ char sir_name[25 ];/* Usually <service>:IrDA:TinyTP */
include/linux/l2tp.h +4 -3
@@ -8,8 +8,8 @@#define _LINUX_L2TP_H_#include <linux/types.h> -#ifdef __KERNEL__#include <linux/socket.h> +#ifdef __KERNEL__#include <linux/in.h> #else #include <netinet/in.h>
@@ -26,14 +26,15 @@#define __SOCK_SIZE__ 16/* sizeof(struct sockaddr) */ struct sockaddr_l2tpip {/* The first fields must match struct sockaddr_in */ -sa_family_t l2tp_family;/* AF_INET */ +__kernel_sa_family_t l2tp_family;/* AF_INET */ __be16 l2tp_unused;/* INET port number (unused) */ struct in_addr l2tp_addr;/* Internet address */ __u32 l2tp_conn_id;/* Connection ID of tunnel */ /* Pad to size of `struct sockaddr'. */ -unsigned char __pad[sizeof (struct sockaddr ) -sizeof (sa_family_t) - +unsigned char __pad[sizeof (struct sockaddr ) - +sizeof (__kernel_sa_family_t) -sizeof (__be16) -sizeof (struct in_addr ) -sizeof (__u32)]; };
include/linux/llc.h +7 -3
@@ -12,16 +12,20 @@* * See the GNU General Public License for more details. */ + +#include <linux/socket.h> +#define __LLC_SOCK_SIZE__ 16/* sizeof(sockaddr_llc), word align. */ struct sockaddr_llc { -sa_family_t sllc_family;/* AF_LLC */ -sa_family_t sllc_arphrd;/* ARPHRD_ETHER */ +__kernel_sa_family_t sllc_family;/* AF_LLC */ +__kernel_sa_family_t sllc_arphrd;/* ARPHRD_ETHER */ unsigned char sllc_test;unsigned char sllc_xid;unsigned char sllc_ua;/* UA data, only for SOCK_STREAM. */ unsigned char sllc_sap;unsigned char sllc_mac[IFHWADDRLEN ]; -unsigned char __pad[__LLC_SOCK_SIZE__ -sizeof (sa_family_t) *2 - +unsigned char __pad[__LLC_SOCK_SIZE__ - +sizeof (__kernel_sa_family_t) *2 -sizeof (unsigned char ) *4 -IFHWADDRLEN ]; };
include/linux/netlink.h +1 -1
@@ -1,7 +1,7 @@#ifndef __LINUX_NETLINK_H#define __LINUX_NETLINK_H -#include <linux/socket.h> /* for sa_family_t */ +#include <linux/socket.h> /* for __kernel_sa_family_t */ #include <linux/types.h> #define NETLINK_ROUTE 0/* Routing/device hook */
include/linux/phonet.h +3 -2
@@ -24,6 +24,7 @@#define LINUX_PHONET_H #include <linux/types.h> +#include <linux/socket.h> /* Automatic protocol selection */ #define PN_PROTO_TRANSPORT 0
@@ -96,11 +97,11 @@ struct phonetmsg {/* Phonet socket address structure */ struct sockaddr_pn { -sa_family_t spn_family; +__kernel_sa_family_t spn_family;__u8 spn_obj;__u8 spn_dev;__u8 spn_resource; -__u8 spn_zero[sizeof (struct sockaddr ) -sizeof (sa_family_t) -3 ]; +__u8 spn_zero[sizeof (struct sockaddr ) -sizeof (__kernel_sa_family_t) -3 ]; } __attribute__((packed));/* Well known address */
include/linux/rose.h +3 -2
@@ -7,6 +7,7 @@#ifndef ROSE_KERNEL_H #define ROSE_KERNEL_H +#include <linux/socket.h> #include <linux/ax25.h> #define ROSE_MTU 251
@@ -46,7 +47,7 @@ typedef struct { } rose_address;struct sockaddr_rose { -sa_family_t srose_family; +__kernel_sa_family_t srose_family;rose_address srose_addr;ax25_address srose_call;int srose_ndigis;
@@ -54,7 +55,7 @@ struct sockaddr_rose { };struct full_sockaddr_rose { -sa_family_t srose_family; +__kernel_sa_family_t srose_family;rose_address srose_addr;ax25_address srose_call;unsigned int srose_ndigis;
include/linux/un.h +3 -1
@@ -1,10 +1,12 @@#ifndef _LINUX_UN_H#define _LINUX_UN_H +#include <linux/socket.h> +#define UNIX_PATH_MAX 108struct sockaddr_un { -sa_family_t sun_family;/* AF_UNIX */ +__kernel_sa_family_t sun_family;/* AF_UNIX */ char sun_path[UNIX_PATH_MAX ];/* pathname */ };
include/linux/x25.h +2 -1
@@ -12,6 +12,7 @@#define X25_KERNEL_H #include <linux/types.h> +#include <linux/socket.h> #define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0)#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1)
@@ -57,7 +58,7 @@ struct x25_address {* Linux X.25 Address structure, used for bind, and connect mostly. */ struct sockaddr_x25 { -sa_family_t sx25_family;/* Must be AF_X25 */ +__kernel_sa_family_t sx25_family;/* Must be AF_X25 */ struct x25_address sx25_addr;/* X.121 Address */ };
Signature · 1 line
1.7.5.4
PATCH v2 5/10 headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr
In reply to Ben HutchingsCommit 9c501935a3cdcf6b1d35aaee3aa11c7a7051a305 ('net: Support inclusion of <linux/socket.h> before <sys/socket.h>') removed the definition of struct sockaddr for userland.
But we still have several headers using struct sockaddr, and we shouldn't make them include <sys/socket.h> as that risks recursive inclusion in future. Define and use an identical struct __kernel_sockaddr instead.
--- include/linux/if.h | 12 ++++++------ include/linux/phonet.h | 3 ++- include/linux/socket.h | 17 +++++++++-------- 3 files changed, 17 insertions(+), 15 deletions(-)
include/linux/if.h +6 -6
@@ -20,7 +20,7 @@#define _LINUX_IF_H#include <linux/types.h> /* for "__kernel_caddr_t" et al */ -#include <linux/socket.h> /* for "struct sockaddr" et al */ +#include <linux/socket.h> /* for "struct __kernel_sockaddr" et al */ #include <linux/compiler.h> /* for "__user" et al */ #define IFNAMSIZ 16
@@ -176,11 +176,11 @@ struct ifreq { } ifr_ifrn;union { -struct sockaddr ifru_addr; -struct sockaddr ifru_dstaddr; -struct sockaddr ifru_broadaddr; -struct sockaddr ifru_netmask; -struct sockaddr ifru_hwaddr; +struct __kernel_sockaddr ifru_addr; +struct __kernel_sockaddr ifru_dstaddr; +struct __kernel_sockaddr ifru_broadaddr; +struct __kernel_sockaddr ifru_netmask; +struct __kernel_sockaddr ifru_hwaddr;short ifru_flags;int ifru_ivalue;int ifru_mtu;
include/linux/phonet.h +2 -1
@@ -101,7 +101,8 @@ struct sockaddr_pn {__u8 spn_obj;__u8 spn_dev;__u8 spn_resource; -__u8 spn_zero[sizeof (struct sockaddr ) -sizeof (__kernel_sa_family_t) -3 ]; +__u8 spn_zero[sizeof (struct __kernel_sockaddr ) - +sizeof (__kernel_sa_family_t) -3 ]; } __attribute__((packed));/* Well known address */
include/linux/socket.h +9 -8
@@ -10,6 +10,14 @@typedef unsigned short __kernel_sa_family_t ; +/* +* 1003.1g requires sa_family_t and that sa_data is char. +*/ +struct __kernel_sockaddr { +__kernel_sa_family_t sa_family;/* address family, AF_xxx */ +char sa_data[14 ];/* 14 bytes of protocol address */ +}; +struct __kernel_sockaddr_storage {__kernel_sa_family_t ss_family;/* address family */ /* Following field(s) are implementation specific */
@@ -39,15 +47,8 @@ extern void socket_seq_show(struct seq_file *seq);typedef __kernel_sa_family_t sa_family_t ; -/* -* 1003.1g requires sa_family_t and that sa_data is char. -*/ +#define sockaddr __kernel_sockaddr -struct sockaddr { -sa_family_t sa_family;/* address family, AF_xxx */ -char sa_data[14 ];/* 14 bytes of protocol address */ -}; -struct linger {int l_onoff;/* Linger active */ int l_linger;/* How long to linger for */
Signature · 1 line
1.7.5.4
David Miller
maintainerRe: [PATCH net-next v2 05/10] headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr
From: Ben Hutchings <[email protected]>
Date: Thu, 25 Aug 2011 05:44:15 +0100
Quoted 10 lines
Commit
9c501935a3cdcf6b1d35aaee3aa11c7a7051a305('net: Support inclusion of <linux/socket.h> before <sys/socket.h>') removed the definition of struct sockaddr for userland.But we still have several headers using struct sockaddr, and we shouldn't make them include <
sys/socket.h> as that risks recursive inclusion in future. Define and use an identical struct__kernel_sockaddrinstead.Signed-off-by Ben Hutchings <[email protected]>
...
include/linux/socket.h extern void socket_seq_show(struct seq_file *seq); · line 50
Quoted 5 lines
include/linux/socket.h +1
-3-/* -* 1003.1g requires sa_family_t and that sa_data is char. -*/ +#define sockaddr __kernel_sockaddr
This cure is worse than the disease.
Now any application that includes sys/socket.h one way or another is now going to get a real hard build failure since __kernel_sockaddr will effectively get redefined.
There is no reason sys/socket.h and our headers cannot co-exist and this is the whole reason we're going through all of this pain to use the __kernel_foo types in our networking datastructures which are exposed to userspace.
Re: [PATCH net-next v2 05/10] headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr
Quoted 22 lines · David Miller
From: Ben Hutchings <[email protected]>
Date: Thu, 25 Aug 2011 05:44:15 +0100Quoted 10 lines
Commit
9c501935a3cdcf6b1d35aaee3aa11c7a7051a305('net: Support inclusion of <linux/socket.h> before <sys/socket.h>') removed the definition of struct sockaddr for userland.But we still have several headers using struct sockaddr, and we shouldn't make them include <
sys/socket.h> as that risks recursive inclusion in future. Define and use an identical struct__kernel_sockaddrinstead.Signed-off-by Ben Hutchings <[email protected]>...
include/linux/socket.h extern void socket_seq_show(struct seq_file *seq); · line 50
Quoted 5 lines
include/linux/socket.h +1
-3-/* -* 1003.1g requires sa_family_t and that sa_data is char. -*/ +#define sockaddr __kernel_sockaddrThis cure is worse than the disease.
Quoted 3 lines
Now any application that includes
sys/socket.hone way or another is now going to get a real hard build failure since__kernel_sockaddrwill effectively get redefined.
[...]
This #define is in the #ifdef __KERNEL__ section. I don't want t change all the in-kernel users to say __kernel_sockaddr. This is just the same as the preceding 'typedef __kernel_sa_family_t sa_family_t' except that you can't create struct aliases that way.
Ben.
Signature · 3 lines
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert CamusDavid Miller
maintainerRe: [PATCH net-next v2 05/10] headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr
From: Ben Hutchings <[email protected]>
Date: Fri, 26 Aug 2011 16:42:48 +0100
Quoted 4 lines
This #define is in the #ifdef
__KERNEL__section. I don't want t change all the in-kernel users to say__kernel_sockaddr. This is just the same as the preceding 'typedef__kernel_sa_family_tsa_family_t' except that you can't create struct aliases that way.
Aha, I didn't catch that part. Then this is fine, thanks for explaining Ben.
David Miller
maintainerRe: [PATCH net-next v2 05/10] headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr
From: David Miller <[email protected]>
Date: Fri, 26 Aug 2011 12:04:51 -0400 (EDT)
Quoted 10 lines
From: Ben Hutchings <[email protected]>
Date: Fri, 26 Aug 2011 16:42:48 +0100Quoted 4 lines
This #define is in the #ifdef
__KERNEL__section. I don't want t change all the in-kernel users to say__kernel_sockaddr. This is just the same as the preceding 'typedef__kernel_sa_family_tsa_family_t' except that you can't create struct aliases that way.Aha, I didn't catch that part. Then this is fine, thanks for explaining Ben.
Actually, this patch breaks the build, specifically of ifenslave.c
I'll leave the other patches in, but you'll need to respin this one.
Documentation/networking/ifenslave.c: In function ‘if_getconfig’:Documentation/networking/ifenslave.c:553:11: error: incompatible types when assigning to type ‘struct sockaddr’ from type ‘struct __kernel_sockaddr’ Documentation/networking/ifenslave.c:559:13: error: incompatible types when assigning to type ‘struct sockaddr’ from type ‘struct __kernel_sockaddr’ Documentation/networking/ifenslave.c:565:11: error: incompatible types when assigning to type ‘struct sockaddr’ from type ‘struct __kernel_sockaddr’ Documentation/networking/ifenslave.c: In function ‘enslave’:Documentation/networking/ifenslave.c:727:13: warning: passing argument 2 of ‘set_slave_hwaddr’ from incompatible pointer type Documentation/networking/ifenslave.c:230:12: note: expected ‘struct sockaddr *’ but argument is of type ‘struct __kernel_sockaddr *’ Documentation/networking/ifenslave.c:772:6: warning: passing argument 2 of ‘set_master_hwaddr’ from incompatible pointer type Documentation/networking/ifenslave.c:229:12: note: expected ‘struct sockaddr *’ but argument is of type ‘struct __kernel_sockaddr *’ Documentation/networking/ifenslave.c:817:2: warning: passing argument 2 of ‘set_master_hwaddr’ from incompatible pointer type Documentation/networking/ifenslave.c:229:12: note: expected ‘struct sockaddr *’ but argument is of type ‘struct __kernel_sockaddr *’ Documentation/networking/ifenslave.c:821:2: warning: passing argument 2 of ‘set_slave_hwaddr’ from incompatible pointer type Documentation/networking/ifenslave.c:230:12: note: expected ‘struct sockaddr *’ but argument is of type ‘struct __kernel_sockaddr *’ make[2]: *** [Documentation/networking/ifenslave] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Documentation/networking] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [vmlinux] Error 2
Re: [PATCH net-next v2 05/10] headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr
Quoted 11 lines · David Miller
From: David Miller <[email protected]>
Date: Fri, 26 Aug 2011 12:04:51 -0400 (EDT)Quoted 8 lines
From: Ben Hutchings <[email protected]>
Date: Fri, 26 Aug 2011 16:42:48 +0100Quoted 4 lines
This #define is in the #ifdef
__KERNEL__section. I don't want t change all the in-kernel users to say__kernel_sockaddr. This is just the same as the preceding 'typedef__kernel_sa_family_tsa_family_t' except that you can't create struct aliases that way.
Quoted 6 lines
Quoted 2 lines
Aha, I didn't catch that part. Then this is fine, thanks for explaining Ben.
Actually, this patch breaks the build, specifically of
ifenslave.cI'll leave the other patches in, but you'll need to respin this one.
[...]
Right, it looks like this will have to wait for a proper resolution of the conflicts between kernel and libc types.
Ben.
PATCH v2 6/10 headers, netfilter: Use kernel type names __u8, __u16, __u32
In reply to Ben HutchingsThese types are guaranteed to be defined by <linux/types.h> for both userland and kernel, unlike u_intN_t.
--- include/linux/netfilter_arp/arp_tables.h | 14 +++++++------- include/linux/netfilter_ipv4/ip_tables.h | 20 ++++++++++---------- include/linux/netfilter_ipv6/ip6_tables.h | 22 +++++++++++----------- 3 files changed, 28 insertions(+), 28 deletions(-)
include/linux/netfilter_arp/arp_tables.h +7 -7
@@ -52,7 +52,7 @@ struct arpt_arp {struct in_addr smsk, tmsk;/* Device hw address length, src+target device addresses */ -u_int8_t arhln, arhln_mask; +__u8 arhln, arhln_mask;struct arpt_devaddr_info src_devaddr;struct arpt_devaddr_info tgt_devaddr;
@@ -71,9 +71,9 @@ struct arpt_arp {unsigned char iniface_mask[IFNAMSIZ ], outiface_mask[IFNAMSIZ ];/* Flags word */ -u_int8_t flags; +__u8 flags;/* Inverse flags */ -u_int16_t invflags; +__u16 invflags; };/* Values for "flag" field in struct arpt_ip (general arp structure).
@@ -102,9 +102,9 @@ struct arpt_entrystruct arpt_arp arp;/* Size of arpt_entry + matches */ -u_int16_t target_offset; +__u16 target_offset;/* Size of arpt_entry + matches + target */ -u_int16_t next_offset; +__u16 next_offset;/* Back pointer */ unsigned int comefrom;
@@ -260,8 +260,8 @@ extern unsigned int arpt_do_table(struct sk_buff *skb,struct compat_arpt_entry {struct arpt_arp arp; -u_int16_t target_offset; -u_int16_t next_offset; +__u16 target_offset; +__u16 next_offset;compat_uint_t comefrom;struct compat_xt_counters counters;unsigned char elems[0 ];
include/linux/netfilter_ipv4/ip_tables.h +10 -10
@@ -81,12 +81,12 @@ struct ipt_ip {unsigned char iniface_mask[IFNAMSIZ ], outiface_mask[IFNAMSIZ ];/* Protocol, 0 = ANY */ -u_int16_t proto; +__u16 proto;/* Flags word */ -u_int8_t flags; +__u8 flags;/* Inverse flags */ -u_int8_t invflags; +__u8 invflags; };/* Values for "flag" field in struct ipt_ip (general ip structure). */
@@ -114,9 +114,9 @@ struct ipt_entry {unsigned int nfcache;/* Size of ipt_entry + matches */ -u_int16_t target_offset; +__u16 target_offset;/* Size of ipt_entry + matches + target */ -u_int16_t next_offset; +__u16 next_offset;/* Back pointer */ unsigned int comefrom;
@@ -149,9 +149,9 @@ struct ipt_entry {/* ICMP matching stuff */ struct ipt_icmp { -u_int8_t type;/* type to match */ -u_int8_t code[2 ];/* range of code */ -u_int8_t invflags;/* Inverse flags */ +__u8 type;/* type to match */ +__u8 code[2 ];/* range of code */ +__u8 invflags;/* Inverse flags */ };/* Values for "inv" field for struct ipt_icmp. */
@@ -288,8 +288,8 @@ extern unsigned int ipt_do_table(struct sk_buff *skb,struct compat_ipt_entry {struct ipt_ip ip;compat_uint_t nfcache; -u_int16_t target_offset; -u_int16_t next_offset; +__u16 target_offset; +__u16 next_offset;compat_uint_t comefrom;struct compat_xt_counters counters;unsigned char elems[0 ];
include/linux/netfilter_ipv6/ip6_tables.h +11 -11
@@ -81,14 +81,14 @@ struct ip6t_ip6 {* MH do not match any packets. * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol. */ -u_int16_t proto; +__u16 proto;/* TOS to match iff flags & IP6T_F_TOS */ -u_int8_t tos; +__u8 tos;/* Flags word */ -u_int8_t flags; +__u8 flags;/* Inverse flags */ -u_int8_t invflags; +__u8 invflags; };/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
@@ -118,9 +118,9 @@ struct ip6t_entry {unsigned int nfcache;/* Size of ipt_entry + matches */ -u_int16_t target_offset; +__u16 target_offset;/* Size of ipt_entry + matches + target */ -u_int16_t next_offset; +__u16 next_offset;/* Back pointer */ unsigned int comefrom;
@@ -186,9 +186,9 @@ struct ip6t_error {/* ICMP matching stuff */ struct ip6t_icmp { -u_int8_t type;/* type to match */ -u_int8_t code[2 ];/* range of code */ -u_int8_t invflags;/* Inverse flags */ +__u8 type;/* type to match */ +__u8 code[2 ];/* range of code */ +__u8 invflags;/* Inverse flags */ };/* Values for "inv" field for struct ipt_icmp. */
@@ -298,8 +298,8 @@ extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,struct compat_ip6t_entry {struct ip6t_ip6 ipv6;compat_uint_t nfcache; -u_int16_t target_offset; -u_int16_t next_offset; +__u16 target_offset; +__u16 next_offset;compat_uint_t comefrom;struct compat_xt_counters counters;unsigned char elems[0 ];
Signature · 1 line
1.7.5.4
PATCH v2 7/10 headers, tipc: Add missing #include to <linux/tipc_config.h> for userland
In reply to Ben Hutchings<linux/tipc_config.h> defines inline functions using ntohs() etc. For userland these are defined in <arpa/inet.h>.
--- include/linux/tipc_config.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/linux/tipc_config.h +4 -0
@@ -41,6 +41,10 @@#include <linux/string.h> #include <asm/byteorder.h> +#ifndef __KERNEL__ +#include <arpa/inet.h> /* for ntohs etc. */ +#endif +/* * Configuration *
Signature · 1 line
1.7.5.4
PATCH v2 8/10 headers, netfilter: Add missing #include <limits.h> for userland
In reply to Ben HutchingsVarious headers use INT_MIN and INT_MAX, which are defined for userland in <limits.h>.
--- include/linux/netfilter_decnet.h | 3 +++ include/linux/netfilter_ipv4.h | 3 +++ include/linux/netfilter_ipv6.h | 3 +++ 3 files changed, 9 insertions(+), 0 deletions(-)
include/linux/netfilter_decnet.h +3 -0
@@ -11,6 +11,9 @@/* only for userspace compatibility */ #ifndef __KERNEL__ + +#include <limits.h> /* for INT_MIN, INT_MAX */ +/* IP Cache bits. */ /* Src IP address. */ #define NFC_DN_SRC 0x0001
include/linux/netfilter_ipv4.h +3 -0
@@ -9,6 +9,9 @@/* only for userspace compatibility */ #ifndef __KERNEL__ + +#include <limits.h> /* for INT_MIN, INT_MAX */ +/* IP Cache bits. */ /* Src IP address. */ #define NFC_IP_SRC 0x0001
include/linux/netfilter_ipv6.h +3 -0
@@ -12,6 +12,9 @@/* only for userspace compatibility */ #ifndef __KERNEL__ + +#include <limits.h> /* for INT_MIN, INT_MAX */ +/* IP Cache bits. */ /* Src IP address. */ #define NFC_IP6_SRC 0x0001
Signature · 1 line
1.7.5.4
PATCH v2 9/10 headers, xtables: Add missing #include <linux/netfilter.h>
In reply to Ben HutchingsVarious headers use union nf_inet_addr, defined in <linux/netfilter.h>.
--- include/linux/netfilter/xt_connlimit.h | 1 + include/linux/netfilter/xt_conntrack.h | 1 + include/linux/netfilter/xt_iprange.h | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
include/linux/netfilter/xt_connlimit.h +1 -0
@@ -2,6 +2,7 @@#define _XT_CONNLIMIT_H#include <linux/types.h> +#include <linux/netfilter.h> struct xt_connlimit_data ;
include/linux/netfilter/xt_conntrack.h +1 -0
@@ -6,6 +6,7 @@#define _XT_CONNTRACK_H#include <linux/types.h> +#include <linux/netfilter.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> #define XT_CONNTRACK_STATE_BIT (ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
include/linux/netfilter/xt_iprange.h +1 -0
@@ -2,6 +2,7 @@#define _LINUX_NETFILTER_XT_IPRANGE_H 1#include <linux/types.h> +#include <linux/netfilter.h> enum {IPRANGE_SRC =1 <<0 ,/* match source IP address */
Signature · 1 line
1.7.5.4
PATCH v2 10/10 headers, can: Add missing #include to <linux/can/bcm.h>
In reply to Ben Hutchings<linux/can/bcm.h> uses type canid_t, defined in <linux/can.h>.
--- include/linux/can/bcm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/can/bcm.h +1 -0
@@ -15,6 +15,7 @@#define CAN_BCM_H #include <linux/types.h> +#include <linux/can.h> /** * struct bcm_msg_head - head of messages to/from the broadcast manager
Signature · 1 line
1.7.5.4
David Miller
maintainerFrom: Ben Hutchings <[email protected]>
Date: Thu, 25 Aug 2011 05:38:44 +0100
Quoted 8 lines
Various networking headers depend on definitions from others which they don't include. We can't fix all of these, because some definitions are duplicated between kernel headers and glibc headers and we cannot tell which is the right one to include. We also have to be wary of introducing a dependency cycle.
Since v1, I've dropped the patches to <
linux/scc.h> and <linux/if_ppp.h> and added the acknowledgements I got last time.
All applied, thanks!