aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.h
diff options
context:
space:
mode:
authorqinyang <qiny@yusur.tech>2023-06-27 01:11:53 -0700
committerFlorin Coras <florin.coras@gmail.com>2023-07-21 16:27:14 +0000
commitaf9b7156c8fd16c671ce9332613faaf864b075b3 (patch)
tree201f45dacba23771db635c563b34315b6594d4af /src/vnet/session/session.h
parentae916b39049669bbada12dbcfecbb4e3f9c09c69 (diff)
vcl: ldp support SO_ORIGINAL_DST
Type: improvement Support SO_ORIGINAL_DST socket option to get original dst_ip4 and dst_port if nat44 rule enabled. Change-Id: If00e00d03e48f3b78a23a68f1b078954d79dd0f7 Signed-off-by: qinyang <qiny@yusur.tech>
Diffstat (limited to 'src/vnet/session/session.h')
-rw-r--r--src/vnet/session/session.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 10bae273d85..9c08f1a4d04 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -193,6 +193,10 @@ extern session_fifo_rx_fn session_tx_fifo_dequeue_internal;
u8 session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e);
typedef void (*session_update_time_fn) (f64 time_now, u8 thread_index);
+typedef void (*nat44_original_dst_lookup_fn) (
+ ip4_address_t *i2o_src, u16 i2o_src_port, ip4_address_t *i2o_dst,
+ u16 i2o_dst_port, ip_protocol_t proto, u32 *original_dst,
+ u16 *original_dst_port);
typedef struct session_main_
{
@@ -281,6 +285,9 @@ typedef struct session_main_
u32 preallocated_sessions;
u16 msg_id_base;
+
+ /** Query nat44-ed session to get original dst ip4 & dst port. */
+ nat44_original_dst_lookup_fn original_dst_lookup;
} session_main_t;
extern session_main_t session_main;
@@ -812,6 +819,10 @@ void session_wrk_handle_evts_main_rpc (void *);
session_t *session_alloc_for_connection (transport_connection_t * tc);
session_t *session_alloc_for_half_open (transport_connection_t *tc);
+void session_get_original_dst (transport_endpoint_t *i2o_src,
+ transport_endpoint_t *i2o_dst,
+ transport_proto_t transport_proto,
+ u32 *original_dst, u16 *original_dst_port);
typedef void (pool_safe_realloc_rpc_fn) (void *rpc_args);