FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
session_lookup.h File Reference
+ Include dependency graph for session_lookup.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _session_rule_add_del_args session_rule_add_del_args_t
 

Functions

stream_session_tsession_lookup_safe4 (u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
 Lookup session with ip4 and transport layer information. More...
 
stream_session_tsession_lookup_safe6 (u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
 Lookup session with ip6 and transport layer information. More...
 
transport_connection_tsession_lookup_connection_wt4 (u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u32 thread_index, u8 *is_filtered)
 Lookup connection with ip4 and transport layer information. More...
 
transport_connection_tsession_lookup_connection4 (u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
 Lookup connection with ip4 and transport layer information. More...
 
transport_connection_tsession_lookup_connection_wt6 (u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u32 thread_index, u8 *is_filtered)
 Lookup connection with ip6 and transport layer information. More...
 
transport_connection_tsession_lookup_connection6 (u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
 Lookup connection with ip6 and transport layer information. More...
 
stream_session_tsession_lookup_listener4 (u32 fib_index, ip4_address_t *lcl, u16 lcl_port, u8 proto)
 
stream_session_tsession_lookup_listener6 (u32 fib_index, ip6_address_t *lcl, u16 lcl_port, u8 proto)
 
stream_session_tsession_lookup_listener (u32 table_index, session_endpoint_t *sep)
 
int session_lookup_add_connection (transport_connection_t *tc, u64 value)
 Add transport connection to a session table. More...
 
int session_lookup_del_connection (transport_connection_t *tc)
 Delete transport connection from session table. More...
 
u64 session_lookup_endpoint_listener (u32 table_index, session_endpoint_t *sepi, u8 use_rules)
 Lookup listener for session endpoint in table. More...
 
u32 session_lookup_local_endpoint (u32 table_index, session_endpoint_t *sep)
 Look up endpoint in local session table. More...
 
stream_session_tsession_lookup_global_session_endpoint (session_endpoint_t *)
 
int session_lookup_add_session_endpoint (u32 table_index, session_endpoint_t *sep, u64 value)
 
int session_lookup_del_session_endpoint (u32 table_index, session_endpoint_t *sep)
 
int session_lookup_del_session (stream_session_t *s)
 
int session_lookup_del_half_open (transport_connection_t *tc)
 
int session_lookup_add_half_open (transport_connection_t *tc, u64 value)
 
u64 session_lookup_half_open_handle (transport_connection_t *tc)
 
transport_connection_tsession_lookup_half_open_connection (u64 handle, u8 proto, u8 is_ip4)
 
u32 session_lookup_get_index_for_fib (u32 fib_proto, u32 fib_index)
 
u64 session_lookup_local_listener_make_handle (session_endpoint_t *sep)
 
u8 session_lookup_local_is_handle (u64 handle)
 
int session_lookup_local_listener_parse_handle (u64 handle, session_endpoint_t *sep)
 
void session_lookup_show_table_entries (vlib_main_t *vm, session_table_t *table, u8 type, u8 is_local)
 
void session_lookup_dump_rules_table (u32 fib_index, u8 fib_proto, u8 transport_proto)
 
void session_lookup_dump_local_rules_table (u32 fib_index, u8 fib_proto, u8 transport_proto)
 
clib_error_tvnet_session_rule_add_del (session_rule_add_del_args_t *args)
 
void session_lookup_set_tables_appns (app_namespace_t *app_ns)
 Mark (global) tables as pertaining to app ns. More...
 
void session_lookup_init (void)
 

Variables

enum _session_rule_scope session_rule_scope_e
 

Typedef Documentation

typedef struct _session_rule_add_del_args session_rule_add_del_args_t

Function Documentation

int session_lookup_add_connection ( transport_connection_t tc,
u64  value 
)

Add transport connection to a session table.

Session lookup 5-tuple (src-ip, dst-ip, src-port, dst-port, session-type) is added to requested session table.

Parameters
tctransport connection to be added
valuevalue to be stored
Returns
non-zero if failure

Definition at line 264 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_lookup_add_half_open ( transport_connection_t tc,
u64  value 
)

Definition at line 733 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_lookup_add_session_endpoint ( u32  table_index,
session_endpoint_t sep,
u64  value 
)

Definition at line 290 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

transport_connection_t* session_lookup_connection4 ( u32  fib_index,
ip4_address_t lcl,
ip4_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto 
)

Lookup connection with ip4 and transport layer information.

Not optimized. This is used on the fast path so it needs to be fast. Thereby, duplication of code and 'hacks' allowed. Lookup logic is identical to that of session_lookup_connection_wt4

Parameters
fib_indexindex of the fib wherein the connection was received
lcllocal ip4 address
rmtremote ip4 address
lcl_portlocal port
rmt_portremote port
prototransport protocol (e.g., tcp, udp)
Returns
pointer to transport connection, if one is found, 0 otherwise

Definition at line 930 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

transport_connection_t* session_lookup_connection6 ( u32  fib_index,
ip6_address_t lcl,
ip6_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto 
)

Lookup connection with ip6 and transport layer information.

Not optimized. This is used on the fast path so it needs to be fast. Thereby, duplication of code and 'hacks' allowed. Lookup logic is identical to that of session_lookup_connection_wt4

Parameters
fib_indexindex of the fib wherein the connection was received
lcllocal ip6 address
rmtremote ip6 address
lcl_portlocal port
rmt_portremote port
prototransport protocol (e.g., tcp, udp)
Returns
pointer to transport connection, if one is found, 0 otherwise

Definition at line 1139 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

transport_connection_t* session_lookup_connection_wt4 ( u32  fib_index,
ip4_address_t lcl,
ip4_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto,
u32  thread_index,
u8 is_filtered 
)

Lookup connection with ip4 and transport layer information.

This is used on the fast path so it needs to be fast. Thereby, duplication of code and 'hacks' allowed.

The lookup is incremental and returns whenever something is matched. The steps are:

  • Try to find an established session
  • Try to find a half-open connection
  • Try session rules table
  • Try to find a fully-formed or local source wildcarded (listener bound to all interfaces) listener session
  • return 0
Parameters
fib_indexindex of fib wherein the connection was received
lcllocal ip4 address
rmtremote ip4 address
lcl_portlocal port
rmt_portremote port
prototransport protocol (e.g., tcp, udp)
thread_indexthread index for request
is_filteredreturn flag that indicates if connection was filtered.
Returns
pointer to transport connection, if one is found, 0 otherwise

Definition at line 853 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

transport_connection_t* session_lookup_connection_wt6 ( u32  fib_index,
ip6_address_t lcl,
ip6_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto,
u32  thread_index,
u8 is_filtered 
)

Lookup connection with ip6 and transport layer information.

This is used on the fast path so it needs to be fast. Thereby, duplication of code and 'hacks' allowed.

The lookup is incremental and returns whenever something is matched. The steps are:

  • Try to find an established session
  • Try to find a half-open connection
  • Try session rules table
  • Try to find a fully-formed or local source wildcarded (listener bound to all interfaces) listener session
  • return 0
Parameters
fib_indexindex of the fib wherein the connection was received
lcllocal ip6 address
rmtremote ip6 address
lcl_portlocal port
rmt_portremote port
prototransport protocol (e.g., tcp, udp)
thread_indexthread index for request
Returns
pointer to transport connection, if one is found, 0 otherwise

Definition at line 1071 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_lookup_del_connection ( transport_connection_t tc)

Delete transport connection from session table.

Parameters
table_indexsession table index
tctransport connection to be removed
Returns
non-zero if failure

Definition at line 350 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_lookup_del_half_open ( transport_connection_t tc)

Definition at line 759 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_lookup_del_session ( stream_session_t s)

Definition at line 374 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_lookup_del_session_endpoint ( u32  table_index,
session_endpoint_t sep 
)

Definition at line 317 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void session_lookup_dump_local_rules_table ( u32  fib_index,
u8  fib_proto,
u8  transport_proto 
)

Definition at line 1537 of file session_lookup.c.

+ Here is the call graph for this function:

void session_lookup_dump_rules_table ( u32  fib_index,
u8  fib_proto,
u8  transport_proto 
)

Definition at line 1525 of file session_lookup.c.

+ Here is the call graph for this function:

u64 session_lookup_endpoint_listener ( u32  table_index,
session_endpoint_t sep,
u8  use_rules 
)

Lookup listener for session endpoint in table.

Parameters
table_indextable where the endpoint should be looked up
sepsession endpoint to be looked up
use_rulesflag that indicates if the session rules of the table should be used
Returns
invalid handle if nothing is found, the handle of a valid listener or an action_index if a rule is hit

Definition at line 469 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 session_lookup_get_index_for_fib ( u32  fib_proto,
u32  fib_index 
)

Definition at line 245 of file session_lookup.c.

+ Here is the caller graph for this function:

stream_session_t* session_lookup_global_session_endpoint ( session_endpoint_t )
transport_connection_t* session_lookup_half_open_connection ( u64  handle,
u8  proto,
u8  is_ip4 
)

Definition at line 814 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u64 session_lookup_half_open_handle ( transport_connection_t tc)

Definition at line 783 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void session_lookup_init ( void  )

Definition at line 1654 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

stream_session_t* session_lookup_listener ( u32  table_index,
session_endpoint_t sep 
)

Definition at line 717 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

stream_session_t* session_lookup_listener4 ( u32  fib_index,
ip4_address_t lcl,
u16  lcl_port,
u8  proto 
)

Definition at line 668 of file session_lookup.c.

+ Here is the call graph for this function:

stream_session_t* session_lookup_listener6 ( u32  fib_index,
ip6_address_t lcl,
u16  lcl_port,
u8  proto 
)

Definition at line 706 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 session_lookup_local_endpoint ( u32  table_index,
session_endpoint_t sep 
)

Look up endpoint in local session table.

The result, for now, is an application index and it may in the future be extended to a more complicated "action object". The only action we emulate now is "drop" and for that we return a special app index.

Lookup logic is to check in order:

  • the rules in the table (connect acls)
  • session sub-table for a listener
  • session sub-table for a local listener (zeroed addr)
Parameters
table_indextable where the lookup should be done
sepsession endpoint to be looked up
Returns
index that can be interpreted as an app index or drop action.

Definition at line 541 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8 session_lookup_local_is_handle ( u64  handle)

Definition at line 1246 of file session_lookup.c.

+ Here is the caller graph for this function:

u64 session_lookup_local_listener_make_handle ( session_endpoint_t sep)

Definition at line 1238 of file session_lookup.c.

+ Here is the caller graph for this function:

int session_lookup_local_listener_parse_handle ( u64  handle,
session_endpoint_t sep 
)

Definition at line 1254 of file session_lookup.c.

+ Here is the caller graph for this function:

stream_session_t* session_lookup_safe4 ( u32  fib_index,
ip4_address_t lcl,
ip4_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto 
)

Lookup session with ip4 and transport layer information.

Important note: this may look into another thread's pool table and register as 'peeker'. Caller should call session_pool_remove_peeker as if needed as soon as possible.

Lookup logic is similar to that of session_lookup_connection_wt4 but this returns a session as opposed to a transport connection and it does not try to lookup half-open sessions.

Typically used by dgram connections

Definition at line 1002 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

stream_session_t* session_lookup_safe6 ( u32  fib_index,
ip6_address_t lcl,
ip6_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto 
)

Lookup session with ip6 and transport layer information.

Important note: this may look into another thread's pool table and register as 'peeker'. Caller should call session_pool_remove_peeker as if needed as soon as possible.

Lookup logic is similar to that of session_lookup_connection_wt6 but this returns a session as opposed to a transport connection and it does not try to lookup half-open sessions.

Typically used by dgram connections

Definition at line 1202 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void session_lookup_set_tables_appns ( app_namespace_t app_ns)

Mark (global) tables as pertaining to app ns.

Definition at line 1316 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void session_lookup_show_table_entries ( vlib_main_t vm,
session_table_t table,
u8  type,
u8  is_local 
)

Definition at line 1378 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vnet_session_rule_add_del ( session_rule_add_del_args_t args)

Definition at line 1269 of file session_lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

enum _session_rule_scope session_rule_scope_e