summaryrefslogtreecommitdiffstats
path: root/src/vlib/node_cli.c
blob: 619170e3027c6170f5f1965af5048cc3a625e918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * node_cli.c: node CLI
 *
 * Copyright (c) 2008 Eliot Dresselhaus
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#include <vlib/vlib.h>
#include <vlib/threads.h>

static int
node_cmp (void *a1, void *a2)
{
  vlib_node_t **n1 = a1;
  vlib_node_t **n2 = a2;

  return vec_cmp (n1[0]->name, n2[0]->name);
}

static clib_error_t *
show_node_graph (vlib_main_t * vm,
		 unformat_input_t * input, vlib_cli_command_t * cmd)
{
  vlib_node_main_t *nm = &vm->node_main;
  vlib_node_t *n;
  u32 node_index;

  vlib_cli_output (vm, "%U\n", format_vlib_node_graph, nm, 0);

  if (unformat (input, "%U", unformat_vlib_node, vm, &node_index))
    {
      n = vlib_get_node (vm, node_index);
      vlib_cli_output (vm, "%U\n", format_vlib_node_graph, nm, n);
    }
  else
    {
      vlib_node_t **nodes = vec_dup (nm->nodes);
      uword i;

      vec_sort_with_function (nodes, node_cmp);

      for (i = 0; i < vec_len (nodes); i++)
	vlib_cli_output (vm, "%U\n\n", format_vlib_node_graph, nm, nodes[i]);

      vec_free (nodes);
    }

  return 0;
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_node_graph_command, static) = {
  .path = "show vlib graph",
  .short_help = "Show packet processing node graph",
  .function = show_node_graph,
};
/* *INDENT-ON* */

static u8 *
format_vlib_node_stats (u8 * s, va_list * va)
{
  vlib_main_t *vm = va_arg (*va, vlib_main_t *);
  vlib_node_t *n = va_arg (*va, vlib_node_t *);
  int max = va_arg (*va, int);
  f64 v;
  char *state;
  u8 *ns;
  u8 *misc_info = 0;
  u64 c, p, l, d;
  f64 x;
  f64 maxc, maxcn;
  u32 maxn;
  u32 indent;

  if (!n)
    {
      if (max)
	return format (s,
		       "%=30s%=17s%=16s%=16s%=16s%=16s",
		       "Name", "Max Node Clocks", "Vectors at Max",
		       "Max Clocks", "Avg Clocks", "Avg Vectors/Call");
      else
	return format (s,
		       "%=30s%=12s%=16s%=16s%=16s%=16s%=16s",
		       "Name", "State", "Calls", "Vectors", "Suspends",
		       "Clocks", "Vectors/Call");
    }

  indent = format_get_indent (s);

  l = n->stats_total.clocks - n->stats_last_clear.clocks;
  c = n->stats_total.calls - n->stats_last_clear.calls;
  p = n->stats_total.vectors - n->stats_last_clear.vectors;
  d = n->stats_total.suspends - n->stats_last_clear.suspends;
  maxc = (f64) n->stats_total.max_clock;
  maxn = n->stats_total.max_clock_n;
  if (n->stats_total.max_clock_n)
    maxcn = (f64) n->stats_total.max_clock / (f64) maxn;
  else
    maxcn = 0.0;

  /* Clocks per packet, per call or per suspend. */
  x = 0;
  if (p > 0)
    x = (f64) l / (f64) p;
  else if (c > 0)
    x = (f64) l / (f64) c;
  else if (d > 0)
    x = (f64) l / (f64) d;

  if (c > 0)
    v = (double) p / (double) c;
  else
    v = 0;

  state = "active";
  if (n->type == VLIB_NODE_TYPE_PROCESS)
    {
      vlib_process_t *p = vlib_get_process_from_node (vm, n);

      /* Show processes with events pending.  This helps spot bugs where events are not
         being handled. */
      if (!clib_bitmap_is_zero (p->non_empty_event_type_bitmap))
	misc_info = format (misc_info, "events pending, ");

      switch (p->flags & (VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
			  | VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT))
	{
	default:
	  if (!(p->flags & VLIB_PROCESS_IS_RUNNING))
	    state = "done";
	  break;

	case VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK:
	  state = "time wait";
	  break;

	case VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT:
	  state = "event wait";
	  break;

	case (VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT | VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK):
	  state =
	    "any wait";
	  break;
	}
    }
  else if (n->type != VLIB_NODE_TYPE_INTERNAL)
    {
      state = "polling";
      if (n->state == VLIB_NODE_STATE_DISABLED)
	state = "disabled";
      else if (n->state == VLIB_NODE_STATE_INTERRUPT)
	state = "interrupt wait";
    }

  ns = n->name;

  if (max)
    s = format (s, "%-30v%=17.2e%=16d%=16.2e%=16.2e%=16.2e",
		ns, maxc, maxn, maxcn, x, v);
  else
    s = format (s, "%-30v%=12s%16Ld%16Ld%16Ld%16.2e%16.2f", ns, state,
		c, p, d, x, v);

  if (ns != n->name)
    vec_free (ns);

  if (misc_info)
    {
      s = format (s, "\n%U%v", format_white_space, indent + 4, misc_info);
      vec_free (misc_info);
    }

  return s;
}

static clib_error_t *
show_node_runtime (vlib_main_t * vm,
		   unformat_input_t * input, vlib_cli_command_t * cmd)
{
  vlib_node_main_t *nm = &vm->node_main;
  vlib_node_t *n;
  f64 time_now;
  u32 node_index;
  vlib_node_t ***node_dups = 0;
  f64 *vectors_per_main_loop = 0;
  f64 *last_vector_length_per_node = 0;

  time_now = vlib_time_now (vm);

  if (unformat (input, "%U", unformat_vlib_node, vm, &node_index))
    {
      n = vlib_get_node (vm, node_index);
      vlib_node_sync_stats (vm, n);
      vlib_cli_output (vm, "%U\n", format_vlib_node_stats, vm, 0, 0);
      vlib_cli_output (vm, "%U\n", format_vlib_node_stats, vm, n, 0);
    }
  else
    {
      vlib_node_t **nodes;
      uword i, j;
      f64 dt;
      u64 n_input, n_output, n_drop, n_punt;
      u64 n_internal_vectors, n_internal_calls;
      u64 n_clocks, l, v, c, d;
      int brief = 1;
      int max = 0;
      vlib_main_t **stat_vms = 0, *stat_vm;

      /* Suppress nodes with zero calls since last clear */
      if (unformat (input, "brief") || unformat (input, "b"))
	brief = 1;
      if (unformat (input, "verbose") || unformat (input, "v"))
	brief = 0;
      if (unformat (input, "max") || unformat (input, "m"))
	max = 1;

      for (i = 0; i < vec_len (vlib_mains); i++)
	{
	  stat_vm = vlib_mains[i];
	  if (stat_vm)
	    vec_add1 (stat_vms, stat_vm);
	}

      /*
       * Barrier sync across stats scraping.
       * Otherwise, the counts will be grossly inaccurate.
       */
      vlib_worker_thread_barrier_sync (vm);

      for (j = 0; j < vec_len (stat_vms); j++)
	{
	  stat_vm = stat_vms[j];
	  nm = &stat_vm->node_main;

	  for (i = 0; i < vec_len (nm->nodes); i++)
	    {
	      n = nm->nodes[i];
	      vlib_node_sync_stats (stat_vm, n);
	    }

	  nodes = vec_dup (nm->nodes);

	  vec_add1 (node_dups, nodes);
	  vec_add1 (vectors_per_main_loop,
		    vlib_last_vectors_per_main_loop_as_f64 (stat_vm));
	  vec_add1 (last_vector_length_per_node,
		    vlib_last_vector_length_per_node (stat_vm));
	}
      vlib_worker_thread_barrier_release (vm);


      for (j = 0; j < vec_len (stat_vms); j++)
	{
	  stat_vm = stat_vms[j];
	  nodes = node_dups[j];

	  vec_sort_with_function (nodes, node_cmp);

	  n_input = n_output = n_drop = n_punt = n_clocks = 0;
	  n_internal_vectors = n_internal_calls = 0;
	  for (i = 0; i < vec_len (nodes); i++)
	    {
	      n = nodes[i];

	      l = n->stats_total.clocks - n->stats_last_clear.clocks;
	      n_clocks += l;

	      v = n->stats_total.vectors - n->stats_last_clear.vectors;
	      c = n->stats_total.calls - n->stats_last_clear.calls;

	      switch (n->type)
		{
		default:
		  continue;

		case VLIB_NODE_TYPE_INTERNAL:
		  n_output += (n->flags & VLIB_NODE_FLAG_IS_OUTPUT) ? v : 0;
		  n_drop += (n->flags & VLIB_NODE_FLAG_IS_DROP) ? v : 0;
		  n_punt += (n->flags & VLIB_NODE_FLAG_IS_PUNT) ? v : 0;
		  if (!(n->flags & VLIB_NODE_FLAG_IS_OUTPUT))
		    {
		      n_internal_vectors += v;
		      n_internal_calls += c;
		    }
		  if (n->flags & VLIB_NODE_FLAG_IS_HANDOFF)
		    n_input += v;
		  break;

		case VLIB_NODE_TYPE_INPUT:
		  n_input += v;
		  break;
		}
	    }

	  if (vec_len (vlib_mains) > 1)
	    {
	      vlib_worker_thread_t *w = vlib_worker_threads + j;
	      if (j > 0)
		vlib_cli_output (vm, "---------------");

	      if (w->lcore_id > -1)
		vlib_cli_output (vm, "Thread %d %s (lcore %u)", j, w->name,
				 w->lcore_id);
	      else
		vlib_cli_output (vm, "Thread %d %s", j, w->name);
	    }

	  dt = time_now - nm->time_last_runtime_stats_clear;
	  vlib_cli_output
	    (vm,
	     "Time %.1f, average vectors/node %.2f, last %d main loops %.2f per node %.2f"
	     "\n  vector rates in %.4e, out %.4e, drop %.4e, punt %.4e",
	     dt,
	     (n_internal_calls > 0
	      ? (f64) n_internal_vectors / (f64) n_internal_calls
	      : 0),
	     1 << VLIB_LOG2_MAIN_LOOPS_PER_STATS_UPDATE,
	     vectors_per_main_loop[j],
	     last_vector_length_per_node[j],
	     (f64) n_input / dt,
	     (f64) n_output / dt, (f64) n_drop / dt, (f64) n_punt / dt);

	  vlib_cli_output (vm, "%U", format_vlib_node_stats, stat_vm, 0, max);
	  for (i = 0; i < vec_len (nodes); i++)
	    {
	      c =
		nodes[i]->stats_total.calls -
		nodes[i]->stats_last_clear.calls;
	      d =
		nodes[i]->stats_total.suspends -
		nodes[i]->stats_last_clear.suspends;
	      if (c || d || !brief)
		{
		  vlib_cli_output (vm, "%U", format_vlib_node_stats, stat_vm,
				   nodes[i], max);
		}
	    }
	  vec_free (nodes);
	}
      vec_free (stat_vms);
      vec_free (node_dups);
      vec_free (vectors_per_main_loop);
      vec_free (last_vector_length_per_node);
    }

  return 0;
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_node_runtime_command, static) = {
  .path = "show runtime",
  .short_help = "Show packet processing runtime",
  .function = show_node_runtime,
  .is_mp_safe = 1,
};
/* *INDENT-ON* */

static clib_error_t *
clear_node_runtime (vlib_main_t * vm,
		    unformat_input_t * input, vlib_cli_command_t * cmd)
{
  vlib_node_main_t *nm;
  vlib_node_t *n;
  int i, j;
  vlib_main_t **stat_vms = 0, *stat_vm;
  vlib_node_runtime_t *r;

  for (i = 0; i < vec_len (vlib_mains); i++)
    {
      stat_vm = vlib_mains[i];
      if (stat_vm)
	vec_add1 (stat_vms, stat_vm);
    }

  vlib_worker_thread_barrier_sync (vm);

  for (j = 0; j < vec_len (stat_vms); j++)
    {
      stat_vm = stat_vms[j];
      nm = &stat_vm->node_main;

      for (i = 0; i < vec_len (nm->nodes); i++)
	{
	  n = nm->nodes[i];
	  vlib_node_sync_stats (stat_vm, n);
	  n->stats_last_clear = n->stats_total;

	  r = vlib_node_get_runtime (stat_vm, n->index);
	  r->max_clock = 0;
	}
      /* Note: input/output rates computed using vlib_global_main */
      nm->time_last_runtime_stats_clear = vlib_time_now (vm);
    }

  vlib_worker_thread_barrier_release (vm);

  vec_free (stat_vms);

  return 0;
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (clear_node_runtime_command, static) = {
  .path = "clear runtime",
  .short_help = "Clear packet processing runtime statistics",
  .function = clear_node_runtime,
};
/* *INDENT-ON* */

/* Dummy function to get us linked in. */
void
vlib_node_cli_reference (void)
{
}

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
len0); } else { next0 = IP6_MAPT_ICMP_NEXT_DROP; } p0->error = error_node->errors[error0]; vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, pi0, next0); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } return frame->n_vectors; } static int ip6_to_ip4_set_cb (ip6_header_t * ip6, ip4_header_t * ip4, void *ctx) { vlib_buffer_t *p = ctx; ip4->dst_address.as_u32 = vnet_buffer (p)->map_t.v6.daddr; ip4->src_address.as_u32 = vnet_buffer (p)->map_t.v6.saddr; return 0; } static uword ip6_map_t_fragmented (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { u32 n_left_from, *from, next_index, *to_next, n_left_to_next; from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; next_index = node->cached_next_index; vlib_node_runtime_t *error_node = vlib_node_get_runtime (vm, ip6_map_t_fragmented_node.index); while (n_left_from > 0) { vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); #ifdef IP6_MAP_T_DUAL_LOOP while (n_left_from >= 4 && n_left_to_next >= 2) { u32 pi0, pi1; vlib_buffer_t *p0, *p1; u32 next0, next1; pi0 = to_next[0] = from[0]; pi1 = to_next[1] = from[1]; from += 2; n_left_from -= 2; to_next += 2; n_left_to_next -= 2; next0 = IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP; next1 = IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP; p0 = vlib_get_buffer (vm, pi0); p1 = vlib_get_buffer (vm, pi1); if (ip6_to_ip4_fragmented (p0, ip6_to_ip4_set_cb, p0)) { p0->error = error_node->errors[MAP_ERROR_FRAGMENT_DROPPED]; next0 = IP6_MAPT_FRAGMENTED_NEXT_DROP; } else { if (vnet_buffer (p0)->map_t.mtu < p0->current_length) { //Send to fragmentation node if necessary vnet_buffer (p0)->ip_frag.mtu = vnet_buffer (p0)->map_t.mtu; vnet_buffer (p0)->ip_frag.next_index = IP4_FRAG_NEXT_IP4_LOOKUP; next0 = IP6_MAPT_FRAGMENTED_NEXT_IP4_FRAG; } } if (ip6_to_ip4_fragmented (p1, ip6_to_ip4_set_cb, p1)) { p1->error = error_node->errors[MAP_ERROR_FRAGMENT_DROPPED]; next1 = IP6_MAPT_FRAGMENTED_NEXT_DROP; } else { if (vnet_buffer (p1)->map_t.mtu < p1->current_length) { //Send to fragmentation node if necessary vnet_buffer (p1)->ip_frag.mtu = vnet_buffer (p1)->map_t.mtu; vnet_buffer (p1)->ip_frag.next_index = IP4_FRAG_NEXT_IP4_LOOKUP; next1 = IP6_MAPT_FRAGMENTED_NEXT_IP4_FRAG; } } vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next, n_left_to_next, pi0, pi1, next0, next1); } #endif while (n_left_from > 0 && n_left_to_next > 0) { u32 pi0; vlib_buffer_t *p0; u32 next0; pi0 = to_next[0] = from[0]; from += 1; n_left_from -= 1; to_next += 1; n_left_to_next -= 1; next0 = IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP; p0 = vlib_get_buffer (vm, pi0); if (ip6_to_ip4_fragmented (p0, ip6_to_ip4_set_cb, p0)) { p0->error = error_node->errors[MAP_ERROR_FRAGMENT_DROPPED]; next0 = IP6_MAPT_FRAGMENTED_NEXT_DROP; } else { if (vnet_buffer (p0)->map_t.mtu < p0->current_length) { //Send to fragmentation node if necessary vnet_buffer (p0)->ip_frag.mtu = vnet_buffer (p0)->map_t.mtu; vnet_buffer (p0)->ip_frag.next_index = IP4_FRAG_NEXT_IP4_LOOKUP; next0 = IP6_MAPT_FRAGMENTED_NEXT_IP4_FRAG; } } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, pi0, next0); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } return frame->n_vectors; } static uword ip6_map_t_tcp_udp (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { u32 n_left_from, *from, next_index, *to_next, n_left_to_next; vlib_node_runtime_t *error_node = vlib_node_get_runtime (vm, ip6_map_t_tcp_udp_node.index); from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; next_index = node->cached_next_index; while (n_left_from > 0) { vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); #ifdef IP6_MAP_T_DUAL_LOOP while (n_left_from >= 4 && n_left_to_next >= 2) { u32 pi0, pi1; vlib_buffer_t *p0, *p1; ip6_mapt_tcp_udp_next_t next0, next1; pi0 = to_next[0] = from[0]; pi1 = to_next[1] = from[1]; from += 2; n_left_from -= 2; to_next += 2; n_left_to_next -= 2; next0 = IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP; next1 = IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP; p0 = vlib_get_buffer (vm, pi0); p1 = vlib_get_buffer (vm, pi1); if (ip6_to_ip4_tcp_udp (p0, ip6_to_ip4_set_cb, p0, 1)) { p0->error = error_node->errors[MAP_ERROR_UNKNOWN]; next0 = IP6_MAPT_TCP_UDP_NEXT_DROP; } else { if (vnet_buffer (p0)->map_t.mtu < p0->current_length) { //Send to fragmentation node if necessary vnet_buffer (p0)->ip_frag.mtu = vnet_buffer (p0)->map_t.mtu; vnet_buffer (p0)->ip_frag.next_index = IP4_FRAG_NEXT_IP4_LOOKUP; next0 = IP6_MAPT_TCP_UDP_NEXT_IP4_FRAG; } } if (ip6_to_ip4_tcp_udp (p1, ip6_to_ip4_set_cb, p1, 1)) { p1->error = error_node->errors[MAP_ERROR_UNKNOWN]; next1 = IP6_MAPT_TCP_UDP_NEXT_DROP; } else { if (vnet_buffer (p1)->map_t.mtu < p1->current_length) { //Send to fragmentation node if necessary vnet_buffer (p1)->ip_frag.mtu = vnet_buffer (p1)->map_t.mtu; vnet_buffer (p1)->ip_frag.next_index = IP4_FRAG_NEXT_IP4_LOOKUP; next1 = IP6_MAPT_TCP_UDP_NEXT_IP4_FRAG; } } vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next, n_left_to_next, pi0, pi1, next0, next1); } #endif while (n_left_from > 0 && n_left_to_next > 0) { u32 pi0; vlib_buffer_t *p0; ip6_mapt_tcp_udp_next_t next0; pi0 = to_next[0] = from[0]; from += 1; n_left_from -= 1; to_next += 1; n_left_to_next -= 1; next0 = IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP; p0 = vlib_get_buffer (vm, pi0); if (ip6_to_ip4_tcp_udp (p0, ip6_to_ip4_set_cb, p0, 1)) { p0->error = error_node->errors[MAP_ERROR_UNKNOWN]; next0 = IP6_MAPT_TCP_UDP_NEXT_DROP; } else { if (vnet_buffer (p0)->map_t.mtu < p0->current_length) { //Send to fragmentation node if necessary vnet_buffer (p0)->ip_frag.mtu = vnet_buffer (p0)->map_t.mtu; vnet_buffer (p0)->ip_frag.next_index = IP4_FRAG_NEXT_IP4_LOOKUP; next0 = IP6_MAPT_TCP_UDP_NEXT_IP4_FRAG; } } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, pi0, next0); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } return frame->n_vectors; } static_always_inline void ip6_map_t_classify (vlib_buffer_t * p0, ip6_header_t * ip60, map_domain_t * d0, i32 * map_port0, u8 * error0, ip6_mapt_next_t * next0, u32 l4_len0, ip6_frag_hdr_t * frag0) { map_main_t *mm = &map_main; u32 port_offset; if (mm->is_ce) port_offset = 2; else port_offset = 0; if (PREDICT_FALSE (vnet_buffer (p0)->map_t.v6.frag_offset && ip6_frag_hdr_offset (frag0))) { *next0 = IP6_MAPT_NEXT_MAPT_FRAGMENTED; if (d0->ea_bits_len == 0 && d0->rules) { *map_port0 = 0; } else { *map_port0 = ip6_map_fragment_get (ip60, frag0, d0); *error0 = (*map_port0 != -1) ? *error0 : MAP_ERROR_FRAGMENT_DROPPED; } } else if (PREDICT_TRUE (vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_TCP)) { *error0 = l4_len0 < sizeof (tcp_header_t) ? MAP_ERROR_MALFORMED : *error0; vnet_buffer (p0)->map_t.checksum_offset = vnet_buffer (p0)->map_t.v6.l4_offset + 16; *next0 = IP6_MAPT_NEXT_MAPT_TCP_UDP; *map_port0 = (i32) * ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset + port_offset)); } else if (PREDICT_TRUE (vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_UDP)) { *error0 = l4_len0 < sizeof (udp_header_t) ? MAP_ERROR_MALFORMED : *error0; vnet_buffer (p0)->map_t.checksum_offset = vnet_buffer (p0)->map_t.v6.l4_offset + 6; *next0 = IP6_MAPT_NEXT_MAPT_TCP_UDP; *map_port0 = (i32) * ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset + port_offset)); } else if (vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_ICMP6) { *error0 = l4_len0 < sizeof (icmp46_header_t) ? MAP_ERROR_MALFORMED : *error0; *next0 = IP6_MAPT_NEXT_MAPT_ICMP; if (d0->ea_bits_len == 0 && d0->rules) { *map_port0 = 0; } else if (((icmp46_header_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset))->code == ICMP6_echo_reply || ((icmp46_header_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset))->code == ICMP6_echo_request) { *map_port0 = (i32) * ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset + 6)); } } else { //TODO: In case of 1:1 mapping, it might be possible to do something with those packets. *error0 = MAP_ERROR_BAD_PROTOCOL; } } static uword ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { u32 n_left_from, *from, next_index, *to_next, n_left_to_next; vlib_node_runtime_t *error_node = vlib_node_get_runtime (vm, ip6_map_t_node.index); map_main_t *mm = &map_main; vlib_combined_counter_main_t *cm = map_main.domain_counters; u32 thread_index = vm->thread_index; from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; next_index = node->cached_next_index; while (n_left_from > 0) { vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); #ifdef IP6_MAP_T_DUAL_LOOP while (n_left_from >= 4 && n_left_to_next >= 2) { u32 pi0, pi1; vlib_buffer_t *p0, *p1; ip6_header_t *ip60, *ip61; u8 error0, error1; ip6_mapt_next_t next0, next1; u32 l4_len0, l4_len1; i32 map_port0, map_port1; map_domain_t *d0, *d1; ip6_frag_hdr_t *frag0, *frag1; next0 = next1 = 0; //Because compiler whines pi0 = to_next[0] = from[0]; pi1 = to_next[1] = from[1]; from += 2; n_left_from -= 2; to_next += 2; n_left_to_next -= 2; error0 = MAP_ERROR_NONE; error1 = MAP_ERROR_NONE; p0 = vlib_get_buffer (vm, pi0); p1 = vlib_get_buffer (vm, pi1); ip60 = vlib_buffer_get_current (p0); ip61 = vlib_buffer_get_current (p1); if (mm->is_ce) { u32 daddr0, daddr1; daddr0 = 0; /* TODO */ daddr1 = 0; /* TODO */ /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ daddr0 = map_get_ip4 (&ip60->dst_address, 0 /*TODO*/); daddr1 = map_get_ip4 (&ip61->dst_address, 0 /*TODO*/); d0 = ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], (ip4_address_t *) & daddr0, &vnet_buffer (p0)->map_t.map_domain_index, &error0); d1 = ip6_map_get_domain (vnet_buffer (p1)->ip.adj_index[VLIB_TX], (ip4_address_t *) & daddr1, &vnet_buffer (p1)->map_t.map_domain_index, &error1); daddr0 = map_get_ip4 (&ip60->dst_address, d0->flags); daddr1 = map_get_ip4 (&ip61->dst_address, d1->flags); vnet_buffer (p0)->map_t.v6.daddr = daddr0; vnet_buffer (p1)->map_t.v6.daddr = daddr1; vnet_buffer (p0)->map_t.v6.saddr = ip6_map_t_embedded_address (d0, &ip60->src_address); vnet_buffer (p1)->map_t.v6.saddr = ip6_map_t_embedded_address (d1, &ip61->src_address); } else { u32 saddr0, saddr1; saddr0 = 0; /* TODO */ saddr1 = 0; /* TODO */ /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ saddr0 = map_get_ip4 (&ip60->src_address, 0 /*TODO*/); saddr1 = map_get_ip4 (&ip61->src_address, 0 /*TODO*/); d0 = ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], (ip4_address_t *) & saddr0, &vnet_buffer (p0)->map_t.map_domain_index, &error0); d1 = ip6_map_get_domain (vnet_buffer (p1)->ip.adj_index[VLIB_TX], (ip4_address_t *) & saddr1, &vnet_buffer (p1)->map_t.map_domain_index, &error1); saddr0 = map_get_ip4 (&ip60->src_address, d0->flags); saddr1 = map_get_ip4 (&ip61->src_address, d1->flags); vnet_buffer (p0)->map_t.v6.saddr = saddr0; vnet_buffer (p1)->map_t.v6.saddr = saddr1; vnet_buffer (p0)->map_t.v6.daddr = ip6_map_t_embedded_address (d0, &ip60->dst_address); vnet_buffer (p1)->map_t.v6.daddr = ip6_map_t_embedded_address (d1, &ip61->dst_address); } vnet_buffer (p0)->map_t.mtu = d0->mtu ? d0->mtu : ~0; vnet_buffer (p1)->map_t.mtu = d1->mtu ? d1->mtu : ~0; if (PREDICT_FALSE (ip6_parse (ip60, p0->current_length, &(vnet_buffer (p0)->map_t. v6.l4_protocol), &(vnet_buffer (p0)->map_t. v6.l4_offset), &(vnet_buffer (p0)->map_t. v6.frag_offset)))) { error0 = MAP_ERROR_MALFORMED; next0 = IP6_MAPT_NEXT_DROP; } if (PREDICT_FALSE (ip6_parse (ip61, p1->current_length, &(vnet_buffer (p1)->map_t. v6.l4_protocol), &(vnet_buffer (p1)->map_t. v6.l4_offset), &(vnet_buffer (p1)->map_t. v6.frag_offset)))) { error1 = MAP_ERROR_MALFORMED; next1 = IP6_MAPT_NEXT_DROP; } map_port0 = map_port1 = -1; l4_len0 = (u32) clib_net_to_host_u16 (ip60->payload_length) + sizeof (*ip60) - vnet_buffer (p0)->map_t.v6.l4_offset; l4_len1 = (u32) clib_net_to_host_u16 (ip61->payload_length) + sizeof (*ip60) - vnet_buffer (p1)->map_t.v6.l4_offset; frag0 = (ip6_frag_hdr_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t. v6.frag_offset); frag1 = (ip6_frag_hdr_t *) u8_ptr_add (ip61, vnet_buffer (p1)->map_t. v6.frag_offset); ip6_map_t_classify (p0, ip60, d0, &map_port0, &error0, &next0, l4_len0, frag0); ip6_map_t_classify (p1, ip61, d1, &map_port1, &error1, &next1, l4_len1, frag1); if (PREDICT_FALSE ((map_port0 != -1) && (ip60->src_address.as_u64[0] != map_get_pfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr, map_port0) || ip60->src_address.as_u64[1] != map_get_sfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr, map_port0)))) { error0 = MAP_ERROR_SEC_CHECK; } if (PREDICT_FALSE ((map_port1 != -1) && (ip61->src_address.as_u64[0] != map_get_pfx_net (d1, vnet_buffer (p1)->map_t.v6.saddr, map_port1) || ip61->src_address.as_u64[1] != map_get_sfx_net (d1, vnet_buffer (p1)->map_t.v6.saddr, map_port1)))) { error1 = MAP_ERROR_SEC_CHECK; } if (PREDICT_FALSE (vnet_buffer (p0)->map_t.v6.frag_offset && !ip6_frag_hdr_offset ((ip6_frag_hdr_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t. v6.frag_offset))) && (map_port0 != -1) && (d0->ea_bits_len != 0 || !d0->rules) && (error0 == MAP_ERROR_NONE)) { ip6_map_fragment_cache (ip60, (ip6_frag_hdr_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t. v6.frag_offset), d0, map_port0); } if (PREDICT_FALSE (vnet_buffer (p1)->map_t.v6.frag_offset && !ip6_frag_hdr_offset ((ip6_frag_hdr_t *) u8_ptr_add (ip61, vnet_buffer (p1)->map_t. v6.frag_offset))) && (map_port1 != -1) && (d1->ea_bits_len != 0 || !d1->rules) && (error1 == MAP_ERROR_NONE)) { ip6_map_fragment_cache (ip61, (ip6_frag_hdr_t *) u8_ptr_add (ip61, vnet_buffer (p1)->map_t. v6.frag_offset), d1, map_port1); } if (PREDICT_TRUE (error0 == MAP_ERROR_NONE && next0 != IP6_MAPT_NEXT_MAPT_ICMP)) { vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_RX, thread_index, vnet_buffer (p0)-> map_t.map_domain_index, 1, clib_net_to_host_u16 (ip60->payload_length)); } if (PREDICT_TRUE (error1 == MAP_ERROR_NONE && next1 != IP6_MAPT_NEXT_MAPT_ICMP)) { vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_RX, thread_index, vnet_buffer (p1)-> map_t.map_domain_index, 1, clib_net_to_host_u16 (ip61->payload_length)); } next0 = (error0 != MAP_ERROR_NONE) ? IP6_MAPT_NEXT_DROP : next0; next1 = (error1 != MAP_ERROR_NONE) ? IP6_MAPT_NEXT_DROP : next1; p0->error = error_node->errors[error0]; p1->error = error_node->errors[error1]; vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next, n_left_to_next, pi0, pi1, next0, next1); } #endif while (n_left_from > 0 && n_left_to_next > 0) { u32 pi0; vlib_buffer_t *p0; ip6_header_t *ip60; u8 error0; u32 l4_len0; i32 map_port0; map_domain_t *d0; ip6_frag_hdr_t *frag0; u32 port_offset; ip6_mapt_next_t next0 = 0; pi0 = to_next[0] = from[0]; from += 1; n_left_from -= 1; to_next += 1; n_left_to_next -= 1; error0 = MAP_ERROR_NONE; p0 = vlib_get_buffer (vm, pi0); ip60 = vlib_buffer_get_current (p0); if (mm->is_ce) { u32 daddr; //Save daddr in a different variable to not overwrite ip.adj_index daddr = 0; /* TODO */ /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ daddr = map_get_ip4 (&ip60->dst_address, 0 /*TODO*/); d0 = ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], (ip4_address_t *) & daddr, &vnet_buffer (p0)->map_t.map_domain_index, &error0); daddr = map_get_ip4 (&ip60->dst_address, d0->flags); //FIXME: What if d0 is null vnet_buffer (p0)->map_t.v6.daddr = daddr; vnet_buffer (p0)->map_t.v6.saddr = ip6_map_t_embedded_address (d0, &ip60->src_address); port_offset = 2; } else { u32 saddr; //Save saddr in a different variable to not overwrite ip.adj_index saddr = 0; /* TODO */ /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ saddr = map_get_ip4 (&ip60->src_address, 0 /*TODO*/); d0 = ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], (ip4_address_t *) & saddr, &vnet_buffer (p0)->map_t.map_domain_index, &error0); saddr = map_get_ip4 (&ip60->src_address, d0->flags); //FIXME: What if d0 is null vnet_buffer (p0)->map_t.v6.saddr = saddr; vnet_buffer (p0)->map_t.v6.daddr = ip6_map_t_embedded_address (d0, &ip60->dst_address); port_offset = 0; } vnet_buffer (p0)->map_t.mtu = d0->mtu ? d0->mtu : ~0; if (PREDICT_FALSE (ip6_parse (ip60, p0->current_length, &(vnet_buffer (p0)->map_t. v6.l4_protocol), &(vnet_buffer (p0)->map_t. v6.l4_offset), &(vnet_buffer (p0)->map_t. v6.frag_offset)))) { error0 = MAP_ERROR_MALFORMED; next0 = IP6_MAPT_NEXT_DROP; } map_port0 = -1; l4_len0 = (u32) clib_net_to_host_u16 (ip60->payload_length) + sizeof (*ip60) - vnet_buffer (p0)->map_t.v6.l4_offset; frag0 = (ip6_frag_hdr_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t. v6.frag_offset); if (PREDICT_FALSE (vnet_buffer (p0)->map_t.v6.frag_offset && ip6_frag_hdr_offset (frag0))) { map_port0 = ip6_map_fragment_get (ip60, frag0, d0); error0 = (map_port0 != -1) ? error0 : MAP_ERROR_FRAGMENT_MEMORY; next0 = IP6_MAPT_NEXT_MAPT_FRAGMENTED; } else if (PREDICT_TRUE (vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_TCP)) { error0 = l4_len0 < sizeof (tcp_header_t) ? MAP_ERROR_MALFORMED : error0; vnet_buffer (p0)->map_t.checksum_offset = vnet_buffer (p0)->map_t.v6.l4_offset + 16; next0 = IP6_MAPT_NEXT_MAPT_TCP_UDP; map_port0 = (i32) * ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset + port_offset)); } else if (PREDICT_TRUE (vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_UDP)) { error0 = l4_len0 < sizeof (udp_header_t) ? MAP_ERROR_MALFORMED : error0; vnet_buffer (p0)->map_t.checksum_offset = vnet_buffer (p0)->map_t.v6.l4_offset + 6; next0 = IP6_MAPT_NEXT_MAPT_TCP_UDP; map_port0 = (i32) * ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset + port_offset)); } else if (vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_ICMP6) { error0 = l4_len0 < sizeof (icmp46_header_t) ? MAP_ERROR_MALFORMED : error0; next0 = IP6_MAPT_NEXT_MAPT_ICMP; if (((icmp46_header_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset))->code == ICMP6_echo_reply || ((icmp46_header_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6. l4_offset))->code == ICMP6_echo_request) map_port0 = (i32) * ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset + 6)); } else { //TODO: In case of 1:1 mapping, it might be possible to do something with those packets. error0 = MAP_ERROR_BAD_PROTOCOL; } //Security check if (PREDICT_FALSE ((!mm->is_ce) && (map_port0 != -1) && (ip60->src_address.as_u64[0] != map_get_pfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr, map_port0) || ip60->src_address.as_u64[1] != map_get_sfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr, map_port0)))) { //Security check when src_port0 is not zero (non-first fragment, UDP or TCP) error0 = MAP_ERROR_SEC_CHECK; } //Fragmented first packet needs to be cached for following packets if (PREDICT_FALSE (vnet_buffer (p0)->map_t.v6.frag_offset && !ip6_frag_hdr_offset ((ip6_frag_hdr_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t. v6.frag_offset))) && (map_port0 != -1) && (d0->ea_bits_len != 0 || !d0->rules) && (error0 == MAP_ERROR_NONE)) { ip6_map_fragment_cache (ip60, (ip6_frag_hdr_t *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t. v6.frag_offset), d0, map_port0); } if (PREDICT_TRUE (error0 == MAP_ERROR_NONE && next0 != IP6_MAPT_NEXT_MAPT_ICMP)) { vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_RX, thread_index, vnet_buffer (p0)-> map_t.map_domain_index, 1, clib_net_to_host_u16 (ip60->payload_length)); } next0 = (error0 != MAP_ERROR_NONE) ? IP6_MAPT_NEXT_DROP : next0; p0->error = error_node->errors[error0]; vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, pi0, next0); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } return frame->n_vectors; } static char *map_t_error_strings[] = { #define _(sym,string) string, foreach_map_error #undef _ }; /* *INDENT-OFF* */ VLIB_REGISTER_NODE(ip6_map_t_fragmented_node) = { .function = ip6_map_t_fragmented, .name = "ip6-map-t-fragmented", .vector_size = sizeof (u32), .format_trace = format_map_trace, .type = VLIB_NODE_TYPE_INTERNAL, .n_errors = MAP_N_ERROR, .error_strings = map_t_error_strings, .n_next_nodes = IP6_MAPT_FRAGMENTED_N_NEXT, .next_nodes = { [IP6_MAPT_FRAGMENTED_NEXT_IP4_LOOKUP] = "ip4-lookup", [IP6_MAPT_FRAGMENTED_NEXT_IP4_FRAG] = IP4_FRAG_NODE_NAME, [IP6_MAPT_FRAGMENTED_NEXT_DROP] = "error-drop", }, }; /* *INDENT-ON* */ /* *INDENT-OFF* */ VLIB_REGISTER_NODE(ip6_map_t_icmp_node) = { .function = ip6_map_t_icmp, .name = "ip6-map-t-icmp", .vector_size = sizeof (u32), .format_trace = format_map_trace, .type = VLIB_NODE_TYPE_INTERNAL, .n_errors = MAP_N_ERROR, .error_strings = map_t_error_strings, .n_next_nodes = IP6_MAPT_ICMP_N_NEXT, .next_nodes = { [IP6_MAPT_ICMP_NEXT_IP4_LOOKUP] = "ip4-lookup", [IP6_MAPT_ICMP_NEXT_IP4_FRAG] = IP4_FRAG_NODE_NAME, [IP6_MAPT_ICMP_NEXT_DROP] = "error-drop", }, }; /* *INDENT-ON* */ /* *INDENT-OFF* */ VLIB_REGISTER_NODE(ip6_map_t_tcp_udp_node) = { .function = ip6_map_t_tcp_udp, .name = "ip6-map-t-tcp-udp", .vector_size = sizeof (u32), .format_trace = format_map_trace, .type = VLIB_NODE_TYPE_INTERNAL, .n_errors = MAP_N_ERROR, .error_strings = map_t_error_strings, .n_next_nodes = IP6_MAPT_TCP_UDP_N_NEXT, .next_nodes = { [IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP] = "ip4-lookup", [IP6_MAPT_TCP_UDP_NEXT_IP4_FRAG] = IP4_FRAG_NODE_NAME, [IP6_MAPT_TCP_UDP_NEXT_DROP] = "error-drop", }, }; /* *INDENT-ON* */ /* *INDENT-OFF* */ VLIB_REGISTER_NODE(ip6_map_t_node) = { .function = ip6_map_t, .name = "ip6-map-t", .vector_size = sizeof(u32), .format_trace = format_map_trace, .type = VLIB_NODE_TYPE_INTERNAL, .n_errors = MAP_N_ERROR, .error_strings = map_t_error_strings, .n_next_nodes = IP6_MAPT_N_NEXT, .next_nodes = { [IP6_MAPT_NEXT_MAPT_TCP_UDP] = "ip6-map-t-tcp-udp", [IP6_MAPT_NEXT_MAPT_ICMP] = "ip6-map-t-icmp", [IP6_MAPT_NEXT_MAPT_FRAGMENTED] = "ip6-map-t-fragmented", [IP6_MAPT_NEXT_DROP] = "error-drop", }, }; /* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */