mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 01:51:26 +00:00
sparse: Add guards to prevent FreeBSD-incompatible #include order.
FreeBSD insists that <sys/types.h> be included before <netinet/in.h> and that <netinet/in.h> be included before <arpa/inet.h>. This adds guards to the "sparse" headers to yield a warning if this order is violated. This commit also adjusts the order of many #includes to suit this requirement. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
This commit is contained in:
parent
9041097aee
commit
b2befd5bb2
@ -105,6 +105,7 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_flagshigh], [], [], [[#include <net/if.h>]])
|
||||
AC_CHECK_MEMBERS([struct mmsghdr.msg_len], [], [], [[#include <sys/socket.h>]])
|
||||
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], [], [],
|
||||
[[#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>]])
|
||||
AC_CHECK_FUNCS([mlockall strnlen getloadavg statvfs getmntent_r sendmmsg clock_gettime])
|
||||
AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h linux/if_ether.h stdatomic.h])
|
||||
|
@ -17,6 +17,7 @@
|
||||
#ifndef OPENVSWITCH_PACKETS_H
|
||||
#define OPENVSWITCH_PACKETS_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include "openvswitch/tun-metadata.h"
|
||||
|
||||
|
@ -18,4 +18,8 @@
|
||||
#error "Use this header only with sparse. It is not a correct implementation."
|
||||
#endif
|
||||
|
||||
#ifndef NETINET_IN_H_INCLUDED
|
||||
#error "Must include <netinet/in.h> before <arpa/inet.h> for FreeBSD support"
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
@ -13,4 +13,5 @@ noinst_HEADERS += \
|
||||
include/sparse/rte_memcpy.h \
|
||||
include/sparse/rte_vect.h \
|
||||
include/sparse/sys/socket.h \
|
||||
include/sparse/sys/types.h \
|
||||
include/sparse/sys/wait.h
|
||||
|
@ -18,6 +18,12 @@
|
||||
#error "Use this header only with sparse. It is not a correct implementation."
|
||||
#endif
|
||||
|
||||
#define NETINET_IN_H_INCLUDED 1
|
||||
|
||||
#ifndef SYS_TYPES_H_INCLUDED
|
||||
#error "Must include <sys/types.h> before <netinet/in.h> for FreeBSD support"
|
||||
#endif
|
||||
|
||||
#ifndef _NETINET_IN_H
|
||||
#define _NETINET_IN_H 1
|
||||
|
||||
|
22
include/sparse/sys/types.h
Normal file
22
include/sparse/sys/types.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2013, 2014, 2015, 2017 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __CHECKER__
|
||||
#error "Use this header only with sparse. It is not a correct implementation."
|
||||
#endif
|
||||
|
||||
#define SYS_TYPES_H_INCLUDED 1
|
||||
#include_next <sys/types.h>
|
@ -16,6 +16,7 @@
|
||||
#include "bfd.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "bundle.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
#ifndef BUNDLE_H
|
||||
#define BUNDLE_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
@ -16,8 +16,9 @@
|
||||
#ifndef BYTE_ORDER_H
|
||||
#define BYTE_ORDER_H 1
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
#include "openvswitch/types.h"
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "classifier.h"
|
||||
#include "classifier-private.h"
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include "byte-order.h"
|
||||
#include "openvswitch/dynamic-string.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <config.h>
|
||||
#include "csum.h"
|
||||
#include "unaligned.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifndef __CHECKER__
|
||||
|
@ -15,12 +15,13 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
@ -20,11 +20,9 @@
|
||||
#define _LLDPD_STRUCTS_H
|
||||
|
||||
#include <net/if.h>
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include "aa-structs.h"
|
||||
#include "lldp-const.h"
|
||||
#include "packets.h"
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "lldpd.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -28,7 +30,6 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#ifndef _WIN32
|
||||
|
@ -19,13 +19,11 @@
|
||||
#ifndef _LLDPD_H
|
||||
#define _LLDPD_H
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include "dp-packet.h"
|
||||
#include "openvswitch/list.h"
|
||||
#include "lldpd-structs.h"
|
||||
|
@ -17,10 +17,10 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "multipath.h"
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
#include "colors.h"
|
||||
#include "nx-match.h"
|
||||
#include "openflow/nicira-ext.h"
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
#include <linux/filter.h>
|
||||
@ -31,7 +33,6 @@
|
||||
#include <linux/mii.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/utsname.h>
|
||||
@ -40,7 +41,6 @@
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_packet.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip6.h>
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip6.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -28,7 +29,6 @@
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "cmap.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
* Linux-specific definitions for Netlink sockets, see netlink-socket.h.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "odp-execute.h"
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include <netinet/ip6.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -15,12 +15,13 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "odp-util.h"
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include <netinet/ip6.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -15,6 +15,8 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "bundle.h"
|
||||
|
@ -15,6 +15,8 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "openvswitch/ofp-ed-props.h"
|
||||
#include "openvswitch/ofp-util.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "byte-order.h"
|
||||
|
@ -28,12 +28,12 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "ovs-lldp.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "openvswitch/dynamic-string.h"
|
||||
#include "flow.h"
|
||||
#include "openvswitch/list.h"
|
||||
|
@ -18,12 +18,13 @@
|
||||
|
||||
#include "ovs-router.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -17,6 +17,7 @@
|
||||
#ifndef OVS_TNL_ROUTER_H
|
||||
#define OVS_TNL_ROUTER_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "util.h"
|
||||
|
@ -16,13 +16,13 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "packets.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip6.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include "byte-order.h"
|
||||
#include "csum.h"
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "route-table.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
@ -31,11 +31,11 @@
|
||||
#include <config.h>
|
||||
#include "rstp.h"
|
||||
#include "rstp-state-machines.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "byte-order.h"
|
||||
#include "connectivity.h"
|
||||
#include "openvswitch/ofpbuf.h"
|
||||
|
@ -32,11 +32,11 @@
|
||||
#include "rstp.h"
|
||||
#include "rstp-common.h"
|
||||
#include "rstp-state-machines.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "byte-order.h"
|
||||
#include "connectivity.h"
|
||||
#include "openvswitch/ofpbuf.h"
|
||||
|
@ -13,18 +13,18 @@
|
||||
callback in sfl_agent_init.*/
|
||||
/* #define SFLOW_DO_SOCKET */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <arpa/inet.h> /* for htonl */
|
||||
|
||||
#ifdef SFLOW_DO_SOCKET
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#endif
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#ifndef SMAP_H
|
||||
#define SMAP_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include "hash.h"
|
||||
#include "openvswitch/hmap.h"
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "socket-util.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "stream-provider.h"
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
|
1
lib/tc.h
1
lib/tc.h
@ -18,6 +18,7 @@
|
||||
#ifndef TC_H
|
||||
#define TC_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h> /* Must happen before linux/pkt_cls.h - Glibc #20215 */
|
||||
#include <linux/pkt_cls.h>
|
||||
#include <linux/pkt_sched.h>
|
||||
|
@ -17,6 +17,8 @@
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "vconn-provider.h"
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -15,6 +15,8 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include "flow.h"
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "netflow.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -16,10 +16,11 @@
|
||||
|
||||
#include "ofproto/ofproto-dpif-xlate-cache.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "bfd.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "openvswitch/types.h"
|
||||
|
@ -17,10 +17,11 @@
|
||||
#include "ofproto/ofproto-dpif-xlate.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bitmap.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#ifndef OVN_DHCP_H
|
||||
#define OVN_DHCP_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include "openvswitch/hmap.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "csum.h"
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <stdio.h>
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <config.h>
|
||||
#undef NDEBUG
|
||||
#include "netflow.h"
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
|
@ -15,13 +15,14 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user