summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vnet/udp/udp.c7
-rw-r--r--src/vnet/udp/udp.h1
-rw-r--r--src/vnet/udp/udp_cli.c5
-rw-r--r--src/vnet/udp/udp_input.c2
4 files changed, 11 insertions, 4 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 43391f9f4e5..9b2ed886d0f 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -185,7 +185,8 @@ udp_session_bind (u32 session_index, transport_endpoint_cfg_t *lcl)
listener->c_proto = TRANSPORT_PROTO_UDP;
listener->c_s_index = session_index;
listener->c_fib_index = lcl->fib_index;
- listener->mss = udp_default_mtu (um, listener->c_is_ip4);
+ listener->mss =
+ lcl->mss ? lcl->mss : udp_default_mtu (um, listener->c_is_ip4);
listener->flags |= UDP_CONN_F_OWNS_PORT | UDP_CONN_F_LISTEN;
lcl_ext = (transport_endpoint_cfg_t *) lcl;
if (lcl_ext->transport_flags & TRANSPORT_CFG_F_CONNECTED)
@@ -232,7 +233,7 @@ udp_push_one_header (vlib_main_t *vm, udp_connection_t *uc, vlib_buffer_t *b)
else
vlib_buffer_push_ip6 (vm, b, &uc->c_lcl_ip6, &uc->c_rmt_ip6,
IP_PROTOCOL_UDP);
- vnet_buffer (b)->sw_if_index[VLIB_RX] = 0;
+ vnet_buffer (b)->sw_if_index[VLIB_RX] = uc->sw_if_index;
vnet_buffer (b)->sw_if_index[VLIB_TX] = uc->c_fib_index;
b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
@@ -399,6 +400,8 @@ conn_alloc:
uc->c_fib_index = rmt->fib_index;
uc->c_dscp = rmt->dscp;
uc->mss = rmt->mss ? rmt->mss : udp_default_mtu (um, uc->c_is_ip4);
+ if (rmt->peer.sw_if_index != ENDPOINT_INVALID_INDEX)
+ uc->sw_if_index = rmt->peer.sw_if_index;
uc->flags |= UDP_CONN_F_OWNS_PORT;
if (rmt->transport_flags & TRANSPORT_CFG_F_CONNECTED)
{
diff --git a/src/vnet/udp/udp.h b/src/vnet/udp/udp.h
index 92bcd1c44e7..d51805099ce 100644
--- a/src/vnet/udp/udp.h
+++ b/src/vnet/udp/udp.h
@@ -63,6 +63,7 @@ typedef struct
clib_spinlock_t rx_lock; /**< rx fifo lock */
u8 flags; /**< connection flags */
u16 mss; /**< connection mss */
+ u32 sw_if_index; /**< connection sw_if_index */
} udp_connection_t;
typedef struct
diff --git a/src/vnet/udp/udp_cli.c b/src/vnet/udp/udp_cli.c
index 3b7bb380c89..9787eedf933 100644
--- a/src/vnet/udp/udp_cli.c
+++ b/src/vnet/udp/udp_cli.c
@@ -67,11 +67,12 @@ static u8 *
format_udp_vars (u8 * s, va_list * args)
{
udp_connection_t *uc = va_arg (*args, udp_connection_t *);
+
s = format (s, " index %u flags: %U", uc->c_c_index,
format_udp_connection_flags, uc);
-
if (!(uc->flags & UDP_CONN_F_LISTEN))
- s = format (s, "\n");
+ s = format (s, " \n sw_if_index: %d, mss: %u\n", uc->sw_if_index, uc->mss);
+
return s;
}
diff --git a/src/vnet/udp/udp_input.c b/src/vnet/udp/udp_input.c
index f6c55f6722e..c11c0d51214 100644
--- a/src/vnet/udp/udp_input.c
+++ b/src/vnet/udp/udp_input.c
@@ -255,6 +255,7 @@ udp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{
u8 queue_event = 1;
uc0 = udp_connection_from_transport (session_get_transport (s0));
+ uc0->sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_RX];
if (uc0->flags & UDP_CONN_F_CONNECTED)
{
if (s0->thread_index != thread_index)
@@ -298,6 +299,7 @@ udp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
goto done;
}
s0 = session_get (uc0->c_s_index, uc0->c_thread_index);
+ uc0->sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_RX];
error0 = UDP_ERROR_ACCEPT;
}
udp_connection_enqueue (uc0, s0, &hdr0, thread_index, b[0], 1,