blob: 76ecfeae243b243365966220119fab26b7d459d9 [file] [log] [blame]
Dave Barach68b0fb02017-02-28 15:15:56 -05001/*
Florin Coras288eaab2019-02-03 15:26:14 -08002 * Copyright (c) 2017-2019 Cisco and/or its affiliates.
Dave Barach68b0fb02017-02-28 15:15:56 -05003 * 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:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 */
15#include <vnet/session/application.h>
16#include <vnet/session/session.h>
17
Florin Coras93992a92017-05-24 18:03:56 -070018u8 *
Florin Corasde9a8492018-10-24 22:18:58 -070019format_session_fifos (u8 * s, va_list * args)
Florin Coras93992a92017-05-24 18:03:56 -070020{
Florin Coras288eaab2019-02-03 15:26:14 -080021 session_t *ss = va_arg (*args, session_t *);
Florin Coras6534b7a2017-07-18 05:38:03 -040022 int verbose = va_arg (*args, int);
Florin Coras52207f12018-07-12 14:48:06 -070023 session_event_t _e, *e = &_e;
Florin Coras6534b7a2017-07-18 05:38:03 -040024 u8 found;
25
Florin Coras288eaab2019-02-03 15:26:14 -080026 if (!ss->rx_fifo || !ss->tx_fifo)
Florin Coras7fb0fe12018-04-09 09:24:52 -070027 return s;
28
Florin Coras288eaab2019-02-03 15:26:14 -080029 s = format (s, " Rx fifo: %U", format_svm_fifo, ss->rx_fifo, verbose);
Florin Corasc547e912020-12-08 17:50:45 -080030 if (verbose > 2 && ss->rx_fifo->shr->has_event)
Florin Coras6534b7a2017-07-18 05:38:03 -040031 {
Florin Coras288eaab2019-02-03 15:26:14 -080032 found = session_node_lookup_fifo_event (ss->rx_fifo, e);
Florin Coras6534b7a2017-07-18 05:38:03 -040033 s = format (s, " session node event: %s\n",
34 found ? "found" : "not found");
35 }
Florin Coras288eaab2019-02-03 15:26:14 -080036 s = format (s, " Tx fifo: %U", format_svm_fifo, ss->tx_fifo, verbose);
Florin Corasc547e912020-12-08 17:50:45 -080037 if (verbose > 2 && ss->tx_fifo->shr->has_event)
Florin Coras6534b7a2017-07-18 05:38:03 -040038 {
Florin Coras288eaab2019-02-03 15:26:14 -080039 found = session_node_lookup_fifo_event (ss->tx_fifo, e);
Florin Coras6534b7a2017-07-18 05:38:03 -040040 s = format (s, " session node event: %s\n",
41 found ? "found" : "not found");
42 }
Florin Coras93992a92017-05-24 18:03:56 -070043 return s;
44}
45
Florin Coras91f90d02019-10-23 19:28:08 -070046const char *session_state_str[] = {
47#define _(sym, str) str,
48 foreach_session_state
49#undef _
50};
51
52u8 *
53format_session_state (u8 * s, va_list * args)
54{
55 session_t *ss = va_arg (*args, session_t *);
56
57 if (ss->session_state < SESSION_N_STATES)
58 s = format (s, "%s", session_state_str[ss->session_state]);
59 else
60 s = format (s, "UNKNOWN STATE (%d)", ss->session_state);
61
62 return s;
63}
64
65const char *session_flags_str[] = {
66#define _(sym, str) str,
67 foreach_session_flag
68#undef _
69};
70
71u8 *
72format_session_flags (u8 * s, va_list * args)
73{
74 session_t *ss = va_arg (*args, session_t *);
75 int i, last = -1;
76
77 for (i = 0; i < SESSION_N_FLAGS; i++)
78 if (ss->flags & (1 << i))
79 last = i;
80
81 for (i = 0; i < last; i++)
82 {
83 if (ss->flags & (1 << i))
84 s = format (s, "%s, ", session_flags_str[i]);
85 }
86 if (last >= 0)
87 s = format (s, "%s", session_flags_str[last]);
88
89 return s;
90}
91
Dave Barach68b0fb02017-02-28 15:15:56 -050092/**
93 * Format stream session as per the following format
94 *
95 * verbose:
96 * "Connection", "Rx fifo", "Tx fifo", "Session Index"
97 * non-verbose:
98 * "Connection"
99 */
100u8 *
Florin Coras31c99552019-03-01 13:00:58 -0800101format_session (u8 * s, va_list * args)
Dave Barach68b0fb02017-02-28 15:15:56 -0500102{
Florin Coras288eaab2019-02-03 15:26:14 -0800103 session_t *ss = va_arg (*args, session_t *);
Dave Barach68b0fb02017-02-28 15:15:56 -0500104 int verbose = va_arg (*args, int);
Florin Corasde9a8492018-10-24 22:18:58 -0700105 u32 tp = session_get_transport_proto (ss);
Dave Barach68b0fb02017-02-28 15:15:56 -0500106 u8 *str = 0;
Dave Barach68b0fb02017-02-28 15:15:56 -0500107
Florin Coras5f066322019-07-22 19:03:03 -0700108 if (ss->session_state >= SESSION_STATE_TRANSPORT_DELETED)
Florin Coras3389dd22019-02-01 18:00:05 -0800109 {
110 s = format (s, "[%u:%u] CLOSED", ss->thread_index, ss->session_index);
111 return s;
112 }
113
114 if (verbose == 1)
115 {
Florin Coras3389dd22019-02-01 18:00:05 -0800116 u32 rxf, txf;
117
Aloys Augustin6eef40b2020-04-01 19:50:17 +0200118 rxf = ss->rx_fifo ? svm_fifo_max_dequeue (ss->rx_fifo) : 0;
119 txf = ss->tx_fifo ? svm_fifo_max_dequeue (ss->tx_fifo) : 0;
Florin Coras3389dd22019-02-01 18:00:05 -0800120 str = format (0, "%-10u%-10u", rxf, txf);
121 }
Dave Barach68b0fb02017-02-28 15:15:56 -0500122
Florin Coras509028a2019-04-02 17:47:03 -0700123 if (ss->session_state >= SESSION_STATE_ACCEPTING
124 || ss->session_state == SESSION_STATE_CREATED)
Dave Barach68b0fb02017-02-28 15:15:56 -0500125 {
Florin Corasde9a8492018-10-24 22:18:58 -0700126 s = format (s, "%U", format_transport_connection, tp,
127 ss->connection_index, ss->thread_index, verbose);
Florin Corasbb292f42017-05-19 09:49:19 -0700128 if (verbose == 1)
129 s = format (s, "%v", str);
Florin Coras93992a92017-05-24 18:03:56 -0700130 if (verbose > 1)
Florin Coras91f90d02019-10-23 19:28:08 -0700131 {
132 s = format (s, "%U", format_session_fifos, ss, verbose);
Florin Corasd9035a42019-11-19 18:22:41 -0800133 s = format (s, " session: state: %U opaque: 0x%x flags: %U\n",
134 format_session_state, ss, ss->opaque,
135 format_session_flags, ss);
Florin Coras91f90d02019-10-23 19:28:08 -0700136 }
Dave Barach68b0fb02017-02-28 15:15:56 -0500137 }
138 else if (ss->session_state == SESSION_STATE_LISTENING)
139 {
Florin Coras3389dd22019-02-01 18:00:05 -0800140 s = format (s, "%U%v", format_transport_listen_connection,
Aloys Augustina0abbff2019-07-12 12:16:16 +0200141 tp, ss->connection_index, ss->thread_index, verbose, str);
Florin Coras7fb0fe12018-04-09 09:24:52 -0700142 if (verbose > 1)
Florin Corasde9a8492018-10-24 22:18:58 -0700143 s = format (s, "\n%U", format_session_fifos, ss, verbose);
Dave Barach68b0fb02017-02-28 15:15:56 -0500144 }
Florin Corasbb292f42017-05-19 09:49:19 -0700145 else if (ss->session_state == SESSION_STATE_CONNECTING)
Dave Barach68b0fb02017-02-28 15:15:56 -0500146 {
Florin Corasea727642021-05-07 19:39:43 -0700147 if (ss->flags & SESSION_F_HALF_OPEN)
Georgy Borodinbffd4462023-11-28 16:04:27 +0100148 {
149 s = format (s, "%U", format_transport_half_open_connection, tp,
150 ss->connection_index, ss->thread_index, verbose);
151 s = format (s, "%v", str);
152 }
Florin Corasea727642021-05-07 19:39:43 -0700153 else
154 s = format (s, "%U", format_transport_connection, tp,
155 ss->connection_index, ss->thread_index, verbose);
Dave Barach68b0fb02017-02-28 15:15:56 -0500156 }
Dave Barach68b0fb02017-02-28 15:15:56 -0500157 else
158 {
Florin Corase04c2992017-03-01 08:17:34 -0800159 clib_warning ("Session in state: %d!", ss->session_state);
Dave Barach68b0fb02017-02-28 15:15:56 -0500160 }
Dave Barach68b0fb02017-02-28 15:15:56 -0500161 vec_free (str);
162
163 return s;
164}
165
Florin Coras3eb50622017-07-13 01:24:57 -0400166uword
167unformat_stream_session_id (unformat_input_t * input, va_list * args)
168{
169 u8 *proto = va_arg (*args, u8 *);
Florin Corasbaee8d42019-01-19 11:29:18 -0800170 u32 *fib_index = va_arg (*args, u32 *);
Florin Coras3eb50622017-07-13 01:24:57 -0400171 ip46_address_t *lcl = va_arg (*args, ip46_address_t *);
172 ip46_address_t *rmt = va_arg (*args, ip46_address_t *);
173 u16 *lcl_port = va_arg (*args, u16 *);
174 u16 *rmt_port = va_arg (*args, u16 *);
175 u8 *is_ip4 = va_arg (*args, u8 *);
176 u8 tuple_is_set = 0;
Florin Corasbaee8d42019-01-19 11:29:18 -0800177 u32 vrf = ~0;
Florin Coras3eb50622017-07-13 01:24:57 -0400178
Dave Barachb7b92992018-10-17 10:38:51 -0400179 clib_memset (lcl, 0, sizeof (*lcl));
180 clib_memset (rmt, 0, sizeof (*rmt));
Florin Coras3eb50622017-07-13 01:24:57 -0400181
182 if (unformat (input, "tcp"))
183 {
184 *proto = TRANSPORT_PROTO_TCP;
185 }
Florin Corasbaee8d42019-01-19 11:29:18 -0800186 else if (unformat (input, "udp"))
Florin Coras3eb50622017-07-13 01:24:57 -0400187 {
188 *proto = TRANSPORT_PROTO_UDP;
189 }
Florin Corasbaee8d42019-01-19 11:29:18 -0800190 else
191 return 0;
192
193 if (unformat (input, "vrf %u", &vrf))
194 ;
195
Dave Barachb7f1faa2017-08-29 11:43:37 -0400196 if (unformat (input, "%U:%d->%U:%d", unformat_ip4_address, &lcl->ip4,
197 lcl_port, unformat_ip4_address, &rmt->ip4, rmt_port))
Florin Coras3eb50622017-07-13 01:24:57 -0400198 {
199 *is_ip4 = 1;
200 tuple_is_set = 1;
201 }
202 else if (unformat (input, "%U:%d->%U:%d", unformat_ip6_address, &lcl->ip6,
203 lcl_port, unformat_ip6_address, &rmt->ip6, rmt_port))
204 {
205 *is_ip4 = 0;
206 tuple_is_set = 1;
207 }
Florin Coras3eb50622017-07-13 01:24:57 -0400208
Florin Corasbaee8d42019-01-19 11:29:18 -0800209 if (vrf != ~0)
210 {
211 fib_protocol_t fib_proto;
212 fib_proto = *is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
213 *fib_index = fib_table_find (fib_proto, vrf);
214 }
215
Chris Lukeb2bcad62017-09-18 08:51:22 -0400216 return tuple_is_set;
Florin Coras3eb50622017-07-13 01:24:57 -0400217}
218
219uword
Florin Coras5bb23ec2019-08-31 09:45:13 -0700220unformat_session_state (unformat_input_t * input, va_list * args)
221{
222 session_state_t *state = va_arg (*args, session_state_t *);
223 u8 *state_vec = 0;
224 int rv = 0;
225
226#define _(sym, str) \
227 if (unformat (input, str)) \
228 { \
229 *state = SESSION_STATE_ ## sym; \
230 rv = 1; \
231 goto done; \
232 }
233 foreach_session_state
234#undef _
235done:
236 vec_free (state_vec);
237 return rv;
238}
239
240uword
Florin Coras31c99552019-03-01 13:00:58 -0800241unformat_session (unformat_input_t * input, va_list * args)
Florin Coras3eb50622017-07-13 01:24:57 -0400242{
Florin Coras288eaab2019-02-03 15:26:14 -0800243 session_t **result = va_arg (*args, session_t **);
Florin Corasbaee8d42019-01-19 11:29:18 -0800244 u32 lcl_port = 0, rmt_port = 0, fib_index = 0;
245 ip46_address_t lcl, rmt;
Florin Coras288eaab2019-02-03 15:26:14 -0800246 session_t *s;
Florin Coras3eb50622017-07-13 01:24:57 -0400247 u8 proto = ~0;
Florin Corascea194d2017-10-02 00:18:51 -0700248 u8 is_ip4 = 0;
Florin Coras3eb50622017-07-13 01:24:57 -0400249
Florin Corasbaee8d42019-01-19 11:29:18 -0800250 if (!unformat (input, "%U", unformat_stream_session_id, &proto, &fib_index,
251 &lcl, &rmt, &lcl_port, &rmt_port, &is_ip4))
Florin Coras3eb50622017-07-13 01:24:57 -0400252 return 0;
253
Florin Coras3eb50622017-07-13 01:24:57 -0400254 if (is_ip4)
Florin Coras3cbc04b2017-10-02 00:18:51 -0700255 s = session_lookup_safe4 (fib_index, &lcl.ip4, &rmt.ip4,
256 clib_host_to_net_u16 (lcl_port),
257 clib_host_to_net_u16 (rmt_port), proto);
Florin Coras3eb50622017-07-13 01:24:57 -0400258 else
Florin Coras3cbc04b2017-10-02 00:18:51 -0700259 s = session_lookup_safe6 (fib_index, &lcl.ip6, &rmt.ip6,
260 clib_host_to_net_u16 (lcl_port),
261 clib_host_to_net_u16 (rmt_port), proto);
Florin Coras3eb50622017-07-13 01:24:57 -0400262 if (s)
263 {
264 *result = s;
265 return 1;
266 }
267 return 0;
268}
269
270uword
271unformat_transport_connection (unformat_input_t * input, va_list * args)
272{
273 transport_connection_t **result = va_arg (*args, transport_connection_t **);
274 u32 suggested_proto = va_arg (*args, u32);
275 transport_connection_t *tc;
276 u8 proto = ~0;
277 ip46_address_t lcl, rmt;
Florin Corascea194d2017-10-02 00:18:51 -0700278 u32 lcl_port = 0, rmt_port = 0, fib_index = 0;
279 u8 is_ip4 = 0;
Florin Coras3eb50622017-07-13 01:24:57 -0400280
Florin Corasbaee8d42019-01-19 11:29:18 -0800281 if (!unformat (input, "%U", unformat_stream_session_id, &fib_index, &proto,
282 &lcl, &rmt, &lcl_port, &rmt_port, &is_ip4))
Florin Coras3eb50622017-07-13 01:24:57 -0400283 return 0;
284
Florin Coras3eb50622017-07-13 01:24:57 -0400285 proto = (proto == (u8) ~ 0) ? suggested_proto : proto;
286 if (proto == (u8) ~ 0)
287 return 0;
Florin Coras3eb50622017-07-13 01:24:57 -0400288 if (is_ip4)
Florin Corascea194d2017-10-02 00:18:51 -0700289 tc = session_lookup_connection4 (fib_index, &lcl.ip4, &rmt.ip4,
290 clib_host_to_net_u16 (lcl_port),
291 clib_host_to_net_u16 (rmt_port), proto);
Florin Coras3eb50622017-07-13 01:24:57 -0400292 else
Florin Corascea194d2017-10-02 00:18:51 -0700293 tc = session_lookup_connection6 (fib_index, &lcl.ip6, &rmt.ip6,
294 clib_host_to_net_u16 (lcl_port),
295 clib_host_to_net_u16 (rmt_port), proto);
Florin Coras3eb50622017-07-13 01:24:57 -0400296
297 if (tc)
298 {
299 *result = tc;
300 return 1;
301 }
302 return 0;
303}
304
Florin Coras5bb23ec2019-08-31 09:45:13 -0700305static void
306session_cli_show_all_sessions (vlib_main_t * vm, int verbose)
307{
308 session_main_t *smm = &session_main;
Florin Coras2d0b2bb2019-11-01 14:03:28 -0700309 u32 n_closed, thread_index;
Florin Coras5bb23ec2019-08-31 09:45:13 -0700310 session_t *pool, *s;
311
312 for (thread_index = 0; thread_index < vec_len (smm->wrk); thread_index++)
313 {
314 pool = smm->wrk[thread_index].sessions;
315
316 if (!pool_elts (pool))
317 {
318 vlib_cli_output (vm, "Thread %d: no sessions", thread_index);
319 continue;
320 }
321
322 if (!verbose)
323 {
324 vlib_cli_output (vm, "Thread %d: %d sessions", thread_index,
325 pool_elts (pool));
326 continue;
327 }
328
329 if (pool_elts (pool) > 50)
330 {
331 vlib_cli_output (vm, "Thread %u: %d sessions. Verbose output "
332 "suppressed. For more details use filters.",
333 thread_index, pool_elts (pool));
334 continue;
335 }
336
337 if (verbose == 1)
Florin Coras7bf6ed62020-09-23 12:02:08 -0700338 vlib_cli_output (vm, "%s%-" SESSION_CLI_ID_LEN "s%-"
339 SESSION_CLI_STATE_LEN "s%-10s%-10s",
Florin Coras5bb23ec2019-08-31 09:45:13 -0700340 thread_index ? "\n" : "",
341 "Connection", "State", "Rx-f", "Tx-f");
342
Florin Coras2d0b2bb2019-11-01 14:03:28 -0700343 n_closed = 0;
344
Damjan Marionb2c31b62020-12-13 21:47:40 +0100345 pool_foreach (s, pool) {
Florin Coras5bb23ec2019-08-31 09:45:13 -0700346 if (s->session_state >= SESSION_STATE_TRANSPORT_DELETED)
347 {
348 n_closed += 1;
349 continue;
350 }
351 vlib_cli_output (vm, "%U", format_session, s, verbose);
Damjan Marionb2c31b62020-12-13 21:47:40 +0100352 }
Florin Coras5bb23ec2019-08-31 09:45:13 -0700353
354 if (!n_closed)
355 vlib_cli_output (vm, "Thread %d: active sessions %u", thread_index,
356 pool_elts (pool) - n_closed);
357 else
358 vlib_cli_output (vm, "Thread %d: active sessions %u closed %u",
359 thread_index, pool_elts (pool) - n_closed, n_closed);
360 }
361}
362
363static int
364session_cli_filter_check (session_t * s, session_state_t * states,
365 transport_proto_t tp)
366{
367 if (states)
368 {
369 session_state_t *state;
370 vec_foreach (state, states) if (s->session_state == *state)
371 goto check_transport;
372 return 0;
373 }
374
375check_transport:
376
Florin Coras07063b82020-03-13 04:44:51 +0000377 if (tp != TRANSPORT_PROTO_INVALID && session_get_transport_proto (s) != tp)
Florin Coras5bb23ec2019-08-31 09:45:13 -0700378 return 0;
379
380 return 1;
381}
382
383static void
384session_cli_show_session_filter (vlib_main_t * vm, u32 thread_index,
385 u32 start, u32 end, session_state_t * states,
386 transport_proto_t tp, int verbose)
387{
388 u8 output_suppressed = 0;
389 session_worker_t *wrk;
390 session_t *pool, *s;
391 u32 count = 0, max_index;
392 int i;
393
394 wrk = session_main_get_worker_if_valid (thread_index);
395 if (!wrk)
396 {
397 vlib_cli_output (vm, "invalid thread index %u", thread_index);
398 return;
399 }
400
401 pool = wrk->sessions;
402
Florin Coras07063b82020-03-13 04:44:51 +0000403 if (tp == TRANSPORT_PROTO_INVALID && states == 0 && !verbose
Florin Coras5bb23ec2019-08-31 09:45:13 -0700404 && (start == 0 && end == ~0))
405 {
406 vlib_cli_output (vm, "Thread %d: %u sessions", thread_index,
407 pool_elts (pool));
408 return;
409 }
410
Florin Coras61a89f22019-09-09 19:22:36 -0700411 max_index = pool_len (pool) ? pool_len (pool) - 1 : 0;
Florin Coras5bb23ec2019-08-31 09:45:13 -0700412 for (i = start; i <= clib_min (end, max_index); i++)
413 {
414 if (pool_is_free_index (pool, i))
415 continue;
416
417 s = pool_elt_at_index (pool, i);
418
419 if (session_cli_filter_check (s, states, tp))
420 {
421 count += 1;
422 if (verbose)
423 {
424 if (count > 50 || (verbose > 1 && count > 10))
425 {
426 output_suppressed = 1;
427 continue;
428 }
429 if (s->session_state < SESSION_STATE_TRANSPORT_DELETED)
430 vlib_cli_output (vm, "%U", format_session, s, verbose);
431 }
432 }
433 }
434
435 if (!output_suppressed)
436 vlib_cli_output (vm, "Thread %d: %u sessions matched filter",
437 thread_index, count);
438 else
439 vlib_cli_output (vm, "Thread %d: %u sessions matched filter. Not all"
440 " shown. Use finer grained filter.", thread_index,
441 count);
442}
443
Florin Coras16d974e2020-02-09 20:03:12 +0000444void
445session_cli_show_events_thread (vlib_main_t * vm, u32 thread_index)
446{
447 session_worker_t *wrk;
448
449 wrk = session_main_get_worker_if_valid (thread_index);
450 if (!wrk)
451 {
452 vlib_cli_output (vm, "invalid thread index %u", thread_index);
453 return;
454 }
455
456 vlib_cli_output (vm, "Thread %d:\n", thread_index);
457 vlib_cli_output (vm, " evt elements alloc: %u",
Florin Coras46b8b1a2021-05-17 19:09:33 -0700458 clib_llist_elts (wrk->event_elts));
Florin Coras16d974e2020-02-09 20:03:12 +0000459 vlib_cli_output (vm, " ctrl evt elt data alloc: %d",
Florin Coras46b8b1a2021-05-17 19:09:33 -0700460 clib_llist_elts (wrk->ctrl_evts_data));
Florin Coras16d974e2020-02-09 20:03:12 +0000461}
462
463static void
464session_cli_show_events (vlib_main_t * vm, u32 thread_index)
465{
466 session_main_t *smm = &session_main;
467 if (!thread_index)
468 {
469 session_cli_show_events_thread (vm, thread_index);
470 return;
471 }
472
473 for (thread_index = 0; thread_index < vec_len (smm->wrk); thread_index++)
474 session_cli_show_events_thread (vm, thread_index);
475}
476
Florin Coras5bb23ec2019-08-31 09:45:13 -0700477static void
Florin Coras5bb23ec2019-08-31 09:45:13 -0700478session_cli_print_session_states (vlib_main_t * vm)
479{
480#define _(sym, str) vlib_cli_output (vm, str);
481 foreach_session_state
482#undef _
483}
484
Steven Luongc4b5d102024-07-30 13:44:01 -0700485static u8 *
486format_rt_backend (u8 *s, va_list *args)
487{
488 u32 i = va_arg (*args, u32);
489 u8 *t = 0;
490
491 switch (i)
492 {
493#define _(v, s) \
494 case RT_BACKEND_ENGINE_##v: \
495 t = (u8 *) s; \
496 break;
497 foreach_rt_engine
498#undef _
499 default : return format (s, "unknown");
500 }
501 return format (s, "%s", t);
502}
503
Dave Barach68b0fb02017-02-28 15:15:56 -0500504static clib_error_t *
505show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
506 vlib_cli_command_t * cmd)
507{
Florin Coras5bb23ec2019-08-31 09:45:13 -0700508 u8 one_session = 0, do_listeners = 0, sst, do_elog = 0, do_filter = 0;
509 u32 track_index, thread_index = 0, start = 0, end = ~0, session_index;
Florin Coras07063b82020-03-13 04:44:51 +0000510 transport_proto_t transport_proto = TRANSPORT_PROTO_INVALID;
Florin Coras5bb23ec2019-08-31 09:45:13 -0700511 session_state_t state = SESSION_N_STATES, *states = 0;
Florin Coras31c99552019-03-01 13:00:58 -0800512 session_main_t *smm = &session_main;
Florin Coras5bb23ec2019-08-31 09:45:13 -0700513 clib_error_t *error = 0;
Florin Coras053a0e42018-11-13 15:52:38 -0800514 app_worker_t *app_wrk;
Florin Coras5bb23ec2019-08-31 09:45:13 -0700515 u32 transport_index;
Florin Coras053a0e42018-11-13 15:52:38 -0800516 const u8 *app_name;
Florin Coras16d974e2020-02-09 20:03:12 +0000517 u8 do_events = 0;
Florin Coras5bb23ec2019-08-31 09:45:13 -0700518 int verbose = 0;
519 session_t *s;
Dave Barach68b0fb02017-02-28 15:15:56 -0500520
Florin Coras5bb23ec2019-08-31 09:45:13 -0700521 session_cli_return_if_not_enabled ();
522
Damjan Marion342044a2022-05-14 00:24:34 +0200523 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
Florin Corase04c2992017-03-01 08:17:34 -0800524 {
Damjan Marion342044a2022-05-14 00:24:34 +0200525 if (unformat (input, "verbose %d", &verbose))
Florin Corasbb292f42017-05-19 09:49:19 -0700526 ;
Damjan Marion342044a2022-05-14 00:24:34 +0200527 else if (unformat (input, "verbose"))
Dave Barach68b0fb02017-02-28 15:15:56 -0500528 verbose = 1;
Damjan Marion342044a2022-05-14 00:24:34 +0200529 else if (unformat (input, "listeners %U", unformat_transport_proto,
Florin Corasdbd44562017-11-09 19:30:17 -0800530 &transport_proto))
531 do_listeners = 1;
Damjan Marion342044a2022-05-14 00:24:34 +0200532 else if (unformat (input, "%U", unformat_session, &s))
Dave Barach2c25a622017-06-26 11:35:07 -0400533 {
534 one_session = 1;
Dave Barach2c25a622017-06-26 11:35:07 -0400535 }
Damjan Marion342044a2022-05-14 00:24:34 +0200536 else if (unformat (input, "thread %u index %u", &thread_index,
Florin Coras5bb23ec2019-08-31 09:45:13 -0700537 &session_index))
538 {
539 s = session_get_if_valid (session_index, thread_index);
540 if (!s)
541 {
542 vlib_cli_output (vm, "session is not allocated");
543 goto done;
544 }
545 one_session = 1;
546 }
Damjan Marion342044a2022-05-14 00:24:34 +0200547 else if (unformat (input, "thread %u", &thread_index))
Florin Coras5bb23ec2019-08-31 09:45:13 -0700548 {
549 do_filter = 1;
550 }
Damjan Marion342044a2022-05-14 00:24:34 +0200551 else if (unformat (input, "state %U", unformat_session_state, &state))
Florin Coras5bb23ec2019-08-31 09:45:13 -0700552 {
553 vec_add1 (states, state);
554 do_filter = 1;
555 }
Damjan Marion342044a2022-05-14 00:24:34 +0200556 else if (unformat (input, "proto %U index %u", unformat_transport_proto,
557 &transport_proto, &transport_index))
Florin Coras5bb23ec2019-08-31 09:45:13 -0700558 {
559 transport_connection_t *tc;
560 tc = transport_get_connection (transport_proto, transport_index,
561 thread_index);
562 if (!tc)
563 {
564 vlib_cli_output (vm, "transport connection %u thread %u is not"
565 " allocated", transport_index, thread_index);
566 goto done;
567 }
568 s = session_get_if_valid (tc->s_index, thread_index);
569 if (!s)
570 {
571 vlib_cli_output (vm, "session for transport connection %u "
572 "thread %u does not exist", transport_index,
573 thread_index);
574 goto done;
575 }
576 one_session = 1;
577 }
Damjan Marion342044a2022-05-14 00:24:34 +0200578 else if (unformat (input, "proto %U", unformat_transport_proto,
Florin Coras5bb23ec2019-08-31 09:45:13 -0700579 &transport_proto))
580 do_filter = 1;
Damjan Marion342044a2022-05-14 00:24:34 +0200581 else if (unformat (input, "range %u %u", &start, &end))
Florin Coras5bb23ec2019-08-31 09:45:13 -0700582 do_filter = 1;
Damjan Marion342044a2022-05-14 00:24:34 +0200583 else if (unformat (input, "range %u", &start))
Florin Coras5bb23ec2019-08-31 09:45:13 -0700584 {
585 end = start + 50;
586 do_filter = 1;
587 }
Damjan Marion342044a2022-05-14 00:24:34 +0200588 else if (unformat (input, "elog"))
Florin Coras5bb23ec2019-08-31 09:45:13 -0700589 do_elog = 1;
Damjan Marion342044a2022-05-14 00:24:34 +0200590 else if (unformat (input, "protos"))
Florin Coras5bb23ec2019-08-31 09:45:13 -0700591 {
Florin Coras07063b82020-03-13 04:44:51 +0000592 vlib_cli_output (vm, "%U", format_transport_protos);
Florin Coras5bb23ec2019-08-31 09:45:13 -0700593 goto done;
594 }
Steven Luongc4b5d102024-07-30 13:44:01 -0700595 else if (unformat (input, "rt-backend"))
596 {
597 vlib_cli_output (vm, "%U", format_rt_backend, smm->rt_engine_type);
598 goto done;
599 }
Damjan Marion342044a2022-05-14 00:24:34 +0200600 else if (unformat (input, "states"))
Florin Coras5bb23ec2019-08-31 09:45:13 -0700601 {
602 session_cli_print_session_states (vm);
603 goto done;
604 }
Damjan Marion342044a2022-05-14 00:24:34 +0200605 else if (unformat (input, "events"))
Florin Coras16d974e2020-02-09 20:03:12 +0000606 do_events = 1;
Florin Coras5bb23ec2019-08-31 09:45:13 -0700607 else
608 {
609 error = clib_error_return (0, "unknown input `%U'",
Damjan Marion342044a2022-05-14 00:24:34 +0200610 format_unformat_error, input);
Florin Coras5bb23ec2019-08-31 09:45:13 -0700611 goto done;
612 }
Dave Barach68b0fb02017-02-28 15:15:56 -0500613 }
614
Dave Barach2c25a622017-06-26 11:35:07 -0400615 if (one_session)
616 {
Florin Coras31c99552019-03-01 13:00:58 -0800617 u8 *str = format (0, "%U", format_session, s, 3);
Florin Coras844a36d2018-12-20 09:50:50 -0800618 if (do_elog && s->session_state != SESSION_STATE_LISTENING)
Florin Corasaefbede2018-12-19 13:07:49 -0800619 {
Damjan Marionf553a2c2021-03-26 13:45:37 +0100620 elog_main_t *em = &vlib_global_main.elog_main;
Florin Coras5bb23ec2019-08-31 09:45:13 -0700621 transport_connection_t *tc;
Florin Corasaefbede2018-12-19 13:07:49 -0800622 f64 dt;
623
624 tc = session_get_transport (s);
625 track_index = transport_elog_track_index (tc);
626 dt = (em->init_time.cpu - vm->clib_time.init_cpu_time)
627 * vm->clib_time.seconds_per_clock;
628 if (track_index != ~0)
629 str = format (str, " session elog:\n%U", format_elog_track, em,
630 dt, track_index);
631 }
632 vlib_cli_output (vm, "%v", str);
Florin Coras3389dd22019-02-01 18:00:05 -0800633 vec_free (str);
Florin Coras5bb23ec2019-08-31 09:45:13 -0700634 goto done;
Dave Barach2c25a622017-06-26 11:35:07 -0400635 }
636
Florin Corasdbd44562017-11-09 19:30:17 -0800637 if (do_listeners)
638 {
639 sst = session_type_from_proto_and_ip (transport_proto, 1);
Florin Coras7bf6ed62020-09-23 12:02:08 -0700640 vlib_cli_output (vm, "%-" SESSION_CLI_ID_LEN "s%-24s", "Listener",
641 "App");
642
Damjan Marionb2c31b62020-12-13 21:47:40 +0100643 pool_foreach (s, smm->wrk[0].sessions) {
Florin Coras5c9083d2018-04-13 06:39:07 -0700644 if (s->session_state != SESSION_STATE_LISTENING
645 || s->session_type != sst)
646 continue;
Florin Coras053a0e42018-11-13 15:52:38 -0800647 app_wrk = app_worker_get (s->app_wrk_index);
648 app_name = application_name_from_index (app_wrk->app_index);
Florin Coras31c99552019-03-01 13:00:58 -0800649 vlib_cli_output (vm, "%U%-25v%", format_session, s, 0,
Florin Corasde9a8492018-10-24 22:18:58 -0700650 app_name);
Damjan Marionb2c31b62020-12-13 21:47:40 +0100651 }
Florin Coras5bb23ec2019-08-31 09:45:13 -0700652 goto done;
Florin Corasdbd44562017-11-09 19:30:17 -0800653 }
654
Florin Coras16d974e2020-02-09 20:03:12 +0000655 if (do_events)
656 {
657 session_cli_show_events (vm, thread_index);
658 goto done;
659 }
660
Florin Coras5bb23ec2019-08-31 09:45:13 -0700661 if (do_filter)
Dave Barach68b0fb02017-02-28 15:15:56 -0500662 {
Florin Coras5bb23ec2019-08-31 09:45:13 -0700663 if (end < start)
Dave Barach68b0fb02017-02-28 15:15:56 -0500664 {
Florin Coras5bb23ec2019-08-31 09:45:13 -0700665 error = clib_error_return (0, "invalid range start: %u end: %u",
666 start, end);
667 goto done;
Dave Barach68b0fb02017-02-28 15:15:56 -0500668 }
Florin Coras5bb23ec2019-08-31 09:45:13 -0700669 session_cli_show_session_filter (vm, thread_index, start, end, states,
670 transport_proto, verbose);
671 goto done;
Dave Barach68b0fb02017-02-28 15:15:56 -0500672 }
Dave Barach68b0fb02017-02-28 15:15:56 -0500673
Florin Coras5bb23ec2019-08-31 09:45:13 -0700674 session_cli_show_all_sessions (vm, verbose);
675
676done:
Florin Coras5bb23ec2019-08-31 09:45:13 -0700677 vec_free (states);
678 return error;
Dave Barach68b0fb02017-02-28 15:15:56 -0500679}
680
Steven Luongc4b5d102024-07-30 13:44:01 -0700681VLIB_CLI_COMMAND (vlib_cli_show_session_command) = {
Florin Corase04c2992017-03-01 08:17:34 -0800682 .path = "show session",
Florin Coras3389dd22019-02-01 18:00:05 -0800683 .short_help = "show session [verbose [n]] [listeners <proto>] "
Florin Coras5bb23ec2019-08-31 09:45:13 -0700684 "[<session-id> [elog]] [thread <n> [index <n>] "
685 "[proto <proto>] [state <state>] [range <min> [<max>]] "
Steven Luongc4b5d102024-07-30 13:44:01 -0700686 "[protos] [states] [rt-backend]",
Florin Corase04c2992017-03-01 08:17:34 -0800687 .function = show_session_command_fn,
688};
Dave Barach68b0fb02017-02-28 15:15:56 -0500689
Dave Barach2c25a622017-06-26 11:35:07 -0400690static int
Florin Coras288eaab2019-02-03 15:26:14 -0800691clear_session (session_t * s)
Dave Barach2c25a622017-06-26 11:35:07 -0400692{
Florin Coras15531972018-08-12 23:50:53 -0700693 app_worker_t *server_wrk = app_worker_get (s->app_wrk_index);
Florin Coras69b68ef2019-04-02 11:38:51 -0700694 app_worker_close_notify (server_wrk, s);
Dave Barach2c25a622017-06-26 11:35:07 -0400695 return 0;
696}
697
Dave Barach68b0fb02017-02-28 15:15:56 -0500698static clib_error_t *
699clear_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
700 vlib_cli_command_t * cmd)
701{
Florin Coras31c99552019-03-01 13:00:58 -0800702 session_main_t *smm = &session_main;
Dave Barach2c25a622017-06-26 11:35:07 -0400703 u32 thread_index = 0, clear_all = 0;
Florin Coras31c99552019-03-01 13:00:58 -0800704 session_worker_t *wrk;
Dave Barach68b0fb02017-02-28 15:15:56 -0500705 u32 session_index = ~0;
Florin Coras288eaab2019-02-03 15:26:14 -0800706 session_t *session;
Dave Barach68b0fb02017-02-28 15:15:56 -0500707
Florin Corase04c2992017-03-01 08:17:34 -0800708 if (!smm->is_enabled)
709 {
flyingeagle23e2125062017-04-20 20:01:14 +0800710 return clib_error_return (0, "session layer is not enabled");
Florin Corase04c2992017-03-01 08:17:34 -0800711 }
712
Dave Barach68b0fb02017-02-28 15:15:56 -0500713 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
714 {
715 if (unformat (input, "thread %d", &thread_index))
716 ;
717 else if (unformat (input, "session %d", &session_index))
718 ;
Dave Barach2c25a622017-06-26 11:35:07 -0400719 else if (unformat (input, "all"))
720 clear_all = 1;
Dave Barach68b0fb02017-02-28 15:15:56 -0500721 else
722 return clib_error_return (0, "unknown input `%U'",
723 format_unformat_error, input);
724 }
725
Dave Barach2c25a622017-06-26 11:35:07 -0400726 if (!clear_all && session_index == ~0)
Dave Barach68b0fb02017-02-28 15:15:56 -0500727 return clib_error_return (0, "session <nn> required, but not set.");
728
Dave Barach2c25a622017-06-26 11:35:07 -0400729 if (session_index != ~0)
730 {
Florin Coras3cbc04b2017-10-02 00:18:51 -0700731 session = session_get_if_valid (session_index, thread_index);
Dave Barach2c25a622017-06-26 11:35:07 -0400732 if (!session)
733 return clib_error_return (0, "no session %d on thread %d",
734 session_index, thread_index);
735 clear_session (session);
736 }
Dave Barach68b0fb02017-02-28 15:15:56 -0500737
Dave Barach2c25a622017-06-26 11:35:07 -0400738 if (clear_all)
739 {
Florin Coras5a7ca7b2018-10-30 12:01:48 -0700740 vec_foreach (wrk, smm->wrk)
Dave Barach2c25a622017-06-26 11:35:07 -0400741 {
Damjan Marionb2c31b62020-12-13 21:47:40 +0100742 pool_foreach (session, wrk->sessions) {
Dave Barach2c25a622017-06-26 11:35:07 -0400743 clear_session (session);
Damjan Marionb2c31b62020-12-13 21:47:40 +0100744 }
Dave Barach2c25a622017-06-26 11:35:07 -0400745 };
Dave Barach2c25a622017-06-26 11:35:07 -0400746 }
Dave Barach68b0fb02017-02-28 15:15:56 -0500747
748 return 0;
749}
750
Florin Corase04c2992017-03-01 08:17:34 -0800751VLIB_CLI_COMMAND (clear_session_command, static) =
Dave Barach68b0fb02017-02-28 15:15:56 -0500752{
Florin Corase04c2992017-03-01 08:17:34 -0800753 .path = "clear session",
754 .short_help = "clear session thread <thread> session <index>",
755 .function = clear_session_command_fn,
756};
Florin Corase04c2992017-03-01 08:17:34 -0800757
758static clib_error_t *
Florin Coras3eb50622017-07-13 01:24:57 -0400759show_session_fifo_trace_command_fn (vlib_main_t * vm,
760 unformat_input_t * input,
761 vlib_cli_command_t * cmd)
762{
Florin Coras288eaab2019-02-03 15:26:14 -0800763 session_t *s = 0;
Florin Coras3eb50622017-07-13 01:24:57 -0400764 u8 is_rx = 0, *str = 0;
765
766 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
767 {
Florin Coras31c99552019-03-01 13:00:58 -0800768 if (unformat (input, "%U", unformat_session, &s))
Florin Coras3eb50622017-07-13 01:24:57 -0400769 ;
770 else if (unformat (input, "rx"))
771 is_rx = 1;
772 else if (unformat (input, "tx"))
773 is_rx = 0;
774 else
775 return clib_error_return (0, "unknown input `%U'",
776 format_unformat_error, input);
777 }
778
779 if (!SVM_FIFO_TRACE)
780 {
781 vlib_cli_output (vm, "fifo tracing not enabled");
782 return 0;
783 }
784
785 if (!s)
786 {
787 vlib_cli_output (vm, "could not find session");
788 return 0;
789 }
790
791 str = is_rx ?
Florin Coras288eaab2019-02-03 15:26:14 -0800792 svm_fifo_dump_trace (str, s->rx_fifo) :
793 svm_fifo_dump_trace (str, s->tx_fifo);
Florin Coras3eb50622017-07-13 01:24:57 -0400794
795 vlib_cli_output (vm, "%v", str);
796 return 0;
797}
798
Florin Coras3eb50622017-07-13 01:24:57 -0400799VLIB_CLI_COMMAND (show_session_fifo_trace_command, static) =
800{
801 .path = "show session fifo trace",
802 .short_help = "show session fifo trace <session>",
803 .function = show_session_fifo_trace_command_fn,
804};
Florin Coras3eb50622017-07-13 01:24:57 -0400805
806static clib_error_t *
807session_replay_fifo_command_fn (vlib_main_t * vm, unformat_input_t * input,
808 vlib_cli_command_t * cmd)
809{
Florin Coras288eaab2019-02-03 15:26:14 -0800810 session_t *s = 0;
Florin Coras3eb50622017-07-13 01:24:57 -0400811 u8 is_rx = 0, *str = 0;
812
813 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
814 {
Florin Coras31c99552019-03-01 13:00:58 -0800815 if (unformat (input, "%U", unformat_session, &s))
Florin Coras3eb50622017-07-13 01:24:57 -0400816 ;
817 else if (unformat (input, "rx"))
818 is_rx = 1;
819 else
820 return clib_error_return (0, "unknown input `%U'",
821 format_unformat_error, input);
822 }
823
824 if (!SVM_FIFO_TRACE)
825 {
826 vlib_cli_output (vm, "fifo tracing not enabled");
827 return 0;
828 }
829
830 if (!s)
831 {
832 vlib_cli_output (vm, "could not find session");
833 return 0;
834 }
835
836 str = is_rx ?
Florin Coras288eaab2019-02-03 15:26:14 -0800837 svm_fifo_replay (str, s->rx_fifo, 0, 1) :
838 svm_fifo_replay (str, s->tx_fifo, 0, 1);
Florin Coras3eb50622017-07-13 01:24:57 -0400839
840 vlib_cli_output (vm, "%v", str);
841 return 0;
842}
843
Florin Coras3eb50622017-07-13 01:24:57 -0400844VLIB_CLI_COMMAND (session_replay_fifo_trace_command, static) =
845{
846 .path = "session replay fifo",
847 .short_help = "session replay fifo <session>",
848 .function = session_replay_fifo_command_fn,
849};
Florin Coras3eb50622017-07-13 01:24:57 -0400850
851static clib_error_t *
Florin Corase04c2992017-03-01 08:17:34 -0800852session_enable_disable_fn (vlib_main_t * vm, unformat_input_t * input,
853 vlib_cli_command_t * cmd)
854{
Steven Luongc4b5d102024-07-30 13:44:01 -0700855 session_enable_disable_args_t args;
856 session_main_t *smm = &session_main;
Florin Corase04c2992017-03-01 08:17:34 -0800857
Damjan Marion342044a2022-05-14 00:24:34 +0200858 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
Florin Corase04c2992017-03-01 08:17:34 -0800859 {
Damjan Marion342044a2022-05-14 00:24:34 +0200860 if (unformat (input, "enable"))
Steven Luongc4b5d102024-07-30 13:44:01 -0700861 {
862 args.is_en = 1;
863 if (unformat (input, "rt-backend"))
864 if (unformat (input, "sdl"))
865 args.rt_engine_type = RT_BACKEND_ENGINE_SDL;
866 else if (unformat (input, "rule-table"))
867 args.rt_engine_type = RT_BACKEND_ENGINE_RULE_TABLE;
868 else
869 return clib_error_return (0, "unknown input `%U'",
870 format_unformat_error, input);
871 else
872 args.rt_engine_type = RT_BACKEND_ENGINE_NONE;
873 }
Damjan Marion342044a2022-05-14 00:24:34 +0200874 else if (unformat (input, "disable"))
Steven Luongc4b5d102024-07-30 13:44:01 -0700875 {
876 args.rt_engine_type = RT_BACKEND_ENGINE_DISABLE;
877 args.is_en = 0;
878 }
Florin Corase04c2992017-03-01 08:17:34 -0800879 else
Filip Tehlaraf21b2e2022-06-03 12:21:16 +0000880 return clib_error_return (0, "unknown input `%U'",
881 format_unformat_error, input);
Florin Corase04c2992017-03-01 08:17:34 -0800882 }
883
Steven Luongc4b5d102024-07-30 13:44:01 -0700884 if (smm->is_enabled && args.is_en)
885 if (args.rt_engine_type != smm->rt_engine_type)
886 return clib_error_return (
887 0, "session is already enable. Must disable first");
Damjan Marion342044a2022-05-14 00:24:34 +0200888
Steven Luongc4b5d102024-07-30 13:44:01 -0700889 return vnet_session_enable_disable (vm, &args);
Florin Corase04c2992017-03-01 08:17:34 -0800890}
891
Steven Luongc4b5d102024-07-30 13:44:01 -0700892VLIB_CLI_COMMAND (session_enable_disable_command, static) = {
Florin Corase04c2992017-03-01 08:17:34 -0800893 .path = "session",
Steven Luongc4b5d102024-07-30 13:44:01 -0700894 .short_help =
895 "session { enable [ rt-backend sdl | rule-table ] } | { disable }",
Florin Corase04c2992017-03-01 08:17:34 -0800896 .function = session_enable_disable_fn,
897};
Dave Barach68b0fb02017-02-28 15:15:56 -0500898
Filip Tehlarac3c8dc2023-03-14 08:50:28 +0100899static clib_error_t *
900show_session_stats_fn (vlib_main_t *vm, unformat_input_t *input,
901 vlib_cli_command_t *cmd)
902{
903 session_main_t *smm = &session_main;
904 session_worker_t *wrk;
905 unsigned int *e;
906
907 if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
908 return clib_error_return (0, "unknown input `%U'", format_unformat_error,
909 input);
910
911 vec_foreach (wrk, smm->wrk)
912 {
913 vlib_cli_output (vm, "Thread %u:\n", wrk - smm->wrk);
914 e = wrk->stats.errors;
915#define _(name, str) \
916 if (e[SESSION_EP_##name]) \
917 vlib_cli_output (vm, " %lu %s", e[SESSION_EP_##name], str);
918 foreach_session_error
919#undef _
920 }
921 return 0;
922}
923
924VLIB_CLI_COMMAND (show_session_stats_command, static) = {
925 .path = "show session stats",
926 .short_help = "show session stats",
927 .function = show_session_stats_fn,
928};
929
930static clib_error_t *
931clear_session_stats_fn (vlib_main_t *vm, unformat_input_t *input,
932 vlib_cli_command_t *cmd)
933{
934 session_main_t *smm = &session_main;
935 session_worker_t *wrk;
936
937 if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
938 return clib_error_return (0, "unknown input `%U'", format_unformat_error,
939 input);
940
941 vec_foreach (wrk, smm->wrk)
942 {
943 clib_memset (&wrk->stats, 0, sizeof (wrk->stats));
944 }
945
946 return 0;
947}
948
949VLIB_CLI_COMMAND (clear_session_stats_command, static) = {
950 .path = "clear session stats",
951 .short_help = "clear session stats",
952 .function = clear_session_stats_fn,
953};
954
Dave Barach68b0fb02017-02-28 15:15:56 -0500955/*
956 * fd.io coding-style-patch-verification: ON
957 *
958 * Local Variables:
959 * eval: (c-set-style "gnu")
960 * End:
961 */