From 1e49d194d01788afbc4b8216e27c794651a4facf Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 12 Aug 2021 15:42:43 +0200 Subject: passt, pasta: Introduce command-line options and port re-mapping Signed-off-by: Stefano Brivio --- util.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index 221df97..2e7699c 100644 --- a/util.h +++ b/util.h @@ -1,12 +1,7 @@ void err(const char *format, ...); void warn(const char *format, ...); void info(const char *format, ...); - -#ifdef DEBUG void debug(const char *format, ...); -#else -#define debug(...) { } -#endif #define CHECK_SET_MIN_MAX(basename, fd) \ do { \ @@ -53,6 +48,14 @@ void debug(const char *format, ...); #define PORT_IS_EPHEMERAL(port) ((port) >= PORT_EPHEMERAL_MIN) #define NS_FN_STACK_SIZE (RLIMIT_STACK_VAL * 1024 / 4) +#define NS_CALL(fn, arg) \ + do { \ + char ns_fn_stack[NS_FN_STACK_SIZE]; \ + \ + clone((fn), ns_fn_stack + sizeof(ns_fn_stack) / 2, \ + CLONE_VM | CLONE_VFORK | CLONE_FILES | SIGCHLD, \ + (void *)(arg)); \ + } while (0) #if __BYTE_ORDER == __BIG_ENDIAN #define L2_BUF_ETH_IP4_INIT \ @@ -120,6 +123,7 @@ void debug(const char *format, ...); enum bind_type { BIND_ANY = 0, BIND_LOOPBACK, + BIND_LL, BIND_EXT, }; -- cgit v1.2.3