aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-11 12:01:31 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-14 13:15:12 +0200
commit675174d4ba255383b213437e29b617d8f55dbc69 (patch)
tree7add0cf70e595028f9ca9485eb8e139d3d652bb6 /util.h
parentdcd3605d14aba011fa6c2f4596cb7494f64d2b93 (diff)
downloadpasst-675174d4ba255383b213437e29b617d8f55dbc69.tar
passt-675174d4ba255383b213437e29b617d8f55dbc69.tar.gz
passt-675174d4ba255383b213437e29b617d8f55dbc69.tar.bz2
passt-675174d4ba255383b213437e29b617d8f55dbc69.tar.lz
passt-675174d4ba255383b213437e29b617d8f55dbc69.tar.xz
passt-675174d4ba255383b213437e29b617d8f55dbc69.tar.zst
passt-675174d4ba255383b213437e29b617d8f55dbc69.zip
conf, tap: Split netlink and pasta functions, allow interface configuration
Move netlink routines to their own file, and use netlink to configure or fetch all the information we need, except for the TUNSETIFF ioctl. Move pasta-specific functions to their own file as well, add parameters and calls to configure the tap interface in the namespace. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
-rw-r--r--util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/util.h b/util.h
index 03c5ebb..605b708 100644
--- a/util.h
+++ b/util.h
@@ -39,6 +39,12 @@ void debug(const char *format, ...);
#define V6 1
#define IP_VERSIONS 2
+enum {
+ IP_VERSION_DISABLED = 0,
+ IP_VERSION_ENABLED,
+ IP_VERSION_PROBE,
+};
+
#define ARRAY_SIZE(a) ((int)(sizeof(a) / sizeof((a)[0])))
#define IN_INTERVAL(a, b, x) ((x) >= (a) && (x) <= (b))
@@ -48,6 +54,9 @@ void debug(const char *format, ...);
#define PORT_EPHEMERAL_MIN ((1 << 15) + (1 << 14)) /* RFC 6335 */
#define PORT_IS_EPHEMERAL(port) ((port) >= PORT_EPHEMERAL_MIN)
+#define MAC_ZERO ((uint8_t [ETH_ALEN]){ 0 })
+#define MAC_IS_ZERO(addr) (!memcmp((addr), MAC_ZERO, ETH_ALEN))
+
#define NS_FN_STACK_SIZE (RLIMIT_STACK_VAL * 1024 / 4)
#define NS_CALL(fn, arg) \
do { \