summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-04-15 12:37:48 -0700
committerDave Barach <openvpp@barachs.net>2022-04-18 21:19:24 +0000
commit8c2bdf86199729e2a7c0564f989690e3e076a19c (patch)
tree492d808a3ba03eb34822181037b36849eddbdf56 /src
parent1afa2b62ceb33d2c167cdcf68431070781545aa6 (diff)
session: add support for listen proxies
Listener proxies are allowed to listen on IPs that are not local. Configurable only by builtin apps for now. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Idb380ee3584a088878a03d45fd85e7bb0deeb590
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/application.c13
-rw-r--r--src/vnet/session/session_types.h19
2 files changed, 27 insertions, 5 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index d718b03e6a5..7f88c7a5ff0 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -1229,11 +1229,15 @@ vnet_application_detach (vnet_app_detach_args_t * a)
return 0;
}
-
static u8
-session_endpoint_in_ns (session_endpoint_t * sep)
+session_endpoint_in_ns (session_endpoint_cfg_t *sep)
{
- u8 is_lep = session_endpoint_is_local (sep);
+ u8 is_lep;
+
+ if (sep->flags & SESSION_ENDPT_CFG_F_PROXY_LISTEN)
+ return 1;
+
+ is_lep = session_endpoint_is_local ((session_endpoint_t *) sep);
if (!is_lep && sep->sw_if_index != ENDPOINT_INVALID_INDEX
&& !ip_interface_has_address (sep->sw_if_index, &sep->ip, sep->is_ip4))
{
@@ -1242,6 +1246,7 @@ session_endpoint_in_ns (session_endpoint_t * sep)
sep->is_ip4);
return 0;
}
+
return (is_lep || ip_is_local (sep->fib_index, &sep->ip, sep->is_ip4));
}
@@ -1311,7 +1316,7 @@ vnet_listen (vnet_listen_args_t * a)
a->sep_ext.app_wrk_index = app_wrk->wrk_index;
session_endpoint_update_for_app (&a->sep_ext, app, 0 /* is_connect */ );
- if (!session_endpoint_in_ns (&a->sep))
+ if (!session_endpoint_in_ns (&a->sep_ext))
return SESSION_E_INVALID_NS;
/*
diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h
index 8a8571bc9ee..7cfa6716187 100644
--- a/src/vnet/session/session_types.h
+++ b/src/vnet/session/session_types.h
@@ -36,6 +36,23 @@ typedef struct _session_endpoint
#undef _
} session_endpoint_t;
+#define foreach_session_endpoint_cfg_flags _ (PROXY_LISTEN, "proxy listener")
+
+typedef enum session_endpoint_cfg_flags_bits_
+{
+#define _(sym, str) SESSION_ENDPT_CFG_F_BIT_##sym,
+ foreach_session_endpoint_cfg_flags
+#undef _
+} __clib_packed session_endpoint_cfg_flags_bits_t;
+
+typedef enum session_endpoint_cfg_flags_
+{
+#define _(sym, str) \
+ SESSION_ENDPT_CFG_F_##sym = 1 << SESSION_ENDPT_CFG_F_BIT_##sym,
+ foreach_session_endpoint_cfg_flags
+#undef _
+} __clib_packed session_endpoint_cfg_flags_t;
+
typedef struct _session_endpoint_cfg
{
#define _(type, name) type name;
@@ -46,7 +63,7 @@ typedef struct _session_endpoint_cfg
u32 ns_index;
u8 original_tp;
u64 parent_handle;
- u8 flags;
+ session_endpoint_cfg_flags_t flags;
transport_endpt_ext_cfg_t *ext_cfg;
} session_endpoint_cfg_t;