From 11bca5a7af4b448ee0a37cd243e34ecd0e652b3d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 20 Oct 2015 23:10:09 +0200 Subject: Improve include_directories to prevent conflicts between system and fastd headers In in-tree builds, fastd's poll.h was conflicting with the system one on non-Linux systems. --- src/CMakeLists.txt | 6 +- src/build.h.in | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/compat.h | 2 +- src/config.c | 2 +- src/fastd.c | 2 +- src/fastd_config.h.in | 164 -------------------------------------------------- src/handshake.c | 2 +- src/lex.h | 2 +- src/options.c | 2 +- 9 files changed, 173 insertions(+), 173 deletions(-) create mode 100644 src/build.h.in delete mode 100644 src/fastd_config.h.in (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 20813ce..086e23d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE __APPLE_USE_RFC_3542) set(FASTD_CFLAGS "${PTHREAD_CFLAGS} -std=c99 ${LIBUECC_CFLAGS_OTHER} ${LIBNACL_CFLAGS_OTHER} ${JSON_C_CFLAGS_OTHER} ${CFLAGS_LTO} -Wall") -include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/src) +include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/gen) include(generate_version) @@ -12,9 +12,9 @@ add_subdirectory(methods) add_subdirectory(crypto) include(check_reqs) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fastd_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/fastd_config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build.h.in ${CMAKE_BINARY_DIR}/gen/generated/build.h) -BISON_TARGET(fastd_config_parse config.y ${CMAKE_CURRENT_BINARY_DIR}/config.yy.c) +BISON_TARGET(fastd_config_parse config.y ${CMAKE_BINARY_DIR}/gen/generated/config.yy.c) add_executable(fastd android.c diff --git a/src/build.h.in b/src/build.h.in new file mode 100644 index 0000000..5f9c868 --- /dev/null +++ b/src/build.h.in @@ -0,0 +1,164 @@ +/* + Copyright (c) 2012-2015, Matthias Schiffer + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + \file + + Generated configuration +*/ + + +#pragma once + +/** Defined if the platform supports the AI_ADDRCONFIG flag to getaddrinfo() */ +#cmakedefine HAVE_AI_ADDRCONFIG + +/** Defined if the platform defines get_current_dir_name() */ +#cmakedefine HAVE_GET_CURRENT_DIR_NAME + +/** Defined if exists */ +#cmakedefine HAVE_ENDIAN_H + +/** Defined if exists */ +#cmakedefine HAVE_SYS_ENDIAN_H + +/** Defined if be32toh etc. exist */ +#cmakedefine HAVE_LINUX_ENDIAN + +/** Defined if the platform supports SO_BINDTODEVICE */ +#cmakedefine USE_BINDTODEVICE + +/** Defined if the platform supports epoll */ +#cmakedefine USE_EPOLL + +/** Defined if the platform uses select instead of poll */ +#cmakedefine USE_SELECT + +/** Defined if the platform supports SO_FREEBIND */ +#cmakedefine USE_FREEBIND + +/** Defined if the platform supports IP_MTU_DISCOVER */ +#cmakedefine USE_PMTU + +/** Defined if the platform supports IP_PKTINFO */ +#cmakedefine USE_PKTINFO + +/** Defined if the platform supports SO_MARK */ +#cmakedefine USE_PACKET_MARK + +/** Defined if the platform supports settings users and groups */ +#cmakedefine USE_USER + +/** Defined if the platform supports binding on IPv4 and IPv6 with a single socket */ +#cmakedefine USE_MULTIAF_BIND + + +/** Defined if POSIX capability support is enabled */ +#cmakedefine WITH_CAPABILITIES + +/** Defined if support for setting user/group related options on the command line is enabled */ +#cmakedefine WITH_CMDLINE_USER + +/** Defined if support for setting logging related options on the command line is enabled */ +#cmakedefine WITH_CMDLINE_LOGGING + +/** Defined if support for setting related to the VPN operation (like mode, interface, encryption method) on the command line is enabled */ +#cmakedefine WITH_CMDLINE_OPERATION + +/** Defined if support for setting handler scripts (e.g. --on-up) on the command line is enabled */ +#cmakedefine WITH_CMDLINE_COMMANDS + +/** Defined if on-verify support is enabled */ +#cmakedefine WITH_DYNAMIC_PEERS + +/** Defined if status socket support is enabled */ +#cmakedefine WITH_STATUS_SOCKET + +/** Defined if systemd support is enabled */ +#cmakedefine ENABLE_SYSTEMD + + +/** Defined if libsodium is used */ +#cmakedefine HAVE_LIBSODIUM + +/** Defined if OpenSSL is used */ +#cmakedefine ENABLE_OPENSSL + + +/** The maximum depth of nested includes in config files */ +#define MAX_CONFIG_DEPTH @MAX_CONFIG_DEPTH_NUM@ + + +/** The interval of periodic maintenance tasks */ +#define MAINTENANCE_INTERVAL 10000 /* 10 seconds */ + +/** The time after which a keepalive should be sent */ +#define KEEPALIVE_TIMEOUT 15000 /* 15 seconds */ + +/** The time after with a peer is reset if no traffic is received from it */ +#define PEER_STALE_TIME 90000 /* 90 seconds */ + +/** The time after which a peer's ethernet address is forgotten if it is not seen */ +#define ETH_ADDR_STALE_TIME 300000 /* 5 minutes */ + + +/** The time after a packet is received and no packets with lower sequence numbers are accepted anymore */ +#define REORDER_TIME 10000 + + +/** The minimum time that must pass between two on-verify calls on the same peer */ +#define MIN_VERIFY_INTERVAL 10000 /* 10 seconds */ + +/** How long a peer stays valid after a successful on-verify run */ +#define VERIFY_VALID_TIME 60000 /* 1 minute */ + +/** Maximum number of concurrent on-verify runs */ +#define VERIFY_LIMIT 32 + +/** The minimum interval between two handshakes with a peer */ +#define MIN_HANDSHAKE_INTERVAL 15000 /* 15 seconds */ + +/** The minimum interval between two resolves of the same remote */ +#define MIN_RESOLVE_INTERVAL 15000 /* 15 seconds */ + +/** The number of hash tables for backoff_unknown() */ +#define UNKNOWN_TABLES 16 + +/** The number of entries per unknown peer table */ +#define UNKNOWN_ENTRIES 64 + + + +/** How long a session stays valid after a key is negotiated */ +#define KEY_VALID 3600000 /* 60 minutes */ + +/** How long an old session stays valid after a new session has been established */ +#define KEY_VALID_OLD 60000 /* 1 minute */ + +/** How many seconds after the establishment of a session we want to refresh the session */ +#define KEY_REFRESH 3300000 /* 55 minutes */ + +/** A random time up to KEY_REFRESH_SPLAY is subtracted from KEY_REFRESH */ +#define KEY_REFRESH_SPLAY 300000 /* 5 minutes */ diff --git a/src/compat.h b/src/compat.h index 29c9253..620bf33 100644 --- a/src/compat.h +++ b/src/compat.h @@ -32,7 +32,7 @@ #pragma once -#include +#include #include #include diff --git a/src/config.c b/src/config.c index 64ee12a..a2a5e8a 100644 --- a/src/config.c +++ b/src/config.c @@ -41,7 +41,7 @@ #include "method.h" #include "peer.h" #include "peer_group.h" -#include +#include #include #include diff --git a/src/fastd.c b/src/fastd.c index fbeffe5..3d5b3d4 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -42,7 +42,7 @@ #include "peer_group.h" #include "peer_hashtable.h" #include "poll.h" -#include +#include #include #include diff --git a/src/fastd_config.h.in b/src/fastd_config.h.in deleted file mode 100644 index 5f9c868..0000000 --- a/src/fastd_config.h.in +++ /dev/null @@ -1,164 +0,0 @@ -/* - Copyright (c) 2012-2015, Matthias Schiffer - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - \file - - Generated configuration -*/ - - -#pragma once - -/** Defined if the platform supports the AI_ADDRCONFIG flag to getaddrinfo() */ -#cmakedefine HAVE_AI_ADDRCONFIG - -/** Defined if the platform defines get_current_dir_name() */ -#cmakedefine HAVE_GET_CURRENT_DIR_NAME - -/** Defined if exists */ -#cmakedefine HAVE_ENDIAN_H - -/** Defined if exists */ -#cmakedefine HAVE_SYS_ENDIAN_H - -/** Defined if be32toh etc. exist */ -#cmakedefine HAVE_LINUX_ENDIAN - -/** Defined if the platform supports SO_BINDTODEVICE */ -#cmakedefine USE_BINDTODEVICE - -/** Defined if the platform supports epoll */ -#cmakedefine USE_EPOLL - -/** Defined if the platform uses select instead of poll */ -#cmakedefine USE_SELECT - -/** Defined if the platform supports SO_FREEBIND */ -#cmakedefine USE_FREEBIND - -/** Defined if the platform supports IP_MTU_DISCOVER */ -#cmakedefine USE_PMTU - -/** Defined if the platform supports IP_PKTINFO */ -#cmakedefine USE_PKTINFO - -/** Defined if the platform supports SO_MARK */ -#cmakedefine USE_PACKET_MARK - -/** Defined if the platform supports settings users and groups */ -#cmakedefine USE_USER - -/** Defined if the platform supports binding on IPv4 and IPv6 with a single socket */ -#cmakedefine USE_MULTIAF_BIND - - -/** Defined if POSIX capability support is enabled */ -#cmakedefine WITH_CAPABILITIES - -/** Defined if support for setting user/group related options on the command line is enabled */ -#cmakedefine WITH_CMDLINE_USER - -/** Defined if support for setting logging related options on the command line is enabled */ -#cmakedefine WITH_CMDLINE_LOGGING - -/** Defined if support for setting related to the VPN operation (like mode, interface, encryption method) on the command line is enabled */ -#cmakedefine WITH_CMDLINE_OPERATION - -/** Defined if support for setting handler scripts (e.g. --on-up) on the command line is enabled */ -#cmakedefine WITH_CMDLINE_COMMANDS - -/** Defined if on-verify support is enabled */ -#cmakedefine WITH_DYNAMIC_PEERS - -/** Defined if status socket support is enabled */ -#cmakedefine WITH_STATUS_SOCKET - -/** Defined if systemd support is enabled */ -#cmakedefine ENABLE_SYSTEMD - - -/** Defined if libsodium is used */ -#cmakedefine HAVE_LIBSODIUM - -/** Defined if OpenSSL is used */ -#cmakedefine ENABLE_OPENSSL - - -/** The maximum depth of nested includes in config files */ -#define MAX_CONFIG_DEPTH @MAX_CONFIG_DEPTH_NUM@ - - -/** The interval of periodic maintenance tasks */ -#define MAINTENANCE_INTERVAL 10000 /* 10 seconds */ - -/** The time after which a keepalive should be sent */ -#define KEEPALIVE_TIMEOUT 15000 /* 15 seconds */ - -/** The time after with a peer is reset if no traffic is received from it */ -#define PEER_STALE_TIME 90000 /* 90 seconds */ - -/** The time after which a peer's ethernet address is forgotten if it is not seen */ -#define ETH_ADDR_STALE_TIME 300000 /* 5 minutes */ - - -/** The time after a packet is received and no packets with lower sequence numbers are accepted anymore */ -#define REORDER_TIME 10000 - - -/** The minimum time that must pass between two on-verify calls on the same peer */ -#define MIN_VERIFY_INTERVAL 10000 /* 10 seconds */ - -/** How long a peer stays valid after a successful on-verify run */ -#define VERIFY_VALID_TIME 60000 /* 1 minute */ - -/** Maximum number of concurrent on-verify runs */ -#define VERIFY_LIMIT 32 - -/** The minimum interval between two handshakes with a peer */ -#define MIN_HANDSHAKE_INTERVAL 15000 /* 15 seconds */ - -/** The minimum interval between two resolves of the same remote */ -#define MIN_RESOLVE_INTERVAL 15000 /* 15 seconds */ - -/** The number of hash tables for backoff_unknown() */ -#define UNKNOWN_TABLES 16 - -/** The number of entries per unknown peer table */ -#define UNKNOWN_ENTRIES 64 - - - -/** How long a session stays valid after a key is negotiated */ -#define KEY_VALID 3600000 /* 60 minutes */ - -/** How long an old session stays valid after a new session has been established */ -#define KEY_VALID_OLD 60000 /* 1 minute */ - -/** How many seconds after the establishment of a session we want to refresh the session */ -#define KEY_REFRESH 3300000 /* 55 minutes */ - -/** A random time up to KEY_REFRESH_SPLAY is subtracted from KEY_REFRESH */ -#define KEY_REFRESH_SPLAY 300000 /* 5 minutes */ diff --git a/src/handshake.c b/src/handshake.c index 2c50c0e..3d94c12 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -34,7 +34,7 @@ #include "method.h" #include "peer.h" #include "peer_group.h" -#include +#include /** Human-readable names for the TLV record types */ diff --git a/src/lex.h b/src/lex.h index 1cbefc0..506bd3f 100644 --- a/src/lex.h +++ b/src/lex.h @@ -33,7 +33,7 @@ #pragma once #include "types.h" -#include +#include #include diff --git a/src/options.c b/src/options.c index 17a6abb..ff73923 100644 --- a/src/options.c +++ b/src/options.c @@ -51,7 +51,7 @@ #include "config.h" #include "peer.h" #include "peer_group.h" -#include +#include #include -- cgit v1.2.3