From 8b4df11e85e7fe1745db43897e18846e41e7c28d Mon Sep 17 00:00:00 2001 From: Ioannis Konstantelias Date: Thu, 23 Jan 2025 14:09:41 +0000 Subject: [PATCH] Fix existing workflows Signed-off-by: Ioannis Konstantelias --- .github/workflows/build.yml | 35 ++++----- .github/workflows/system_test.yml | 8 +- CMakeLists.txt | 21 ++---- CMakePresets.json | 4 +- Dockerfile | 10 +-- config_cmake.h.in => ptpd_config.h.in | 35 +++++---- scripts/utils.cmake | 47 ++++++++++++ scripts/wait_for.sh | 7 +- src/CMakeLists.txt | 17 +++-- src/dep/constants_dep.h | 11 +++ src/dep/eventtimer.h | 4 +- src/dep/sys.c | 103 +++++++++++++------------- src/ptp_timers.h | 4 +- src/ptpd.h | 9 +-- 14 files changed, 181 insertions(+), 134 deletions(-) rename config_cmake.h.in => ptpd_config.h.in (95%) create mode 100644 scripts/utils.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb000685..874860a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install dependencies - run: sudo apt install cmake ninja-build + run: sudo apt install cmake ninja-build libsnmp-dev - uses: actions/checkout@v4 - name: Build on Ubuntu run: | @@ -21,30 +21,25 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build on OpenBSD, x86-64, 7.4 - uses: cross-platform-actions/action@v0.25.0 - env: - AUTOCONF_VERSION: 2.71 - AUTOMAKE_VERSION: 1.16 + uses: cross-platform-actions/action@v0.27.0 with: operating_system: openbsd architecture: x86-64 version: '7.4' memory: 4G sync_files: runner-to-vm - environment_variables: AUTOCONF_VERSION AUTOMAKE_VERSION shell: bash run: | - sudo pkg_add autoconf-$AUTOCONF_VERSION automake-$AUTOMAKE_VERSION.5 libtool - autoreconf -vfi - ./configure - make + sudo pkg_add cmake ninja + cmake --preset package + cmake --build --preset package freebsd: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build on FreeBSD - uses: cross-platform-actions/action@v0.25.0 + uses: cross-platform-actions/action@v0.27.0 with: operating_system: freebsd architecture: x86-64 @@ -53,17 +48,16 @@ jobs: sync_files: runner-to-vm shell: bash run: | - sudo pkg install -y autoconf automake libtool - autoreconf -vfi - ./configure - make + sudo pkg install -y cmake ninja + cmake --preset package + cmake --build --preset package netbsd: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build on NetBSD - uses: cross-platform-actions/action@v0.25.0 + uses: cross-platform-actions/action@v0.27.0 with: operating_system: netbsd architecture: x86-64 @@ -72,16 +66,15 @@ jobs: sync_files: runner-to-vm shell: bash run: | - sudo pkgin -y install autoconf automake libtool - autoreconf -vfi - ./configure - make + sudo pkgin -y install cmake ninja-build + cmake --preset package + cmake --build --preset package macos: runs-on: macos-latest steps: - name: Install dependencies - run: sudo apt install cmake ninja-build + run: brew install cmake ninja net-snmp - uses: actions/checkout@v4 - name: Build on macOS run: | diff --git a/.github/workflows/system_test.yml b/.github/workflows/system_test.yml index 6c89a87e..44de0889 100644 --- a/.github/workflows/system_test.yml +++ b/.github/workflows/system_test.yml @@ -11,11 +11,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Run docker-compose - uses: hoverkraft-tech/compose-action@v2.0.1 - with: - up-flags: "-d" - - - name: Execute tests in the running services + - name: Execute tests run: | + docker compose up -d ./scripts/wait_for.sh 'docker logs ptpd-slave 2>&1 | grep -q "(slv) Received Peer Delay Interval"' 120 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9333785d..430633e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,28 +3,19 @@ cmake_minimum_required(VERSION 3.21) project(ptpd LANGUAGES C ASM) -option(STATISTICS "Enable statistics" ON) +option(SNMP "Enable SNMP" OFF) +option(STATISTICS "Enable statistics" OFF) set(PACKAGE_NAME "ptpd") set(PACKAGE_VERSION "2.3.2") -# Compatibility Configuration -include(CheckIncludeFiles) -check_include_files(net/ethernet.h HAVE_NET_ETHERNET_H) -check_include_files(netinet/ether.h HAVE_NETINET_ETHER_H) -check_include_files(netdb.h HAVE_NETDB_H) -check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) -check_include_files(sys/types.h HAVE_SYS_TYPES_H) -include(CheckFunctionExists) -check_function_exists(gethostbyname2 HAVE_GETHOSTBYNAME2) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config_cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config_cmake.h) - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_compile_definitions(HAVE_CONFIG_H) - if (${TESTING}) include(CTest) add_subdirectory(external/Unity) +else () + include(scripts/utils.cmake) + generate_configuration(${CMAKE_CURRENT_SOURCE_DIR}/ptpd_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/ptpd_config.h) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) endif () add_subdirectory(src) diff --git a/CMakePresets.json b/CMakePresets.json index 64f81758..06dee8c4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -18,7 +18,6 @@ }, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_C_COMPILER": "clang", "TESTING": "ON" } }, @@ -33,8 +32,7 @@ } }, "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_C_COMPILER": "clang" + "CMAKE_BUILD_TYPE": "Release" } } ], diff --git a/Dockerfile b/Dockerfile index 3a1a7554..3e24663b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,15 +2,15 @@ FROM ubuntu:22.04 RUN apt-get update && apt-get install -y \ build-essential \ - autoconf \ - automake \ - libtool \ + cmake \ + ninja-build \ + libsnmp-dev \ && rm -rf /var/lib/apt/lists/* COPY . /project WORKDIR /project -RUN autoreconf -fi && ./configure && make +RUN cmake --preset package && cmake --build --preset package -ENTRYPOINT ["src/ptpd2"] +ENTRYPOINT ["cmake-build-package/src/ptpd2"] diff --git a/config_cmake.h.in b/ptpd_config.h.in similarity index 95% rename from config_cmake.h.in rename to ptpd_config.h.in index fa330f68..99b7c48b 100644 --- a/config_cmake.h.in +++ b/ptpd_config.h.in @@ -10,15 +10,15 @@ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the `clock_gettime' function. */ -#undef HAVE_CLOCK_GETTIME +#cmakedefine HAVE_CLOCK_GETTIME /* Define to 1 if you have the declaration of `MSG_ERRQUEUE', and to 0 if you don't. */ -#undef HAVE_DECL_MSG_ERRQUEUE +#cmakedefine HAVE_DECL_MSG_ERRQUEUE /* Define to 1 if you have the declaration of `POSIX_TIMERS_SUPPORTED', and to 0 if you don't. */ -#undef HAVE_DECL_POSIX_TIMERS_SUPPORTED +#cmakedefine HAVE_DECL_POSIX_TIMERS_SUPPORTED /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H @@ -33,7 +33,7 @@ #undef HAVE_ENDIAN_H /* Define to 1 if you have the `endutent' function. */ -#undef HAVE_ENDUTENT +#cmakedefine HAVE_ENDUTENT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H @@ -45,10 +45,10 @@ #cmakedefine HAVE_GETHOSTBYNAME2 /* Define to 1 if you have the header file. */ -#undef HAVE_GETOPT_H +#cmakedefine HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long' function. */ -#undef HAVE_GETOPT_LONG +#cmakedefine HAVE_GETOPT_LONG /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY @@ -75,7 +75,7 @@ #undef HAVE_LINUX_NET_TSTAMP_H /* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_RTC_H +#cmakedefine HAVE_LINUX_RTC_H /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_ENDIAN_H @@ -87,6 +87,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H +/* Define to 1 if you have the `timer_t' symbol. */ +#cmakedefine HAVE_POSIX_TIMER + /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET @@ -97,13 +100,16 @@ #cmakedefine HAVE_NETINET_ETHER_H /* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IF_ETHER_H +#cmakedefine HAVE_NETINET_IF_ETHER_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NET_IF_ETHER_H /* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H +#cmakedefine HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_SYSTM_H +#cmakedefine HAVE_NETINET_IN_SYSTM_H /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NET_ETHERNET_H @@ -111,9 +117,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_ARP_H -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_ETHER_H - /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_H @@ -133,13 +136,13 @@ #undef HAVE_PUTUTLINE /* Define to 1 if you have the header file. */ -#undef HAVE_SCHED_H +#cmakedefine HAVE_SCHED_H /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `setutent' function. */ -#undef HAVE_SETUTENT +#cmakedefine HAVE_SETUTENT /* Define to 1 if you have the `signal' function. */ #undef HAVE_SIGNAL @@ -181,7 +184,7 @@ #undef HAVE_STRTOL /* Define to 1 if `octet' is a member of `struct ether_addr'. */ -#undef HAVE_STRUCT_ETHER_ADDR_OCTET +#cmakedefine HAVE_STRUCT_ETHER_ADDR_OCTET /* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ #undef HAVE_STRUCT_IFREQ_IFR_HWADDR diff --git a/scripts/utils.cmake b/scripts/utils.cmake new file mode 100644 index 00000000..b42d303c --- /dev/null +++ b/scripts/utils.cmake @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: BSD-2-Clause + +# +# Generates the configuration file at the `out` path, given the template in the `in` path +# Eg. generate_configuration(${PATH_TO}/config.h.in ${PATH_TO}/config.h) +# +function(generate_configuration in out) + include(CheckIncludeFiles) + check_include_files(net/ethernet.h HAVE_NET_ETHERNET_H) + check_include_files(net/if_ether.h HAVE_NET_IF_ETHER_H) + check_include_files(netinet/ether.h HAVE_NETINET_ETHER_H) + check_include_files(netinet/if_ether.h HAVE_NETINET_IF_ETHER_H) + check_include_files(netinet/in.h HAVE_NETINET_IN_H) + check_include_files(netinet/in_systm.h HAVE_NETINET_IN_SYSTM_H) + check_include_files(netdb.h HAVE_NETDB_H) + check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) + check_include_files(sys/types.h HAVE_SYS_TYPES_H) + check_include_files(getopt.h HAVE_GETOPT_H) + check_include_files(sched.h HAVE_SCHED_H) + check_include_files(linux_rtc.h HAVE_LINUX_RTC_H) + + include(CheckFunctionExists) + check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) + check_function_exists(gethostbyname2 HAVE_GETHOSTBYNAME2) + check_function_exists(getopt_long HAVE_GETOPT_LONG) + check_function_exists(setutent HAVE_SETUTENT) + check_function_exists(endutent HAVE_ENDUTENT) + + include(CheckSymbolExists) + check_symbol_exists(timer_create "time.h" HAVE_POSIX_TIMER) + check_symbol_exists(MSG_ERRQUEUE "socket.h" HAVE_DECL_MSG_ERRQUEUE) + + include(CheckStructHasMember) + if (${HAVE_NET_ETHERNET_H}) + check_struct_has_member("struct ether_addr" octet net/ethernet.h HAVE_STRUCT_ETHER_ADDR_OCTET) + endif () + if (${HAVE_NET_IF_ETHER_H}) + check_struct_has_member("struct ether_addr" octet net/if_ether.h HAVE_STRUCT_ETHER_ADDR_OCTET) + endif () + if (${HAVE_NETINET_ETHER_H}) + check_struct_has_member("struct ether_addr" octet netinet/ether.h HAVE_STRUCT_ETHER_ADDR_OCTET) + endif () + if (${HAVE_NETINET_IF_ETHER_H}) + check_struct_has_member("struct ether_addr" octet netinet/if_ether.h HAVE_STRUCT_ETHER_ADDR_OCTET) + endif () + configure_file(${in} ${out}) +endfunction() diff --git a/scripts/wait_for.sh b/scripts/wait_for.sh index 0cdc8b7c..be566b2b 100755 --- a/scripts/wait_for.sh +++ b/scripts/wait_for.sh @@ -21,7 +21,9 @@ while true; do # Execute the command eval "$command" if [ $? -eq 0 ]; then - echo "Success" + current_time=$(date +%s) + elapsed_time=$((current_time - start_time)) + echo "Succeeded after $elapsed_time seconds" exit 0 fi @@ -29,11 +31,10 @@ while true; do current_time=$(date +%s) elapsed_time=$((current_time - start_time)) if [ $elapsed_time -ge "$timeout" ]; then - echo "Fail" + echo "Failed after $elapsed_time seconds" exit 1 fi # Sleep for a short interval before checking again sleep 1 done - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 365f7da7..e1d2c77b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,14 +22,17 @@ add_executable(ptpd2 dep/configdefaults.c dep/daemonconfig.c dep/eventtimer.c - dep/eventtimer_posix.c + $, + dep/eventtimer_posix.c, # true + dep/eventtimer_itimer.c # false + > dep/ipv4_acl.c dep/msg.c dep/net.c dep/servo.c - dep/snmp.c dep/startup.c dep/sys.c + $<$:dep/snmp.c> $<$: dep/statistics.c dep/outlierfilter.c @@ -42,19 +45,21 @@ target_include_directories(ptpd2 PUBLIC ) target_link_libraries(ptpd2 PUBLIC m - netsnmp - netsnmpagent - netsnmpmibs + "$<$:netsnmp;netsnmpagent;netsnmpmibs>" ) target_compile_options(ptpd2 PUBLIC -Wall + "$<$:`net-snmp-config --base-cflags`>" ) target_compile_definitions(ptpd2 PUBLIC DATADIR="" - PTPD_PTIMERS $<$:PTPD_STATISTICS> + $<$:PTPD_SNMP> ) +target_compile_features(ptpd2 PUBLIC c_std_99) + + if (${TESTING}) add_subdirectory(unit_tests) endif () diff --git a/src/dep/constants_dep.h b/src/dep/constants_dep.h index da76da39..8ba27a72 100644 --- a/src/dep/constants_dep.h +++ b/src/dep/constants_dep.h @@ -62,6 +62,17 @@ if it's POSIX compatible, if you succeed, report it to ptpd-devel@sourceforge.ne #ifdef HAVE_NET_ETHERNET_H # include #endif +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif /* HAVE_NETINET_IF_ETHER_H */ + +#ifdef __OpenBSD__ +/* For *reasons*, CMake cannot find this file in OpenBSD. + * As a result I do not use the HAVE_NETINET_IF_ETHER_H guards here: + */ +#include +#endif /* __OpenBSD__ */ + #include # define IFACE_NAME_LENGTH IF_NAMESIZE # define NET_ADDRESS_LENGTH INET_ADDRSTRLEN diff --git a/src/dep/eventtimer.h b/src/dep/eventtimer.h index eaf19ff4..1968592c 100644 --- a/src/dep/eventtimer.h +++ b/src/dep/eventtimer.h @@ -33,12 +33,12 @@ struct EventTimer { Boolean (*isRunning) (EventTimer* timer); /* implementation data */ -#ifdef PTPD_PTIMERS +#ifdef HAVE_POSIX_TIMER timer_t timerId; #else int32_t itimerInterval; int32_t itimerLeft; -#endif /* PTPD_PTIMERS */ +#endif /* HAVE_POSIX_TIMER */ /* linked list */ EventTimer *_first; diff --git a/src/dep/sys.c b/src/dep/sys.c index 9e61ad91..b2635f9f 100644 --- a/src/dep/sys.c +++ b/src/dep/sys.c @@ -1432,62 +1432,65 @@ static const struct sigevent* timerIntHandler(void* data, int id) { } #endif - void getTime(TimeInternal *time) - { +void +getTime(TimeInternal *time) +{ #ifdef __QNXNTO__ - static TimerIntData tmpData; - int ret; - uint64_t delta; - double tick_delay; - uint64_t clock_offset; - struct timespec tp; - if(!tDataUpdated) { - memset(&tData, 0, sizeof(TimerIntData)); - if(ThreadCtl(_NTO_TCTL_IO, 0) == -1) { - ERROR("QNX: could not give process I/O privileges"); - return; - } + static TimerIntData tmpData; + int ret; + uint64_t delta; + double tick_delay; + uint64_t clock_offset; + struct timespec tp; + if (!tDataUpdated) { + memset(&tData, 0, sizeof(TimerIntData)); + if (ThreadCtl(_NTO_TCTL_IO, 0) == -1) { + ERROR("QNX: could not give process I/O privileges"); + return; + } - tData.cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec; - tData.ns_per_tick = 1000000000.0 / tData.cps; - tData.prev_tsc = ClockCycles(); - clock_gettime(CLOCK_REALTIME, &tp); - tData.last_clock = timespec2nsec(&tp); - ret = InterruptAttach(0, timerIntHandler, &tData, sizeof(TimerIntData), _NTO_INTR_FLAGS_END | _NTO_INTR_FLAGS_TRK_MSK); + tData.cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec; + tData.ns_per_tick = 1000000000.0 / tData.cps; + tData.prev_tsc = ClockCycles(); + clock_gettime(CLOCK_REALTIME, &tp); + tData.last_clock = timespec2nsec(&tp); + ret = InterruptAttach(0, timerIntHandler, &tData, sizeof(TimerIntData), + _NTO_INTR_FLAGS_END | _NTO_INTR_FLAGS_TRK_MSK); - if(ret == -1) { - ERROR("QNX: could not attach to timer interrupt"); - return ; - } - tDataUpdated = TRUE; + if (ret == -1) { + ERROR("QNX: could not attach to timer interrupt"); + return; + } + tDataUpdated = TRUE; - ti_from_timespec(&tp, time); - return; - } + ti_from_timespec(&tp, time); + return; + } - memcpy(&tmpData, &tData, sizeof(TimerIntData)); + memcpy(&tmpData, &tData, sizeof(TimerIntData)); - delta = ClockCycles() - tmpData.prev_tsc; + delta = ClockCycles() - tmpData.prev_tsc; - /* compute time since last clock update */ - tick_delay = (double)delta / (double)tmpData.filtered_delta; - clock_offset = (uint64_t)(tick_delay * tmpData.ns_per_tick * (double)tmpData.filtered_delta); + /* compute time since last clock update */ + tick_delay = (double)delta / (double)tmpData.filtered_delta; + clock_offset = + (uint64_t)(tick_delay * tmpData.ns_per_tick * (double)tmpData.filtered_delta); - /* not filtered yet */ - if(tData.counter < 2) { - clock_offset = 0; - } + /* not filtered yet */ + if (tData.counter < 2) { + clock_offset = 0; + } - DBGV("QNX getTime cps: %lld tick interval: %.09f, time since last tick: %lld\n", - tmpData.cps, tmpData.filtered_delta * tmpData.ns_per_tick, clock_offset); + DBGV("QNX getTime cps: %lld tick interval: %.09f, time since last tick: %lld\n", + tmpData.cps, tmpData.filtered_delta * tmpData.ns_per_tick, clock_offset); - nsec2timespec(&tp, tmpData.last_clock + clock_offset); + nsec2timespec(&tp, tmpData.last_clock + clock_offset); - ti_from_timespec(&tp, time); - return; + ti_from_timespec(&tp, time); + return; #else -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) +#ifdef HAVE_POSIX_TIMER struct timespec tp; if (clock_gettime(CLOCK_REALTIME, &tp) < 0) { @@ -1502,14 +1505,14 @@ static const struct sigevent* timerIntHandler(void* data, int id) { gettimeofday(&tv, 0); ti_from_timeval(&tv, time); -#endif /* _POSIX_TIMERS */ +#endif /* HAVE_POSIX_TIMER */ #endif /* __QNXNTO__ */ } void getTimeMonotonic(TimeInternal * time) { -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) +#ifdef HAVE_POSIX_TIMER struct timespec tp; #ifndef CLOCK_MONOTINIC @@ -1527,7 +1530,7 @@ getTimeMonotonic(TimeInternal * time) gettimeofday(&tv, 0); ti_from_timeval(&tv, time); -#endif /* _POSIX_TIMERS */ +#endif /* HAVE_POSIX_TIMER */ } @@ -1535,7 +1538,7 @@ void setTime(TimeInternal * time) { -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) +#ifdef HAVE_POSIX_TIMER struct timespec tp; ti_to_timespec(time, &tp); @@ -1545,9 +1548,9 @@ setTime(TimeInternal * time) struct timeval tv; ti_to_timeval(time, &tv); -#endif /* _POSIX_TIMERS */ +#endif /* HAVE_POSIX_TIMER */ -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) +#ifdef HAVE_POSIX_TIMER if (clock_settime(CLOCK_REALTIME, &tp) < 0) { PERROR("Could not set system time"); @@ -1558,7 +1561,7 @@ setTime(TimeInternal * time) settimeofday(&tv, 0); -#endif /* _POSIX_TIMERS */ +#endif /* HAVE_POSIX_TIMER */ struct timespec tmpTs = {ti_seconds(time), 0}; diff --git a/src/ptp_timers.h b/src/ptp_timers.h index 4a176aee..68ea1434 100644 --- a/src/ptp_timers.h +++ b/src/ptp_timers.h @@ -28,12 +28,12 @@ #include "ptpd.h" -#ifdef PTPD_PTIMERS +#ifdef HAVE_POSIX_TIMER #define LOG_MIN_INTERVAL -7 #else /* 62.5ms tick for interval timers = 16/sec max */ #define LOG_MIN_INTERVAL -4 -#endif /* PTPD_PTIMERS */ +#endif /* HAVE_POSIX_TIMER */ /* safeguard: a week */ #define PTPTIMER_MAX_INTERVAL 604800 diff --git a/src/ptpd.h b/src/ptpd.h index 666051bc..284c3754 100644 --- a/src/ptpd.h +++ b/src/ptpd.h @@ -43,11 +43,7 @@ #ifndef PTPD_H_ #define PTPD_H_ -#ifdef HAVE_CONFIG_H -// # include -# include -#endif /* HAVE_CONFIG_H */ - +#include "ptpd_config.h" #ifdef linux # ifndef _GNU_SOURCE @@ -140,6 +136,9 @@ #include #endif /* HAVE_NETINET_IF_ETHER_H */ +#ifdef HAVE_NET_IF_ETHER_H +#include +#endif /* HAVE_NET_IF_ETHER_H */ #ifdef PTPD_PCAP #ifdef HAVE_PCAP_PCAP_H