ctdb-common: Support "any" interface for pcap-based capture
authorMartin Schwenke <martin@meltin.net>
Mon, 15 Aug 2022 00:51:47 +0000 (10:51 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 20 Sep 2022 10:43:37 +0000 (10:43 +0000)
commite5541a7e0220a88d59d574d501626b0598050c52
tree2a6e693d06f39756754aeb2d1b36a5f9b00a68ab
parent3bf20300ac5962e71069be3998ef7f0502045d24
ctdb-common: Support "any" interface for pcap-based capture

This uses Linux cooked capture link-layer headers.  See:

  https://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL.html
  https://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL2.html

The header type needs to be checked to ensure the protocol
type (i.e. ether type, for the protocols we might be interested in) is
meaningful.  The size of the header needs to be known so it can be
skipped, allowing the IP header to be found and parsed.

It would be possible to define support for DLT_LINUX_SLL2 if it is
missing.  However, if a platform is missing support in the header file
then it is almost certainly missing in the run-time library too.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/system_socket.c