From bfa1d8c5dd228eae82f478805d68e01f8cb1c38f Mon Sep 17 00:00:00 2001 From: bol-van Date: Tue, 10 Feb 2026 15:59:56 +0300 Subject: [PATCH] nfqws2: compile mask_from_bitcount only for windows --- nfq2/helpers.c | 16 ++++++++++------ nfq2/helpers.h | 10 ++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/nfq2/helpers.c b/nfq2/helpers.c index 4563bd7..1b7beab 100644 --- a/nfq2/helpers.c +++ b/nfq2/helpers.c @@ -666,6 +666,15 @@ bool parse_int16(const char *p, int16_t *v) return false; } + +time_t boottime(void) +{ + struct timespec ts; + return clock_gettime(CLOCK_BOOT_OR_UPTIME, &ts) ? 0 : ts.tv_sec; +} + + +#ifdef __CYGWIN__ uint32_t mask_from_bitcount(uint32_t zct) { return zct < 32 ? ~((1u << zct) - 1) : 0; @@ -691,9 +700,4 @@ const struct in6_addr *mask_from_bitcount6(uint32_t zct) { return ip6_mask + zct; } - -time_t boottime(void) -{ - struct timespec ts; - return clock_gettime(CLOCK_BOOT_OR_UPTIME, &ts) ? 0 : ts.tv_sec; -} +#endif diff --git a/nfq2/helpers.h b/nfq2/helpers.h index b7fd7b6..e01d0c3 100644 --- a/nfq2/helpers.h +++ b/nfq2/helpers.h @@ -109,10 +109,6 @@ bool set_env_exedir(const char *argv0); bool parse_int16(const char *p, int16_t *v); -uint32_t mask_from_bitcount(uint32_t zct); -void mask_from_bitcount6_prepare(void); -const struct in6_addr *mask_from_bitcount6(uint32_t zct); - #ifdef CLOCK_BOOTTIME #define CLOCK_BOOT_OR_UPTIME CLOCK_BOOTTIME #elif defined(CLOCK_UPTIME) @@ -122,3 +118,9 @@ const struct in6_addr *mask_from_bitcount6(uint32_t zct); #endif time_t boottime(void); + +#ifdef __CYGWIN__ +uint32_t mask_from_bitcount(uint32_t zct); +void mask_from_bitcount6_prepare(void); +const struct in6_addr *mask_from_bitcount6(uint32_t zct); +#endif