2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vnet/tcp/tcp.h>
17 #include <vnet/lisp-cp/packets.h>
19 vlib_node_registration_t tcp4_output_node;
20 vlib_node_registration_t tcp6_output_node;
22 typedef enum _tcp_output_nect
25 TCP_OUTPUT_NEXT_IP_LOOKUP,
29 #define foreach_tcp4_output_next \
30 _ (DROP, "error-drop") \
31 _ (IP_LOOKUP, "ip4-lookup")
33 #define foreach_tcp6_output_next \
34 _ (DROP, "error-drop") \
35 _ (IP_LOOKUP, "ip6-lookup")
37 static char *tcp_error_strings[] = {
38 #define tcp_error(n,s) s,
39 #include <vnet/tcp/tcp_error.def>
53 format_tcp_tx_trace (u8 * s, va_list * args)
55 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
56 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
58 s = format (s, "TBD\n");
64 tcp_set_snd_mss (tcp_connection_t * tc)
68 /* TODO find our iface MTU */
71 /* TODO cache mss and consider PMTU discovery */
72 snd_mss = tc->opt.mss < snd_mss ? tc->opt.mss : snd_mss;
74 tc->snd_mss = snd_mss;
78 clib_warning ("snd mss is 0");
79 tc->snd_mss = dummy_mtu;
84 tcp_window_compute_scale (u32 available_space)
87 while (wnd_scale < TCP_MAX_WND_SCALE
88 && (available_space >> wnd_scale) > TCP_WND_MAX)
94 * TCP's IW as recommended by RFC6928
97 tcp_initial_wnd_unscaled (tcp_connection_t * tc)
99 return TCP_IW_N_SEGMENTS * dummy_mtu;
103 * Compute initial window and scale factor. As per RFC1323, window field in
104 * SYN and SYN-ACK segments is never scaled.
107 tcp_initial_window_to_advertise (tcp_connection_t * tc)
111 /* Initial wnd for SYN. Fifos are not allocated yet.
112 * Use some predefined value. For SYN-ACK we still want the
113 * scale to be computed in the same way */
114 max_fifo = TCP_MAX_RX_FIFO_SIZE;
116 tc->rcv_wscale = tcp_window_compute_scale (max_fifo);
117 tc->rcv_wnd = tcp_initial_wnd_unscaled (tc);
119 return clib_min (tc->rcv_wnd, TCP_WND_MAX);
123 * Compute and return window to advertise, scaled as per RFC1323
126 tcp_window_to_advertise (tcp_connection_t * tc, tcp_state_t state)
128 if (state < TCP_STATE_ESTABLISHED)
129 return tcp_initial_window_to_advertise (tc);
131 tcp_update_rcv_wnd (tc);
133 if (tc->rcv_wnd == 0)
135 tc->flags |= TCP_CONN_SENT_RCV_WND0;
139 tc->flags &= ~TCP_CONN_SENT_RCV_WND0;
142 return tc->rcv_wnd >> tc->rcv_wscale;
146 tcp_update_rcv_wnd (tcp_connection_t * tc)
149 u32 available_space, max_fifo, wnd;
152 * Figure out how much space we have available
154 available_space = stream_session_max_rx_enqueue (&tc->connection);
155 max_fifo = stream_session_fifo_size (&tc->connection);
157 ASSERT (tc->opt.mss < max_fifo);
158 if (available_space < tc->opt.mss && available_space < max_fifo >> 3)
162 * Use the above and what we know about what we've previously advertised
163 * to compute the new window
165 observed_wnd = (i32) tc->rcv_wnd - (tc->rcv_nxt - tc->rcv_las);
166 if (observed_wnd < 0)
169 /* Bad. Thou shalt not shrink */
170 if (available_space < observed_wnd)
173 TCP_EVT_DBG (TCP_EVT_RCV_WND_SHRUNK, tc, observed_wnd, available_space);
177 wnd = available_space;
180 /* Make sure we have a multiple of rcv_wscale */
181 if (wnd && tc->rcv_wscale)
183 wnd &= ~(1 << tc->rcv_wscale);
185 wnd = 1 << tc->rcv_wscale;
188 tc->rcv_wnd = clib_min (wnd, TCP_WND_MAX << tc->rcv_wscale);
192 * Write TCP options to segment.
195 tcp_options_write (u8 * data, tcp_options_t * opts)
198 u32 buf, seq_len = 4;
200 if (tcp_opts_mss (opts))
202 *data++ = TCP_OPTION_MSS;
203 *data++ = TCP_OPTION_LEN_MSS;
204 buf = clib_host_to_net_u16 (opts->mss);
205 clib_memcpy (data, &buf, sizeof (opts->mss));
206 data += sizeof (opts->mss);
207 opts_len += TCP_OPTION_LEN_MSS;
210 if (tcp_opts_wscale (opts))
212 *data++ = TCP_OPTION_WINDOW_SCALE;
213 *data++ = TCP_OPTION_LEN_WINDOW_SCALE;
214 *data++ = opts->wscale;
215 opts_len += TCP_OPTION_LEN_WINDOW_SCALE;
218 if (tcp_opts_sack_permitted (opts))
220 *data++ = TCP_OPTION_SACK_PERMITTED;
221 *data++ = TCP_OPTION_LEN_SACK_PERMITTED;
222 opts_len += TCP_OPTION_LEN_SACK_PERMITTED;
225 if (tcp_opts_tstamp (opts))
227 *data++ = TCP_OPTION_TIMESTAMP;
228 *data++ = TCP_OPTION_LEN_TIMESTAMP;
229 buf = clib_host_to_net_u32 (opts->tsval);
230 clib_memcpy (data, &buf, sizeof (opts->tsval));
231 data += sizeof (opts->tsval);
232 buf = clib_host_to_net_u32 (opts->tsecr);
233 clib_memcpy (data, &buf, sizeof (opts->tsecr));
234 data += sizeof (opts->tsecr);
235 opts_len += TCP_OPTION_LEN_TIMESTAMP;
238 if (tcp_opts_sack (opts))
241 u32 n_sack_blocks = clib_min (vec_len (opts->sacks),
242 TCP_OPTS_MAX_SACK_BLOCKS);
244 if (n_sack_blocks != 0)
246 *data++ = TCP_OPTION_SACK_BLOCK;
247 *data++ = 2 + n_sack_blocks * TCP_OPTION_LEN_SACK_BLOCK;
248 for (i = 0; i < n_sack_blocks; i++)
250 buf = clib_host_to_net_u32 (opts->sacks[i].start);
251 clib_memcpy (data, &buf, seq_len);
253 buf = clib_host_to_net_u32 (opts->sacks[i].end);
254 clib_memcpy (data, &buf, seq_len);
257 opts_len += 2 + n_sack_blocks * TCP_OPTION_LEN_SACK_BLOCK;
261 /* Terminate TCP options */
264 *data++ = TCP_OPTION_EOL;
265 opts_len += TCP_OPTION_LEN_EOL;
268 /* Pad with zeroes to a u32 boundary */
271 *data++ = TCP_OPTION_NOOP;
272 opts_len += TCP_OPTION_LEN_NOOP;
278 tcp_make_syn_options (tcp_options_t * opts, u8 wnd_scale)
282 opts->flags |= TCP_OPTS_FLAG_MSS;
283 opts->mss = dummy_mtu; /*XXX discover that */
284 len += TCP_OPTION_LEN_MSS;
286 opts->flags |= TCP_OPTS_FLAG_WSCALE;
287 opts->wscale = wnd_scale;
288 len += TCP_OPTION_LEN_WINDOW_SCALE;
290 opts->flags |= TCP_OPTS_FLAG_TSTAMP;
291 opts->tsval = tcp_time_now ();
293 len += TCP_OPTION_LEN_TIMESTAMP;
295 opts->flags |= TCP_OPTS_FLAG_SACK_PERMITTED;
296 len += TCP_OPTION_LEN_SACK_PERMITTED;
298 /* Align to needed boundary */
299 len += (TCP_OPTS_ALIGN - len % TCP_OPTS_ALIGN) % TCP_OPTS_ALIGN;
304 tcp_make_synack_options (tcp_connection_t * tc, tcp_options_t * opts)
308 opts->flags |= TCP_OPTS_FLAG_MSS;
309 opts->mss = dummy_mtu; /*XXX discover that */
310 len += TCP_OPTION_LEN_MSS;
312 if (tcp_opts_wscale (&tc->opt))
314 opts->flags |= TCP_OPTS_FLAG_WSCALE;
315 opts->wscale = tc->rcv_wscale;
316 len += TCP_OPTION_LEN_WINDOW_SCALE;
319 if (tcp_opts_tstamp (&tc->opt))
321 opts->flags |= TCP_OPTS_FLAG_TSTAMP;
322 opts->tsval = tcp_time_now ();
323 opts->tsecr = tc->tsval_recent;
324 len += TCP_OPTION_LEN_TIMESTAMP;
327 if (tcp_opts_sack_permitted (&tc->opt))
329 opts->flags |= TCP_OPTS_FLAG_SACK_PERMITTED;
330 len += TCP_OPTION_LEN_SACK_PERMITTED;
333 /* Align to needed boundary */
334 len += (TCP_OPTS_ALIGN - len % TCP_OPTS_ALIGN) % TCP_OPTS_ALIGN;
339 tcp_make_established_options (tcp_connection_t * tc, tcp_options_t * opts)
345 if (tcp_opts_tstamp (&tc->opt))
347 opts->flags |= TCP_OPTS_FLAG_TSTAMP;
348 opts->tsval = tcp_time_now ();
349 opts->tsecr = tc->tsval_recent;
350 len += TCP_OPTION_LEN_TIMESTAMP;
352 if (tcp_opts_sack_permitted (&tc->opt))
354 if (vec_len (tc->snd_sacks))
356 opts->flags |= TCP_OPTS_FLAG_SACK;
357 opts->sacks = tc->snd_sacks;
358 opts->n_sack_blocks = vec_len (tc->snd_sacks);
359 len += 2 + TCP_OPTION_LEN_SACK_BLOCK * opts->n_sack_blocks;
363 /* Align to needed boundary */
364 len += (TCP_OPTS_ALIGN - len % TCP_OPTS_ALIGN) % TCP_OPTS_ALIGN;
369 tcp_make_options (tcp_connection_t * tc, tcp_options_t * opts,
374 case TCP_STATE_ESTABLISHED:
375 case TCP_STATE_FIN_WAIT_1:
376 return tcp_make_established_options (tc, opts);
377 case TCP_STATE_SYN_RCVD:
378 return tcp_make_synack_options (tc, opts);
379 case TCP_STATE_SYN_SENT:
380 return tcp_make_syn_options (opts, tc->rcv_wscale);
382 clib_warning ("Not handled!");
387 #define tcp_get_free_buffer_index(tm, bidx) \
389 u32 *my_tx_buffers, n_free_buffers; \
390 u32 thread_index = vlib_get_thread_index(); \
391 my_tx_buffers = tm->tx_buffers[thread_index]; \
392 if (PREDICT_FALSE(vec_len (my_tx_buffers) == 0)) \
394 n_free_buffers = 32; /* TODO config or macro */ \
395 vec_validate (my_tx_buffers, n_free_buffers - 1); \
396 _vec_len(my_tx_buffers) = vlib_buffer_alloc_from_free_list ( \
397 tm->vlib_main, my_tx_buffers, n_free_buffers, \
398 VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX); \
399 tm->tx_buffers[thread_index] = my_tx_buffers; \
401 /* buffer shortage */ \
402 if (PREDICT_FALSE (vec_len (my_tx_buffers) == 0)) \
404 *bidx = my_tx_buffers[_vec_len (my_tx_buffers)-1]; \
405 _vec_len (my_tx_buffers) -= 1; \
408 #define tcp_return_buffer(tm) \
410 u32 *my_tx_buffers; \
411 u32 thread_index = vlib_get_thread_index(); \
412 my_tx_buffers = tm->tx_buffers[thread_index]; \
413 _vec_len (my_tx_buffers) +=1; \
417 tcp_reuse_buffer (vlib_main_t * vm, vlib_buffer_t * b)
419 vlib_buffer_t *it = b;
422 it->current_data = 0;
423 it->current_length = 0;
424 it->total_length_not_including_first_buffer = 0;
426 while ((it->flags & VLIB_BUFFER_NEXT_PRESENT)
427 && (it = vlib_get_buffer (vm, it->next_buffer)));
429 /* Leave enough space for headers */
430 vlib_buffer_make_headroom (b, MAX_HDRS_LEN);
431 vnet_buffer (b)->tcp.flags = 0;
438 tcp_make_ack_i (tcp_connection_t * tc, vlib_buffer_t * b, tcp_state_t state,
441 tcp_options_t _snd_opts, *snd_opts = &_snd_opts;
442 u8 tcp_opts_len, tcp_hdr_opts_len;
446 wnd = tcp_window_to_advertise (tc, state);
448 /* Make and write options */
449 tcp_opts_len = tcp_make_established_options (tc, snd_opts);
450 tcp_hdr_opts_len = tcp_opts_len + sizeof (tcp_header_t);
452 th = vlib_buffer_push_tcp (b, tc->c_lcl_port, tc->c_rmt_port, tc->snd_nxt,
453 tc->rcv_nxt, tcp_hdr_opts_len, flags, wnd);
455 tcp_options_write ((u8 *) (th + 1), snd_opts);
456 vnet_buffer (b)->tcp.connection_index = tc->c_c_index;
460 * Convert buffer to ACK
463 tcp_make_ack (tcp_connection_t * tc, vlib_buffer_t * b)
465 vlib_main_t *vm = vlib_get_main ();
467 tcp_reuse_buffer (vm, b);
468 tcp_make_ack_i (tc, b, TCP_STATE_ESTABLISHED, TCP_FLAG_ACK);
469 TCP_EVT_DBG (TCP_EVT_ACK_SENT, tc);
470 vnet_buffer (b)->tcp.flags = TCP_BUF_FLAG_ACK;
471 tc->rcv_las = tc->rcv_nxt;
475 * Convert buffer to FIN-ACK
478 tcp_make_fin (tcp_connection_t * tc, vlib_buffer_t * b)
480 vlib_main_t *vm = vlib_get_main ();
483 tcp_reuse_buffer (vm, b);
485 flags = TCP_FLAG_FIN | TCP_FLAG_ACK;
486 tcp_make_ack_i (tc, b, TCP_STATE_ESTABLISHED, flags);
488 /* Reset flags, make sure ack is sent */
489 vnet_buffer (b)->tcp.flags &= ~TCP_BUF_FLAG_DUPACK;
495 * Convert buffer to SYN-ACK
498 tcp_make_synack (tcp_connection_t * tc, vlib_buffer_t * b)
500 vlib_main_t *vm = vlib_get_main ();
501 tcp_options_t _snd_opts, *snd_opts = &_snd_opts;
502 u8 tcp_opts_len, tcp_hdr_opts_len;
507 memset (snd_opts, 0, sizeof (*snd_opts));
509 tcp_reuse_buffer (vm, b);
511 /* Set random initial sequence */
512 time_now = tcp_time_now ();
514 tc->iss = random_u32 (&time_now);
515 tc->snd_una = tc->iss;
516 tc->snd_nxt = tc->iss + 1;
517 tc->snd_una_max = tc->snd_nxt;
519 initial_wnd = tcp_initial_window_to_advertise (tc);
521 /* Make and write options */
522 tcp_opts_len = tcp_make_synack_options (tc, snd_opts);
523 tcp_hdr_opts_len = tcp_opts_len + sizeof (tcp_header_t);
525 th = vlib_buffer_push_tcp (b, tc->c_lcl_port, tc->c_rmt_port, tc->iss,
526 tc->rcv_nxt, tcp_hdr_opts_len,
527 TCP_FLAG_SYN | TCP_FLAG_ACK, initial_wnd);
529 tcp_options_write ((u8 *) (th + 1), snd_opts);
531 vnet_buffer (b)->tcp.connection_index = tc->c_c_index;
532 vnet_buffer (b)->tcp.flags = TCP_BUF_FLAG_ACK;
534 /* Init retransmit timer */
535 tcp_retransmit_timer_set (tc);
539 tcp_enqueue_to_ip_lookup (vlib_main_t * vm, vlib_buffer_t * b, u32 bi,
542 u32 *to_next, next_index;
545 b->flags |= VNET_BUFFER_LOCALLY_ORIGINATED;
548 /* Default FIB for now */
549 vnet_buffer (b)->sw_if_index[VLIB_TX] = 0;
551 /* Send to IP lookup */
552 next_index = is_ip4 ? ip4_lookup_node.index : ip6_lookup_node.index;
553 f = vlib_get_frame_to_node (vm, next_index);
555 /* Enqueue the packet */
556 to_next = vlib_frame_vector_args (f);
559 vlib_put_frame_to_node (vm, next_index, f);
563 tcp_make_reset_in_place (vlib_main_t * vm, vlib_buffer_t * b0,
564 tcp_state_t state, u32 my_thread_index, u8 is_ip4)
566 u8 tcp_hdr_len = sizeof (tcp_header_t);
570 ip4_address_t src_ip40;
571 ip6_address_t src_ip60;
575 /* Find IP and TCP headers */
578 ih4 = vlib_buffer_get_current (b0);
579 th0 = ip4_next_header (ih4);
583 ih6 = vlib_buffer_get_current (b0);
584 th0 = ip6_next_header (ih6);
587 /* Swap src and dst ip */
590 ASSERT ((ih4->ip_version_and_header_length & 0xF0) == 0x40);
591 src_ip40.as_u32 = ih4->src_address.as_u32;
592 ih4->src_address.as_u32 = ih4->dst_address.as_u32;
593 ih4->dst_address.as_u32 = src_ip40.as_u32;
595 /* Chop the end of the pkt */
596 b0->current_length += ip4_header_bytes (ih4) + tcp_hdr_len;
600 ASSERT ((ih6->ip_version_traffic_class_and_flow_label & 0xF0) == 0x60);
601 clib_memcpy (&src_ip60, &ih6->src_address, sizeof (ip6_address_t));
602 clib_memcpy (&ih6->src_address, &ih6->dst_address,
603 sizeof (ip6_address_t));
604 clib_memcpy (&ih6->dst_address, &src_ip60, sizeof (ip6_address_t));
606 /* Chop the end of the pkt */
607 b0->current_length += sizeof (ip6_header_t) + tcp_hdr_len;
610 /* Try to determine what/why we're actually resetting and swap
611 * src and dst ports */
612 if (state == TCP_STATE_CLOSED)
617 tmp = clib_net_to_host_u32 (th0->seq_number);
619 /* Got a SYN for no listener. */
620 th0->flags = TCP_FLAG_RST | TCP_FLAG_ACK;
621 th0->ack_number = clib_host_to_net_u32 (tmp + 1);
625 else if (state >= TCP_STATE_SYN_SENT)
627 th0->flags = TCP_FLAG_RST | TCP_FLAG_ACK;
628 th0->seq_number = th0->ack_number;
632 src_port0 = th0->src_port;
633 th0->src_port = th0->dst_port;
634 th0->dst_port = src_port0;
636 th0->data_offset_and_reserved = (tcp_hdr_len >> 2) << 4;
637 th0->urgent_pointer = 0;
639 /* Compute checksum */
642 th0->checksum = ip4_tcp_udp_compute_checksum (vm, b0, ih4);
647 th0->checksum = ip6_tcp_udp_icmp_compute_checksum (vm, b0, ih6, &bogus);
655 * Send reset without reusing existing buffer
658 tcp_send_reset (vlib_buffer_t * pkt, u8 is_ip4)
662 tcp_main_t *tm = vnet_get_tcp_main ();
663 vlib_main_t *vm = vlib_get_main ();
664 u8 tcp_hdr_len, flags = 0;
665 tcp_header_t *th, *pkt_th;
667 ip4_header_t *ih4, *pkt_ih4;
668 ip6_header_t *ih6, *pkt_ih6;
670 tcp_get_free_buffer_index (tm, &bi);
671 b = vlib_get_buffer (vm, bi);
673 /* Leave enough space for headers */
674 vlib_buffer_make_headroom (b, MAX_HDRS_LEN);
676 /* Make and write options */
677 tcp_hdr_len = sizeof (tcp_header_t);
681 pkt_ih4 = vlib_buffer_get_current (pkt);
682 pkt_th = ip4_next_header (pkt_ih4);
686 pkt_ih6 = vlib_buffer_get_current (pkt);
687 pkt_th = ip6_next_header (pkt_ih6);
690 if (tcp_ack (pkt_th))
692 flags = TCP_FLAG_RST;
693 seq = pkt_th->ack_number;
698 flags = TCP_FLAG_RST | TCP_FLAG_ACK;
700 ack = clib_host_to_net_u32 (vnet_buffer (pkt)->tcp.seq_end);
703 th = vlib_buffer_push_tcp_net_order (b, pkt_th->dst_port, pkt_th->src_port,
704 seq, ack, tcp_hdr_len, flags, 0);
706 /* Swap src and dst ip */
709 ASSERT ((pkt_ih4->ip_version_and_header_length & 0xF0) == 0x40);
710 ih4 = vlib_buffer_push_ip4 (vm, b, &pkt_ih4->dst_address,
711 &pkt_ih4->src_address, IP_PROTOCOL_TCP);
712 th->checksum = ip4_tcp_udp_compute_checksum (vm, b, ih4);
717 pkt_ih6 = (ip6_header_t *) (pkt_th - 1);
718 ASSERT ((pkt_ih6->ip_version_traffic_class_and_flow_label & 0xF0) ==
721 vlib_buffer_push_ip6 (vm, b, &pkt_ih6->dst_address,
722 &pkt_ih6->src_address, IP_PROTOCOL_TCP);
723 th->checksum = ip6_tcp_udp_icmp_compute_checksum (vm, b, ih6, &bogus);
727 tcp_enqueue_to_ip_lookup (vm, b, bi, is_ip4);
731 tcp_push_ip_hdr (tcp_main_t * tm, tcp_connection_t * tc, vlib_buffer_t * b)
733 tcp_header_t *th = vlib_buffer_get_current (b);
738 ih = vlib_buffer_push_ip4 (tm->vlib_main, b, &tc->c_lcl_ip4,
739 &tc->c_rmt_ip4, IP_PROTOCOL_TCP);
740 th->checksum = ip4_tcp_udp_compute_checksum (tm->vlib_main, b, ih);
747 ih = vlib_buffer_push_ip6 (tm->vlib_main, b, &tc->c_lcl_ip6,
748 &tc->c_rmt_ip6, IP_PROTOCOL_TCP);
749 th->checksum = ip6_tcp_udp_icmp_compute_checksum (tm->vlib_main, b, ih,
758 * Builds a SYN packet for a half-open connection and sends it to ipx_lookup.
759 * The packet is not forwarded through tcpx_output to avoid doing lookups
760 * in the half_open pool.
763 tcp_send_syn (tcp_connection_t * tc)
767 tcp_main_t *tm = vnet_get_tcp_main ();
768 vlib_main_t *vm = vlib_get_main ();
769 u8 tcp_hdr_opts_len, tcp_opts_len;
773 tcp_options_t snd_opts;
775 tcp_get_free_buffer_index (tm, &bi);
776 b = vlib_get_buffer (vm, bi);
778 /* Leave enough space for headers */
779 vlib_buffer_make_headroom (b, MAX_HDRS_LEN);
781 /* Set random initial sequence */
782 time_now = tcp_time_now ();
784 tc->iss = random_u32 (&time_now);
785 tc->snd_una = tc->iss;
786 tc->snd_una_max = tc->snd_nxt = tc->iss + 1;
788 initial_wnd = tcp_initial_window_to_advertise (tc);
790 /* Make and write options */
791 memset (&snd_opts, 0, sizeof (snd_opts));
792 tcp_opts_len = tcp_make_syn_options (&snd_opts, tc->rcv_wscale);
793 tcp_hdr_opts_len = tcp_opts_len + sizeof (tcp_header_t);
795 th = vlib_buffer_push_tcp (b, tc->c_lcl_port, tc->c_rmt_port, tc->iss,
796 tc->rcv_nxt, tcp_hdr_opts_len, TCP_FLAG_SYN,
799 tcp_options_write ((u8 *) (th + 1), &snd_opts);
801 /* Measure RTT with this */
802 tc->rtt_ts = tcp_time_now ();
803 tc->rtt_seq = tc->snd_nxt;
805 /* Start retransmit trimer */
806 tcp_timer_set (tc, TCP_TIMER_RETRANSMIT_SYN, tc->rto * TCP_TO_TIMER_TICK);
809 /* Set the connection establishment timer */
810 tcp_timer_set (tc, TCP_TIMER_ESTABLISH, TCP_ESTABLISH_TIME);
812 tcp_push_ip_hdr (tm, tc, b);
813 tcp_enqueue_to_ip_lookup (vm, b, bi, tc->c_is_ip4);
817 tcp_enqueue_to_output (vlib_main_t * vm, vlib_buffer_t * b, u32 bi, u8 is_ip4)
819 u32 *to_next, next_index;
822 b->flags |= VNET_BUFFER_LOCALLY_ORIGINATED;
825 /* Decide where to send the packet */
826 next_index = is_ip4 ? tcp4_output_node.index : tcp6_output_node.index;
828 /* Enqueue the packet */
829 f = vlib_get_frame_to_node (vm, next_index);
830 to_next = vlib_frame_vector_args (f);
833 vlib_put_frame_to_node (vm, next_index, f);
840 tcp_send_fin (tcp_connection_t * tc)
844 tcp_main_t *tm = vnet_get_tcp_main ();
845 vlib_main_t *vm = vlib_get_main ();
847 tcp_get_free_buffer_index (tm, &bi);
848 b = vlib_get_buffer (vm, bi);
850 /* Leave enough space for headers */
851 vlib_buffer_make_headroom (b, MAX_HDRS_LEN);
853 tcp_make_fin (tc, b);
854 tcp_enqueue_to_output (vm, b, bi, tc->c_is_ip4);
855 tc->flags |= TCP_CONN_FINSNT;
856 TCP_EVT_DBG (TCP_EVT_FIN_SENT, tc);
860 tcp_make_state_flags (tcp_state_t next_state)
864 case TCP_STATE_ESTABLISHED:
866 case TCP_STATE_SYN_RCVD:
867 return TCP_FLAG_SYN | TCP_FLAG_ACK;
868 case TCP_STATE_SYN_SENT:
870 case TCP_STATE_LAST_ACK:
871 case TCP_STATE_FIN_WAIT_1:
874 clib_warning ("Shouldn't be here!");
880 * Push TCP header and update connection variables
883 tcp_push_hdr_i (tcp_connection_t * tc, vlib_buffer_t * b,
884 tcp_state_t next_state)
886 u32 advertise_wnd, data_len;
887 u8 tcp_opts_len, tcp_hdr_opts_len, opts_write_len, flags;
888 tcp_options_t _snd_opts, *snd_opts = &_snd_opts;
891 data_len = b->current_length;
892 vnet_buffer (b)->tcp.flags = 0;
894 /* Make and write options */
895 memset (snd_opts, 0, sizeof (*snd_opts));
896 tcp_opts_len = tcp_make_options (tc, snd_opts, next_state);
897 tcp_hdr_opts_len = tcp_opts_len + sizeof (tcp_header_t);
899 /* Get rcv window to advertise */
900 advertise_wnd = tcp_window_to_advertise (tc, next_state);
901 flags = tcp_make_state_flags (next_state);
903 /* Push header and options */
904 th = vlib_buffer_push_tcp (b, tc->c_lcl_port, tc->c_rmt_port, tc->snd_nxt,
905 tc->rcv_nxt, tcp_hdr_opts_len, flags,
908 opts_write_len = tcp_options_write ((u8 *) (th + 1), snd_opts);
910 ASSERT (opts_write_len == tcp_opts_len);
912 /* Tag the buffer with the connection index */
913 vnet_buffer (b)->tcp.connection_index = tc->c_c_index;
915 tc->snd_nxt += data_len;
917 /* TODO this is updated in output as well ... */
918 if (tc->snd_nxt > tc->snd_una_max)
919 tc->snd_una_max = tc->snd_nxt;
920 TCP_EVT_DBG (TCP_EVT_PKTIZE, tc);
924 tcp_send_ack (tcp_connection_t * tc)
926 tcp_main_t *tm = vnet_get_tcp_main ();
927 vlib_main_t *vm = vlib_get_main ();
933 tcp_get_free_buffer_index (tm, &bi);
934 b = vlib_get_buffer (vm, bi);
936 /* Fill in the ACK */
937 tcp_make_ack (tc, b);
938 tcp_enqueue_to_output (vm, b, bi, tc->c_is_ip4);
941 /* Send delayed ACK when timer expires */
943 tcp_timer_delack_handler (u32 index)
945 u32 thread_index = vlib_get_thread_index ();
946 tcp_connection_t *tc;
948 tc = tcp_connection_get (index, thread_index);
949 tc->timers[TCP_TIMER_DELACK] = TCP_TIMER_HANDLE_INVALID;
953 /** Build a retransmit segment
955 * @return the number of bytes in the segment or 0 if there's nothing to
959 tcp_prepare_retransmit_segment (tcp_connection_t * tc, vlib_buffer_t * b,
960 u32 offset, u32 max_bytes)
962 vlib_main_t *vm = vlib_get_main ();
965 tcp_reuse_buffer (vm, b);
967 ASSERT (tc->state >= TCP_STATE_ESTABLISHED);
968 ASSERT (max_bytes != 0);
970 max_bytes = clib_min (tc->snd_mss, max_bytes);
972 /* Start is beyond snd_congestion */
973 if (seq_geq (tc->snd_una + offset, tc->snd_congestion))
976 /* Don't overshoot snd_congestion */
977 if (seq_gt (tc->snd_nxt + max_bytes, tc->snd_congestion))
979 max_bytes = tc->snd_congestion - tc->snd_nxt;
984 ASSERT (max_bytes <= tc->snd_mss);
986 n_bytes = stream_session_peek_bytes (&tc->connection,
987 vlib_buffer_get_current (b), offset,
989 ASSERT (n_bytes != 0);
990 b->current_length = n_bytes;
991 tcp_push_hdr_i (tc, b, tc->state);
994 TCP_EVT_DBG (TCP_EVT_CC_RTX, tc, offset, n_bytes);
999 * Reset congestion control, switch cwnd to loss window and try again.
1002 tcp_rtx_timeout_cc (tcp_connection_t * tc)
1004 /* Cleanly recover cc (also clears up fast retransmit) */
1005 if (tcp_in_fastrecovery (tc))
1007 tcp_cc_recover (tc);
1011 tc->ssthresh = clib_max (tcp_flight_size (tc) / 2, 2 * tc->snd_mss);
1014 /* Start again from the beginning */
1015 tcp_recovery_on (tc);
1016 tc->cwnd = tcp_loss_wnd (tc);
1017 tc->snd_congestion = tc->snd_una_max;
1021 tcp_timer_retransmit_handler_i (u32 index, u8 is_syn)
1023 tcp_main_t *tm = vnet_get_tcp_main ();
1024 vlib_main_t *vm = vlib_get_main ();
1025 u32 thread_index = vlib_get_thread_index ();
1026 tcp_connection_t *tc;
1028 u32 bi, snd_space, n_bytes;
1032 tc = tcp_half_open_connection_get (index);
1036 tc = tcp_connection_get (index, thread_index);
1039 /* Make sure timer handle is set to invalid */
1040 tc->timers[TCP_TIMER_RETRANSMIT] = TCP_TIMER_HANDLE_INVALID;
1042 /* Increment RTO backoff (also equal to number of retries) */
1045 /* Go back to first un-acked byte */
1046 tc->snd_nxt = tc->snd_una;
1049 tcp_get_free_buffer_index (tm, &bi);
1050 b = vlib_get_buffer (vm, bi);
1052 if (tc->state >= TCP_STATE_ESTABLISHED)
1054 /* First retransmit timeout */
1055 if (tc->rto_boff == 1)
1056 tcp_rtx_timeout_cc (tc);
1058 /* Exponential backoff */
1059 tc->rto = clib_min (tc->rto << 1, TCP_RTO_MAX);
1061 /* Figure out what and how many bytes we can send */
1062 snd_space = tcp_available_snd_space (tc);
1064 TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 1);
1068 clib_warning ("no wnd to retransmit");
1069 tcp_return_buffer (tm);
1071 /* Force one segment */
1072 tcp_retransmit_first_unacked (tc);
1074 /* Re-enable retransmit timer. Output may be unwilling
1075 * to do it for us */
1076 tcp_retransmit_timer_set (tc);
1082 /* No fancy recovery for now! */
1083 n_bytes = tcp_prepare_retransmit_segment (tc, b, 0, snd_space);
1084 scoreboard_clear (&tc->sack_sb);
1089 tc->rtx_bytes += n_bytes;
1094 /* Retransmit for SYN/SYNACK */
1095 ASSERT (tc->state == TCP_STATE_SYN_RCVD
1096 || tc->state == TCP_STATE_SYN_SENT);
1098 /* Try without increasing RTO a number of times. If this fails,
1099 * start growing RTO exponentially */
1100 if (tc->rto_boff > TCP_RTO_SYN_RETRIES)
1101 tc->rto = clib_min (tc->rto << 1, TCP_RTO_MAX);
1103 vlib_buffer_make_headroom (b, MAX_HDRS_LEN);
1105 tcp_push_hdr_i (tc, b, tc->state);
1107 /* Account for the SYN */
1113 tcp_enqueue_to_output (vm, b, bi, tc->c_is_ip4);
1115 /* Re-enable retransmit timer */
1116 tcp_retransmit_timer_set (tc);
1120 ASSERT (tc->state == TCP_STATE_SYN_SENT);
1122 TCP_EVT_DBG (TCP_EVT_SYN_RTX, tc);
1124 /* This goes straight to ipx_lookup */
1125 tcp_push_ip_hdr (tm, tc, b);
1126 tcp_enqueue_to_ip_lookup (vm, b, bi, tc->c_is_ip4);
1128 /* Re-enable retransmit timer */
1129 tcp_timer_set (tc, TCP_TIMER_RETRANSMIT_SYN,
1130 tc->rto * TCP_TO_TIMER_TICK);
1135 tcp_timer_retransmit_handler (u32 index)
1137 tcp_timer_retransmit_handler_i (index, 0);
1141 tcp_timer_retransmit_syn_handler (u32 index)
1143 tcp_timer_retransmit_handler_i (index, 1);
1147 * Got 0 snd_wnd from peer, try to do something about it.
1151 tcp_timer_persist_handler (u32 index)
1153 tcp_main_t *tm = vnet_get_tcp_main ();
1154 vlib_main_t *vm = vlib_get_main ();
1155 u32 thread_index = vlib_get_thread_index ();
1156 tcp_connection_t *tc;
1160 tc = tcp_connection_get (index, thread_index);
1162 /* Make sure timer handle is set to invalid */
1163 tc->timers[TCP_TIMER_PERSIST] = TCP_TIMER_HANDLE_INVALID;
1165 /* Problem already solved or worse */
1166 if (tc->snd_wnd > tc->snd_mss || tcp_in_recovery (tc))
1169 /* Increment RTO backoff */
1171 tc->rto = clib_min (tc->rto << 1, TCP_RTO_MAX);
1173 /* Try to force the first unsent segment */
1174 tcp_get_free_buffer_index (tm, &bi);
1175 b = vlib_get_buffer (vm, bi);
1176 n_bytes = stream_session_peek_bytes (&tc->connection,
1177 vlib_buffer_get_current (b),
1178 tc->snd_una_max - tc->snd_una,
1180 /* Nothing to send */
1183 tcp_return_buffer (tm);
1187 b->current_length = n_bytes;
1188 tcp_push_hdr_i (tc, b, tc->state);
1189 tcp_enqueue_to_output (vm, b, bi, tc->c_is_ip4);
1191 /* Re-enable persist timer */
1192 tcp_persist_timer_set (tc);
1196 * Retransmit first unacked segment
1199 tcp_retransmit_first_unacked (tcp_connection_t * tc)
1201 tcp_main_t *tm = vnet_get_tcp_main ();
1202 vlib_main_t *vm = vlib_get_main ();
1206 tc->snd_nxt = tc->snd_una;
1209 tcp_get_free_buffer_index (tm, &bi);
1210 b = vlib_get_buffer (vm, bi);
1212 TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 2);
1214 n_bytes = tcp_prepare_retransmit_segment (tc, b, 0, tc->snd_mss);
1218 tcp_enqueue_to_output (vm, b, bi, tc->c_is_ip4);
1219 tc->rtx_bytes += n_bytes;
1222 sack_scoreboard_hole_t *
1223 scoreboard_first_rtx_hole (sack_scoreboard_t * sb)
1225 sack_scoreboard_hole_t *hole = 0;
1227 // hole = scoreboard_first_hole (&tc->sack_sb);
1231 // offset = hole->start - tc->snd_una;
1232 // hole_size = hole->end - hole->start;
1234 // ASSERT(hole_size);
1236 // if (hole_size < max_bytes)
1237 // max_bytes = hole_size;
1243 * Do fast retransmit.
1246 tcp_fast_retransmit (tcp_connection_t * tc)
1248 tcp_main_t *tm = vnet_get_tcp_main ();
1249 vlib_main_t *vm = vlib_get_main ();
1252 u32 n_written = 0, offset = 0;
1256 ASSERT (tcp_in_fastrecovery (tc));
1258 /* Start resending from first un-acked segment */
1259 tc->snd_nxt = tc->snd_una;
1261 snd_space = tcp_available_snd_space (tc);
1262 TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 0);
1264 /* If we have SACKs use them */
1265 if (tcp_opts_sack_permitted (&tc->opt)
1266 && scoreboard_first_hole (&tc->sack_sb))
1269 while (snd_space > 0)
1271 tcp_get_free_buffer_index (tm, &bi);
1272 b = vlib_get_buffer (vm, bi);
1276 scoreboard_first_rtx_hole (&tc->sack_sb);
1280 offset += n_written;
1283 n_written = tcp_prepare_retransmit_segment (tc, b, offset, snd_space);
1285 /* Nothing left to retransmit */
1288 tcp_return_buffer (tm);
1292 tcp_enqueue_to_output (vm, b, bi, tc->c_is_ip4);
1293 tc->rtx_bytes += n_written;
1294 snd_space -= n_written;
1297 /* If window allows, send 1 SMSS of new data */
1298 if (seq_lt (tc->snd_nxt, tc->snd_congestion))
1299 tc->snd_nxt = tc->snd_congestion;
1303 tcp_session_has_ooo_data (tcp_connection_t * tc)
1305 stream_session_t *s =
1306 stream_session_get (tc->c_s_index, tc->c_thread_index);
1307 return svm_fifo_has_ooo_data (s->server_rx_fifo);
1311 tcp46_output_inline (vlib_main_t * vm,
1312 vlib_node_runtime_t * node,
1313 vlib_frame_t * from_frame, int is_ip4)
1315 u32 n_left_from, next_index, *from, *to_next;
1316 u32 my_thread_index = vm->thread_index;
1318 from = vlib_frame_vector_args (from_frame);
1319 n_left_from = from_frame->n_vectors;
1321 next_index = node->cached_next_index;
1323 while (n_left_from > 0)
1327 vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
1329 while (n_left_from > 0 && n_left_to_next > 0)
1333 tcp_connection_t *tc0;
1335 u32 error0 = TCP_ERROR_PKTS_SENT, next0 = TCP_OUTPUT_NEXT_IP_LOOKUP;
1342 n_left_to_next -= 1;
1344 b0 = vlib_get_buffer (vm, bi0);
1345 tc0 = tcp_connection_get (vnet_buffer (b0)->tcp.connection_index,
1347 if (PREDICT_FALSE (tc0 == 0 || tc0->state == TCP_STATE_CLOSED))
1349 error0 = TCP_ERROR_INVALID_CONNECTION;
1350 next0 = TCP_OUTPUT_NEXT_DROP;
1354 th0 = vlib_buffer_get_current (b0);
1355 TCP_EVT_DBG (TCP_EVT_OUTPUT, tc0, th0->flags, b0->current_length);
1360 ih0 = vlib_buffer_push_ip4 (vm, b0, &tc0->c_lcl_ip4,
1361 &tc0->c_rmt_ip4, IP_PROTOCOL_TCP);
1362 th0->checksum = ip4_tcp_udp_compute_checksum (vm, b0, ih0);
1369 ih0 = vlib_buffer_push_ip6 (vm, b0, &tc0->c_lcl_ip6,
1370 &tc0->c_rmt_ip6, IP_PROTOCOL_TCP);
1371 th0->checksum = ip6_tcp_udp_icmp_compute_checksum (vm, b0, ih0,
1376 /* Filter out DUPACKs if there are no OOO segments left */
1378 (vnet_buffer (b0)->tcp.flags & TCP_BUF_FLAG_DUPACK))
1380 if (!tcp_session_has_ooo_data (tc0))
1382 error0 = TCP_ERROR_FILTERED_DUPACKS;
1383 next0 = TCP_OUTPUT_NEXT_DROP;
1388 /* Stop DELACK timer and fix flags */
1389 tc0->flags &= ~(TCP_CONN_SNDACK);
1390 if (tcp_timer_is_active (tc0, TCP_TIMER_DELACK))
1392 tcp_timer_reset (tc0, TCP_TIMER_DELACK);
1395 /* If not retransmitting
1396 * 1) update snd_una_max (SYN, SYNACK, new data, FIN)
1397 * 2) If we're not tracking an ACK, start tracking */
1398 if (seq_lt (tc0->snd_una_max, tc0->snd_nxt))
1400 tc0->snd_una_max = tc0->snd_nxt;
1401 if (tc0->rtt_ts == 0)
1403 tc0->rtt_ts = tcp_time_now ();
1404 tc0->rtt_seq = tc0->snd_nxt;
1408 /* Set the retransmit timer if not set already and not
1409 * doing a pure ACK */
1410 if (!tcp_timer_is_active (tc0, TCP_TIMER_RETRANSMIT)
1411 && tc0->snd_nxt != tc0->snd_una)
1413 tcp_retransmit_timer_set (tc0);
1417 /* set fib index to default and lookup node */
1418 /* XXX network virtualization (vrf/vni) */
1419 vnet_buffer (b0)->sw_if_index[VLIB_RX] = 0;
1420 vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
1422 b0->flags |= VNET_BUFFER_LOCALLY_ORIGINATED;
1424 b0->error = node->errors[error0];
1425 if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
1430 vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
1431 n_left_to_next, bi0, next0);
1434 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
1437 return from_frame->n_vectors;
1441 tcp4_output (vlib_main_t * vm, vlib_node_runtime_t * node,
1442 vlib_frame_t * from_frame)
1444 return tcp46_output_inline (vm, node, from_frame, 1 /* is_ip4 */ );
1448 tcp6_output (vlib_main_t * vm, vlib_node_runtime_t * node,
1449 vlib_frame_t * from_frame)
1451 return tcp46_output_inline (vm, node, from_frame, 0 /* is_ip4 */ );
1455 VLIB_REGISTER_NODE (tcp4_output_node) =
1457 .function = tcp4_output,.name = "tcp4-output",
1458 /* Takes a vector of packets. */
1459 .vector_size = sizeof (u32),
1460 .n_errors = TCP_N_ERROR,
1461 .error_strings = tcp_error_strings,
1462 .n_next_nodes = TCP_OUTPUT_N_NEXT,
1464 #define _(s,n) [TCP_OUTPUT_NEXT_##s] = n,
1465 foreach_tcp4_output_next
1468 .format_buffer = format_tcp_header,
1469 .format_trace = format_tcp_tx_trace,
1473 VLIB_NODE_FUNCTION_MULTIARCH (tcp4_output_node, tcp4_output);
1476 VLIB_REGISTER_NODE (tcp6_output_node) =
1478 .function = tcp6_output,
1479 .name = "tcp6-output",
1480 /* Takes a vector of packets. */
1481 .vector_size = sizeof (u32),
1482 .n_errors = TCP_N_ERROR,
1483 .error_strings = tcp_error_strings,
1484 .n_next_nodes = TCP_OUTPUT_N_NEXT,
1486 #define _(s,n) [TCP_OUTPUT_NEXT_##s] = n,
1487 foreach_tcp6_output_next
1490 .format_buffer = format_tcp_header,
1491 .format_trace = format_tcp_tx_trace,
1495 VLIB_NODE_FUNCTION_MULTIARCH (tcp6_output_node, tcp6_output);
1498 tcp_push_header (transport_connection_t * tconn, vlib_buffer_t * b)
1500 tcp_connection_t *tc;
1502 tc = (tcp_connection_t *) tconn;
1503 tcp_push_hdr_i (tc, b, TCP_STATE_ESTABLISHED);
1507 typedef enum _tcp_reset_next
1509 TCP_RESET_NEXT_DROP,
1510 TCP_RESET_NEXT_IP_LOOKUP,
1514 #define foreach_tcp4_reset_next \
1515 _(DROP, "error-drop") \
1516 _(IP_LOOKUP, "ip4-lookup")
1518 #define foreach_tcp6_reset_next \
1519 _(DROP, "error-drop") \
1520 _(IP_LOOKUP, "ip6-lookup")
1523 tcp46_send_reset_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
1524 vlib_frame_t * from_frame, u8 is_ip4)
1526 u32 n_left_from, next_index, *from, *to_next;
1527 u32 my_thread_index = vm->thread_index;
1529 from = vlib_frame_vector_args (from_frame);
1530 n_left_from = from_frame->n_vectors;
1532 next_index = node->cached_next_index;
1534 while (n_left_from > 0)
1538 vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
1540 while (n_left_from > 0 && n_left_to_next > 0)
1544 u32 error0 = TCP_ERROR_RST_SENT, next0 = TCP_RESET_NEXT_IP_LOOKUP;
1551 n_left_to_next -= 1;
1553 b0 = vlib_get_buffer (vm, bi0);
1555 if (tcp_make_reset_in_place (vm, b0, vnet_buffer (b0)->tcp.flags,
1556 my_thread_index, is_ip4))
1558 error0 = TCP_ERROR_LOOKUP_DROPS;
1559 next0 = TCP_RESET_NEXT_DROP;
1563 /* Prepare to send to IP lookup */
1564 vnet_buffer (b0)->sw_if_index[VLIB_TX] = 0;
1565 next0 = TCP_RESET_NEXT_IP_LOOKUP;
1568 b0->error = node->errors[error0];
1569 b0->flags |= VNET_BUFFER_LOCALLY_ORIGINATED;
1570 if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
1575 vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
1576 n_left_to_next, bi0, next0);
1578 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
1580 return from_frame->n_vectors;
1584 tcp4_send_reset (vlib_main_t * vm, vlib_node_runtime_t * node,
1585 vlib_frame_t * from_frame)
1587 return tcp46_send_reset_inline (vm, node, from_frame, 1);
1591 tcp6_send_reset (vlib_main_t * vm, vlib_node_runtime_t * node,
1592 vlib_frame_t * from_frame)
1594 return tcp46_send_reset_inline (vm, node, from_frame, 0);
1598 VLIB_REGISTER_NODE (tcp4_reset_node) = {
1599 .function = tcp4_send_reset,
1600 .name = "tcp4-reset",
1601 .vector_size = sizeof (u32),
1602 .n_errors = TCP_N_ERROR,
1603 .error_strings = tcp_error_strings,
1604 .n_next_nodes = TCP_RESET_N_NEXT,
1606 #define _(s,n) [TCP_RESET_NEXT_##s] = n,
1607 foreach_tcp4_reset_next
1613 VLIB_NODE_FUNCTION_MULTIARCH (tcp4_reset_node, tcp4_send_reset);
1616 VLIB_REGISTER_NODE (tcp6_reset_node) = {
1617 .function = tcp6_send_reset,
1618 .name = "tcp6-reset",
1619 .vector_size = sizeof (u32),
1620 .n_errors = TCP_N_ERROR,
1621 .error_strings = tcp_error_strings,
1622 .n_next_nodes = TCP_RESET_N_NEXT,
1624 #define _(s,n) [TCP_RESET_NEXT_##s] = n,
1625 foreach_tcp6_reset_next
1631 VLIB_NODE_FUNCTION_MULTIARCH (tcp6_reset_node, tcp6_send_reset);
1634 * fd.io coding-style-patch-verification: ON
1637 * eval: (c-set-style "gnu")