diff options
author | Florin Coras <fcoras@cisco.com> | 2017-10-02 00:18:51 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-10-10 20:42:50 +0000 |
commit | cea194d8f973a2f2b5ef72d212533057174cc70a (patch) | |
tree | 6fdd2e8a929c62625d1ad35bfbec342129989aef /src/vnet/session/transport.h | |
parent | 1f36a93d3d68f5ba6dcda08809394ce757cefd72 (diff) |
session: add support for application namespacing
Applications are now provided the option to select the namespace they
are to be attached to and the scope of their attachement. Application
namespaces are meant to:
1) constrain the scope of communication through the network by
association with source interfaces and/or fib tables that provide the
source ips to be used and limit the scope of routing
2) provide a namespace local scope to session layer communication, as
opposed to the global scope provided by 1). That is, sessions can be
established without assistance from transport and network layers.
Albeit, zero/local-host ip addresses must still be provided in session
establishment messages due to existing application idiosyncrasies. This
mode of communication uses shared-memory fifos (cut-through sessions)
exclusively.
If applications request no namespace, they are assigned to the default
one, which at its turn uses the default fib. Applications can request
access to both local and global scopes for a namespace. If no scope is
specified, session layer defaults to the global one.
When a sw_if_index is provided for a namespace, zero-ip (INADDR_ANY)
binds are converted to binds to the requested interface.
Change-Id: Ia0f660bbf7eec7f89673f75b4821fc7c3d58e3d1
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/transport.h')
-rw-r--r-- | src/vnet/session/transport.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h index e2c479494ca..8c299c46490 100644 --- a/src/vnet/session/transport.h +++ b/src/vnet/session/transport.h @@ -18,8 +18,6 @@ #include <vnet/vnet.h> #include <vnet/ip/ip.h> -#include <vppinfra/bihash_16_8.h> -#include <vppinfra/bihash_48_8.h> #include <vnet/tcp/tcp_debug.h> /* @@ -33,7 +31,7 @@ typedef struct _transport_connection u16 rmt_port; /**< Remote port */ u8 transport_proto; /**< Protocol id */ u8 is_ip4; /**< Flag if IP4 connection */ - u32 vrf; /**< FIB table id */ + u32 fib_index; /**< Network namespace */ u32 s_index; /**< Parent session index */ u32 c_index; /**< Connection index in transport pool */ @@ -57,8 +55,7 @@ typedef struct _transport_connection #define c_lcl_port connection.lcl_port #define c_rmt_port connection.rmt_port #define c_transport_proto connection.transport_proto -#define c_vrf connection.vrf -#define c_state connection.state +#define c_fib_index connection.fib_index #define c_s_index connection.s_index #define c_c_index connection.c_index #define c_is_ip4 connection.is_ip4 @@ -75,14 +72,28 @@ typedef enum _transport_proto TRANSPORT_PROTO_UDP } transport_proto_t; +#define foreach_transport_connection_fields \ + _(u32, sw_if_index) /**< interface endpoint is associated with */ \ + _(ip46_address_t, ip) /**< ip address */ \ + _(u32, fib_index) /**< fib table endpoint is associated with */ \ + _(u8, is_ip4) /**< 1 if ip4 */ \ + _(u16, port) /**< port in net order */ \ + typedef struct _transport_endpoint { - ip46_address_t ip; /** ip address */ - u16 port; /** port in net order */ - u8 is_ip4; /** 1 if ip4 */ - u32 vrf; /** fib table the endpoint is associated with */ +#define _(type, name) type name; + foreach_transport_connection_fields +#undef _ } transport_endpoint_t; +#define ENDPOINT_INVALID_INDEX ((u32)~0) + +always_inline u8 +transport_connection_fib_proto (transport_connection_t * tc) +{ + return tc->is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6; +} + #endif /* VNET_VNET_URI_TRANSPORT_H_ */ /* |