Skip to content

Commit

Permalink
uapi: fix linux/if_pppol2tp.h userspace compilation errors
Browse files Browse the repository at this point in the history
Because of <linux/libc-compat.h> interface limitations, <netinet/in.h>
provided by libc cannot be included after <linux/in.h>, therefore any
header that includes <netinet/in.h> cannot be included after <linux/in.h>.

Change uapi/linux/l2tp.h, the last uapi header that includes
<netinet/in.h>, to include <linux/in.h> and <linux/in6.h> instead of
<netinet/in.h> and use __SOCK_SIZE__ instead of sizeof(struct sockaddr)
the same way as uapi/linux/in.h does, to fix linux/if_pppol2tp.h userspace
compilation errors like this:

In file included from /usr/include/linux/l2tp.h:12:0,
                 from /usr/include/linux/if_pppol2tp.h:21,
/usr/include/netinet/in.h:31:8: error: redefinition of 'struct in_addr'

Fixes: 47c3e77 ("net: l2tp: deprecate PPPOL2TP_MSG_* in favour of L2TP_MSG_*")
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dmitry V. Levin authored and David S. Miller committed Feb 15, 2017
1 parent d199fab commit a725eb1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions include/uapi/linux/l2tp.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

#include <linux/types.h>
#include <linux/socket.h>
#ifndef __KERNEL__
#include <netinet/in.h>
#endif
#include <linux/in.h>
#include <linux/in6.h>

#define IPPROTO_L2TP 115

Expand All @@ -31,7 +30,7 @@ struct sockaddr_l2tpip {
__u32 l2tp_conn_id; /* Connection ID of tunnel */

/* Pad to size of `struct sockaddr'. */
unsigned char __pad[sizeof(struct sockaddr) -
unsigned char __pad[__SOCK_SIZE__ -
sizeof(__kernel_sa_family_t) -
sizeof(__be16) - sizeof(struct in_addr) -
sizeof(__u32)];
Expand Down

0 comments on commit a725eb1

Please sign in to comment.