tcp: fix use of invalid local sw_if_index

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Id58ac44d45fb8b8a0d803f02e0242ec6f4b3db05
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 4825bf6..d4b1d77 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -837,7 +837,8 @@
   /* The other connection vars will be initialized after SYN ACK */
   tcp_connection_timers_init (tc);
   tc->mss = rmt->mss;
-  tc->sw_if_index = rmt->peer.sw_if_index;
+  if (rmt->peer.sw_if_index != ENDPOINT_INVALID_INDEX)
+    tc->sw_if_index = rmt->peer.sw_if_index;
   tc->next_node_index = rmt->next_node_index;
   tc->next_node_opaque = rmt->next_node_opaque;