aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXiaoming Jiang <jiangxiaoming@outlook.com>2022-08-11 15:04:48 +0000
committerXiaoming Jiang <jiangxiaoming@outlook.com>2022-08-11 15:13:51 +0000
commit30be19ce98e539142288a6e18cae9fea1bf0536f (patch)
treea081088b7c459f188cf9590e7dc04d60847b3156 /src
parent41a85c0a263302d8a9e9cf758d6b259aaf957c49 (diff)
ip: only set rx_sw_if_index when connection found to avoid following crash like tcp punt
Type: fix Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com> Change-Id: I894a881cec1888b392d26fdfb385f97c31113ef1
Diffstat (limited to 'src')
-rw-r--r--src/vnet/tcp/tcp_inlines.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/vnet/tcp/tcp_inlines.h b/src/vnet/tcp/tcp_inlines.h
index d57b3059066..69f8ce7ff27 100644
--- a/src/vnet/tcp/tcp_inlines.h
+++ b/src/vnet/tcp/tcp_inlines.h
@@ -237,10 +237,6 @@ tcp_input_lookup_buffer (vlib_buffer_t * b, u8 thread_index, u32 * error,
tcp_header_t *tcp;
u8 result = 0;
- /* Set the sw_if_index[VLIB_RX] to the interface we received
- * the connection on (the local interface) */
- vnet_buffer (b)->sw_if_index[VLIB_RX] = vnet_buffer (b)->ip.rx_sw_if_index;
-
if (is_ip4)
{
ip4_header_t *ip4 = vlib_buffer_get_current (b);
@@ -297,7 +293,7 @@ tcp_input_lookup_buffer (vlib_buffer_t * b, u8 thread_index, u32 * error,
{
ip6_main_t *im = &ip6_main;
fib_index = vec_elt (im->fib_index_by_sw_if_index,
- vnet_buffer (b)->sw_if_index[VLIB_RX]);
+ vnet_buffer (b)->ip.rx_sw_if_index);
}
tc = session_lookup_connection_wt6 (fib_index, &ip6->dst_address,
@@ -308,6 +304,10 @@ tcp_input_lookup_buffer (vlib_buffer_t * b, u8 thread_index, u32 * error,
}
}
+ /* Set the sw_if_index[VLIB_RX] to the interface we received
+ * the connection on (the local interface) */
+ vnet_buffer (b)->sw_if_index[VLIB_RX] = vnet_buffer (b)->ip.rx_sw_if_index;
+
if (is_nolookup)
tc =
(transport_connection_t *) tcp_connection_get (vnet_buffer (b)->