tcp: fix listen node coverity warning 63/24363/3
authorFlorin Coras <fcoras@cisco.com>
Thu, 16 Jan 2020 04:04:54 +0000 (04:04 +0000)
committerDave Barach <openvpp@barachs.net>
Thu, 16 Jan 2020 15:17:17 +0000 (15:17 +0000)
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: If5ec3ec4f46d3840c2b3c3005f093b5dddefc289

src/vnet/tcp/tcp_input.c

index cf74fb9..59b0104 100755 (executable)
@@ -3221,6 +3221,18 @@ tcp46_listen_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
       n_left_from -= 1;
 
       b0 = vlib_get_buffer (vm, bi0);
+
+      if (is_ip4)
+       {
+         ip40 = vlib_buffer_get_current (b0);
+         th0 = tcp_buffer_hdr (b0);
+       }
+      else
+       {
+         ip60 = vlib_buffer_get_current (b0);
+         th0 = tcp_buffer_hdr (b0);
+       }
+
       lc0 = tcp_listener_get (vnet_buffer (b0)->tcp.connection_index);
       if (PREDICT_FALSE (lc0 == 0))
        {
@@ -3236,17 +3248,6 @@ tcp46_listen_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          tcp_connection_del (tc0);
        }
 
-      if (is_ip4)
-       {
-         ip40 = vlib_buffer_get_current (b0);
-         th0 = tcp_buffer_hdr (b0);
-       }
-      else
-       {
-         ip60 = vlib_buffer_get_current (b0);
-         th0 = tcp_buffer_hdr (b0);
-       }
-
       /* Create child session. For syn-flood protection use filter */
 
       /* 1. first check for an RST: handled in dispatch */