diff options
author | Florin Coras <fcoras@cisco.com> | 2022-04-15 12:37:48 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2022-04-18 21:19:24 +0000 |
commit | 8c2bdf86199729e2a7c0564f989690e3e076a19c (patch) | |
tree | 492d808a3ba03eb34822181037b36849eddbdf56 /src/vnet/session/application.c | |
parent | 1afa2b62ceb33d2c167cdcf68431070781545aa6 (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/vnet/session/application.c')
-rw-r--r-- | src/vnet/session/application.c | 13 |
1 files changed, 9 insertions, 4 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; /* |