ctdb-build: Add --enable-pcap configure option
authorMartin Schwenke <martin@meltin.net>
Mon, 8 Aug 2022 01:26:54 +0000 (11:26 +1000)
committerJule Anger <janger@samba.org>
Tue, 29 Aug 2023 09:35:11 +0000 (09:35 +0000)
This forces the use pcap for packet capture on Linux.

It appears that using a raw socket for capture does not work with
infiniband - pcap support for that to come.

Don't (yet?) change the default capture method to pcap.  On some
platforms (e.g. my personal Intel NUC, running Debian testing), pcap
is much less reliable than the raw socket.  However, pcap seems fine
on most other platforms.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit d1543d5c7889f3ac42f80fc5d1eddf54f9c5d0d6)

ctdb/wscript

index 8f6e2bb52035c6cf9b94c0b03df3a3c2b1a0ad79..88e42439f5a93bd50d4b56b41edd9ab7e920da39 100644 (file)
@@ -98,6 +98,9 @@ def options(opt):
     opt.add_option('--enable-etcd-reclock',
                    help=("Enable etcd recovery lock helper (default=no)"),
                    action="store_true", dest='ctdb_etcd_reclock', default=False)
+    opt.add_option('--enable-pcap',
+                   help=("Use pcap for packet capture (default=no)"),
+                   action="store_true", dest='ctdb_pcap', default=False)
 
     opt.add_option('--with-libcephfs',
                    help=("Directory under which libcephfs is installed"),
@@ -201,7 +204,9 @@ def configure(conf):
     if not conf.CHECK_VARIABLE('ETIME', headers='errno.h'):
         conf.DEFINE('ETIME', 'ETIMEDOUT')
 
-    if sys.platform.startswith('linux'):
+    if Options.options.ctdb_pcap or not sys.platform.startswith('linux'):
+        conf.DEFINE('ENABLE_PCAP', 1)
+    if not conf.env.ENABLE_PCAP:
         conf.SET_TARGET_TYPE('pcap', 'EMPTY')
     else:
         conf.find_program('pcap-config', var='PCAP_CONFIG')