[ovs-git] [openvswitch/ovs] c66374: sparse: Fix conflict between netinet/in.h and linu...
noreply at github.com
Wed Jun 8 20:44:58 UTC 2016
Author: Daniele Di Proietto <diproiettod at vmware.com>
Date: 2016-06-08 (Wed, 08 Jun 2016)
sparse: Fix conflict between netinet/in.h and linux/in.h
linux/in.h (from linux uapi headers) carries many of the same
definitions as netinet/in.h (from glibc).
If linux/in.h is included after netinet/in.h, conflicts are avoided in
1) linux/libc-compat.h (included by linux/in.h) detects the include
guard of netinet/in.h and defines some macros (e.g.
__UAPI_DEF_IN_IPPROTO) to 0. linux/in.h avoids exporting the same
enums if those macros are 0.
2) The two files are allowed to redefine the same macros as long as the
values are the same.
Our include/sparse/netinet/in.h creates problems, because:
1) It uses a custom include guard
2) It uses dummy values for some macros.
This commit changes include/sparse/netinet/in.h to use the same include
guard as glibc netinet/in.h, and to use the same values for some macros.
I think this problem is present with linux headers after
a263653ed798("netfilter: don't pull include/linux/netfilter.h from netns
headers") which cause our lib/netlink-conntrack.c to include linux/in.h
sample output from sparse:
/usr/include/linux/in.h:29:9: warning: preprocessor token IPPROTO_IP
../include/sparse/netinet/in.h:60:9: this was the original definition
/usr/include/linux/in.h:31:9: warning: preprocessor token IPPROTO_ICMP
../include/sparse/netinet/in.h:63:9: this was the original definition
/usr/include/linux/in.h:28:3: error: bad enum definition
/usr/include/linux/in.h:28:3: error: Expected } at end of specifier
/usr/include/linux/in.h:28:3: error: got 0
/usr/include/linux/in.h:84:16: error: redefinition of struct in_addr
Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
Tested-by: Joe Stringer <joe at ovn.org>
Acked-by: Ben Pfaff <blp at ovn.org>
More information about the git