tcp: set sw_if_index in tcp src-address cli 99/34799/2
authorMercury <mercury124185@gmail.com>
Fri, 24 Dec 2021 03:58:27 +0000 (11:58 +0800)
committerFlorin Coras <florin.coras@gmail.com>
Sun, 26 Dec 2021 23:13:40 +0000 (23:13 +0000)
the receive dpo added by tcp src-address cli do not have a valid sw_if_index ,
ip4_local_check_src() and tcp_input_lookup_buffer() will set ~0 to vnet_buffer(b)->sw_if_index[VLIB_RX],
which will cause crash in tcp46_reset_inline,

Type: fix
Signed-off-by: Mercury <mercury124185@gmail.com>
Change-Id: Ie01c31f3575e14187c6380ebcfff96fcb6098cde

src/vnet/tcp/tcp_cli.c

index c9d6c6f..f7d26ff 100644 (file)
@@ -433,7 +433,7 @@ tcp_configure_v4_source_address_range (vlib_main_t * vm,
 
       /* Add local adjacencies for the range */
 
-      receive_dpo_add_or_lock (DPO_PROTO_IP4, ~0 /* sw_if_index */ ,
+      receive_dpo_add_or_lock (DPO_PROTO_IP4, sw_if_index /* sw_if_index */,
                               NULL, &dpo);
       prefix.fp_len = 32;
       prefix.fp_proto = FIB_PROTOCOL_IP4;
@@ -508,7 +508,7 @@ tcp_configure_v6_source_address_range (vlib_main_t * vm,
       ip6_neighbor_proxy_add (sw_if_index, start);
 
       /* Add a receive adjacency for this address */
-      receive_dpo_add_or_lock (DPO_PROTO_IP6, ~0 /* sw_if_index */ ,
+      receive_dpo_add_or_lock (DPO_PROTO_IP6, sw_if_index /* sw_if_index */,
                               NULL, &dpo);
 
       fib_table_entry_special_dpo_update (fib_index,