blob: 10deb2e88491fe83eaaa65374ce54278a5387cdd [file] [log] [blame]
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -07001/*
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:
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
16/**
17 * @file
18 * @brief Local TCP/IP stack punt infrastructure.
19 *
Ole Troanf7a55ad2017-05-16 14:59:29 +020020 * Provides a set of VPP nodes together with the relevant APIs and CLI
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -070021 * commands in order to adjust and dispatch packets from the VPP data plane
22 * to the local TCP/IP stack
23 */
Ole Troanf7a55ad2017-05-16 14:59:29 +020024
25#include <vnet/ip/ip.h>
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -070026#include <vlib/vlib.h>
Dave Barach68b0fb02017-02-28 15:15:56 -050027#include <vnet/udp/udp.h>
Pierre Pfister7fe51f32017-09-20 08:48:36 +020028#include <vnet/tcp/tcp.h>
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -070029#include <vnet/ip/punt.h>
Ole Troanf7a55ad2017-05-16 14:59:29 +020030#include <vlib/unix/unix.h>
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -070031
Ole Troanf7a55ad2017-05-16 14:59:29 +020032#include <stdio.h>
33#include <unistd.h>
34#include <sys/socket.h>
Marco Varlese22349832017-09-08 10:40:34 +020035#include <sys/uio.h>
Ole Troanf7a55ad2017-05-16 14:59:29 +020036#include <stdlib.h>
Ole Troanf7a55ad2017-05-16 14:59:29 +020037
Ole Troanf7a55ad2017-05-16 14:59:29 +020038punt_main_t punt_main;
39
40char *
41vnet_punt_get_server_pathname (void)
42{
43 punt_main_t *pm = &punt_main;
44 return pm->sun_path;
45}
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -070046
Ole Troanf7a55ad2017-05-16 14:59:29 +020047static void
Neale Ranns50f0ac02019-05-15 02:13:37 -070048punt_client_l4_db_add (ip_address_family_t af, u16 port, u32 index)
Ole Troanf7a55ad2017-05-16 14:59:29 +020049{
50 punt_main_t *pm = &punt_main;
Ole Troanf7a55ad2017-05-16 14:59:29 +020051
Neale Ranns50f0ac02019-05-15 02:13:37 -070052 pm->db.clients_by_l4_port = hash_set (pm->db.clients_by_l4_port,
53 punt_client_l4_mk_key (af, port),
54 index);
Ole Troanf7a55ad2017-05-16 14:59:29 +020055}
56
Neale Ranns50f0ac02019-05-15 02:13:37 -070057static u32
58punt_client_l4_db_remove (ip_address_family_t af, u16 port)
Ole Troanf7a55ad2017-05-16 14:59:29 +020059{
Neale Ranns50f0ac02019-05-15 02:13:37 -070060 punt_main_t *pm = &punt_main;
61 u32 key, index = ~0;
62 uword *p;
63
64 key = punt_client_l4_mk_key (af, port);
65 p = hash_get (pm->db.clients_by_l4_port, key);
66
67 if (p)
68 index = p[0];
69
70 hash_unset (pm->db.clients_by_l4_port, key);
71
72 return (index);
73}
74
75static void
Neale Rannsb538dd82019-05-21 06:54:54 -070076punt_client_ip_proto_db_add (ip_address_family_t af,
77 ip_protocol_t proto, u32 index)
78{
79 punt_main_t *pm = &punt_main;
80
81 pm->db.clients_by_ip_proto = hash_set (pm->db.clients_by_ip_proto,
82 punt_client_ip_proto_mk_key (af,
83 proto),
84 index);
85}
86
87static u32
88punt_client_ip_proto_db_remove (ip_address_family_t af, ip_protocol_t proto)
89{
90 punt_main_t *pm = &punt_main;
91 u32 key, index = ~0;
92 uword *p;
93
94 key = punt_client_ip_proto_mk_key (af, proto);
95 p = hash_get (pm->db.clients_by_ip_proto, key);
96
97 if (p)
98 index = p[0];
99
100 hash_unset (pm->db.clients_by_ip_proto, key);
101
102 return (index);
103}
104
105static void
Neale Ranns50f0ac02019-05-15 02:13:37 -0700106punt_client_exception_db_add (vlib_punt_reason_t reason, u32 pci)
107{
108 punt_main_t *pm = &punt_main;
109
110 vec_validate_init_empty (pm->db.clients_by_exception, reason, ~0);
111
112 pm->db.clients_by_exception[reason] = pci;
113}
114
115static u32
116punt_client_exception_db_remove (vlib_punt_reason_t reason)
117{
118 punt_main_t *pm = &punt_main;
119 u32 pci = ~0;
120
121 if (punt_client_exception_get (reason))
122 {
123 pci = pm->db.clients_by_exception[reason];
124 pm->db.clients_by_exception[reason] = ~0;
125 }
126
127 return pci;
128}
Ole Troanf7a55ad2017-05-16 14:59:29 +0200129
130static clib_error_t *
Damjan Marion56dd5432017-09-08 19:52:02 +0200131punt_socket_read_ready (clib_file_t * uf)
Ole Troanf7a55ad2017-05-16 14:59:29 +0200132{
133 vlib_main_t *vm = vlib_get_main ();
134 punt_main_t *pm = &punt_main;
135
136 /** Schedule the rx node */
137 vlib_node_set_interrupt_pending (vm, punt_socket_rx_node.index);
138 vec_add1 (pm->ready_fds, uf->file_descriptor);
139
140 return 0;
141}
142
Neale Ranns50f0ac02019-05-15 02:13:37 -0700143static clib_error_t *
144punt_socket_register_l4 (vlib_main_t * vm,
145 ip_address_family_t af,
146 u8 protocol, u16 port, char *client_pathname)
Ole Troanf7a55ad2017-05-16 14:59:29 +0200147{
148 punt_main_t *pm = &punt_main;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700149 punt_client_t *c;
Ole Troanf7a55ad2017-05-16 14:59:29 +0200150
151 /* For now we only support UDP punt */
152 if (protocol != IP_PROTOCOL_UDP)
153 return clib_error_return (0,
154 "only UDP protocol (%d) is supported, got %d",
155 IP_PROTOCOL_UDP, protocol);
156
157 if (port == (u16) ~ 0)
158 return clib_error_return (0, "UDP port number required");
159
Neale Ranns50f0ac02019-05-15 02:13:37 -0700160 c = punt_client_l4_get (af, port);
Ole Troanf7a55ad2017-05-16 14:59:29 +0200161
Neale Ranns50f0ac02019-05-15 02:13:37 -0700162 if (NULL == c)
163 {
164 pool_get_zero (pm->punt_client_pool, c);
165 punt_client_l4_db_add (af, port, c - pm->punt_client_pool);
166 }
Ole Troanf7a55ad2017-05-16 14:59:29 +0200167
BenoƮt Ganneedb0d452021-10-12 10:14:30 +0200168 snprintf (c->caddr.sun_path, sizeof (c->caddr.sun_path), "%s",
169 client_pathname);
Neale Ranns50f0ac02019-05-15 02:13:37 -0700170 c->caddr.sun_family = AF_UNIX;
171 c->reg.type = PUNT_TYPE_L4;
172 c->reg.punt.l4.port = port;
173 c->reg.punt.l4.protocol = protocol;
174 c->reg.punt.l4.af = af;
175
176 u32 node_index = (af == AF_IP4 ?
177 udp4_punt_socket_node.index :
178 udp6_punt_socket_node.index);
179
180 udp_register_dst_port (vm, port, node_index, af == AF_IP4);
181
182 return (NULL);
183}
184
185static clib_error_t *
Neale Rannsb538dd82019-05-21 06:54:54 -0700186punt_socket_register_ip_proto (vlib_main_t * vm,
187 ip_address_family_t af,
188 ip_protocol_t proto, char *client_pathname)
189{
190 punt_main_t *pm = &punt_main;
191 punt_client_t *c;
192
193 c = punt_client_ip_proto_get (af, proto);
194
195 if (NULL == c)
196 {
197 pool_get_zero (pm->punt_client_pool, c);
198 punt_client_ip_proto_db_add (af, proto, c - pm->punt_client_pool);
199 }
200
BenoƮt Ganneedb0d452021-10-12 10:14:30 +0200201 snprintf (c->caddr.sun_path, sizeof (c->caddr.sun_path), "%s",
202 client_pathname);
Neale Rannsb538dd82019-05-21 06:54:54 -0700203 c->caddr.sun_family = AF_UNIX;
204 c->reg.type = PUNT_TYPE_IP_PROTO;
205 c->reg.punt.ip_proto.protocol = proto;
206 c->reg.punt.ip_proto.af = af;
207
208 if (af == AF_IP4)
209 ip4_register_protocol (proto, ip4_proto_punt_socket_node.index);
210 else
211 ip6_register_protocol (proto, ip6_proto_punt_socket_node.index);
212
213 return (NULL);
214}
215
216static clib_error_t *
Neale Ranns50f0ac02019-05-15 02:13:37 -0700217punt_socket_register_exception (vlib_main_t * vm,
218 vlib_punt_reason_t reason,
219 char *client_pathname)
220{
221 punt_main_t *pm = &punt_main;
222 punt_client_t *pc;
223
224 pc = punt_client_exception_get (reason);
225
226 if (NULL == pc)
227 {
228 pool_get_zero (pm->punt_client_pool, pc);
229 punt_client_exception_db_add (reason, pc - pm->punt_client_pool);
230 }
231
BenoƮt Ganneedb0d452021-10-12 10:14:30 +0200232 snprintf (pc->caddr.sun_path, sizeof (pc->caddr.sun_path), "%s",
233 client_pathname);
Neale Ranns50f0ac02019-05-15 02:13:37 -0700234 pc->caddr.sun_family = AF_UNIX;
235 pc->reg.type = PUNT_TYPE_EXCEPTION;
236 pc->reg.punt.exception.reason = reason;
237
238 vlib_punt_register (pm->hdl,
239 pc->reg.punt.exception.reason, "exception-punt-socket");
240
241 return (NULL);
242}
243
244static clib_error_t *
245punt_socket_unregister_l4 (ip_address_family_t af,
246 ip_protocol_t protocol, u16 port)
247{
248 u32 pci;
249
250 udp_unregister_dst_port (vlib_get_main (), port, af == AF_IP4);
251
252 pci = punt_client_l4_db_remove (af, port);
253
254 if (~0 != pci)
255 pool_put_index (punt_main.punt_client_pool, pci);
256
257 return (NULL);
258}
259
260static clib_error_t *
Neale Rannsb538dd82019-05-21 06:54:54 -0700261punt_socket_unregister_ip_proto (ip_address_family_t af, ip_protocol_t proto)
262{
263 u32 pci;
264
265 if (af == AF_IP4)
266 ip4_unregister_protocol (proto);
267 else
268 ip6_unregister_protocol (proto);
269
270 pci = punt_client_ip_proto_db_remove (af, proto);
271
272 if (~0 != pci)
273 pool_put_index (punt_main.punt_client_pool, pci);
274
275 return (NULL);
276}
277
278static clib_error_t *
Neale Ranns50f0ac02019-05-15 02:13:37 -0700279punt_socket_unregister_exception (vlib_punt_reason_t reason)
280{
281 u32 pci;
282
283 pci = punt_client_exception_db_remove (reason);
284
285 if (~0 != pci)
286 pool_put_index (punt_main.punt_client_pool, pci);
287
288 return (NULL);
Ole Troanf7a55ad2017-05-16 14:59:29 +0200289}
290
291clib_error_t *
Neale Ranns50f0ac02019-05-15 02:13:37 -0700292vnet_punt_socket_add (vlib_main_t * vm, u32 header_version,
293 const punt_reg_t * pr, char *client_pathname)
Ole Troanf7a55ad2017-05-16 14:59:29 +0200294{
295 punt_main_t *pm = &punt_main;
296
297 if (!pm->is_configured)
298 return clib_error_return (0, "socket is not configured");
299
Neale Ranns50f0ac02019-05-15 02:13:37 -0700300 if (header_version != PUNT_PACKETDESC_VERSION)
301 return clib_error_return (0, "Invalid packet descriptor version");
302
Neale Rannsb538dd82019-05-21 06:54:54 -0700303 if (strncmp (client_pathname, vnet_punt_get_server_pathname (),
304 UNIX_PATH_MAX) == 0)
305 return clib_error_return (0,
306 "Punt socket: Invalid client path: %s",
307 client_pathname);
308
Neale Ranns50f0ac02019-05-15 02:13:37 -0700309 /* Register client */
310 switch (pr->type)
311 {
312 case PUNT_TYPE_L4:
313 return (punt_socket_register_l4 (vm,
314 pr->punt.l4.af,
315 pr->punt.l4.protocol,
316 pr->punt.l4.port, client_pathname));
Neale Rannsb538dd82019-05-21 06:54:54 -0700317 case PUNT_TYPE_IP_PROTO:
318 return (punt_socket_register_ip_proto (vm,
319 pr->punt.ip_proto.af,
320 pr->punt.ip_proto.protocol,
321 client_pathname));
Neale Ranns50f0ac02019-05-15 02:13:37 -0700322 case PUNT_TYPE_EXCEPTION:
323 return (punt_socket_register_exception (vm,
324 pr->punt.exception.reason,
325 client_pathname));
326 }
327
328 return 0;
329}
330
331clib_error_t *
332vnet_punt_socket_del (vlib_main_t * vm, const punt_reg_t * pr)
333{
334 punt_main_t *pm = &punt_main;
335
336 if (!pm->is_configured)
337 return clib_error_return (0, "socket is not configured");
338
339 switch (pr->type)
340 {
341 case PUNT_TYPE_L4:
342 return (punt_socket_unregister_l4 (pr->punt.l4.af,
343 pr->punt.l4.protocol,
344 pr->punt.l4.port));
Neale Rannsb538dd82019-05-21 06:54:54 -0700345 case PUNT_TYPE_IP_PROTO:
346 return (punt_socket_unregister_ip_proto (pr->punt.ip_proto.af,
347 pr->punt.ip_proto.protocol));
Neale Ranns50f0ac02019-05-15 02:13:37 -0700348 case PUNT_TYPE_EXCEPTION:
349 return (punt_socket_unregister_exception (pr->punt.exception.reason));
350 }
Ole Troanf7a55ad2017-05-16 14:59:29 +0200351
352 return 0;
353}
354
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700355/**
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400356 * @brief Request IP L4 traffic punt to the local TCP/IP stack.
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700357 *
358 * @em Note
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400359 * - UDP is the only protocol supported in the current implementation
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700360 *
361 * @param vm vlib_main_t corresponding to the current thread
Neale Ranns50f0ac02019-05-15 02:13:37 -0700362 * @param af IP address family.
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700363 * @param protocol 8-bits L4 protocol value
Pierre Pfister7fe51f32017-09-20 08:48:36 +0200364 * UDP is 17
365 * TCP is 1
366 * @param port 16-bits L4 (TCP/IP) port number when applicable (UDP only)
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700367 *
368 * @returns 0 on success, non-zero value otherwise
369 */
Neale Ranns50f0ac02019-05-15 02:13:37 -0700370static clib_error_t *
371punt_l4_add_del (vlib_main_t * vm,
372 ip_address_family_t af,
373 ip_protocol_t protocol, u16 port, bool is_add)
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700374{
BenoƮt Ganne7c7b5052021-10-04 12:03:20 +0200375 int is_ip4 = af == AF_IP4;
376
Florin Coras3ffe6ca2019-06-26 16:27:13 -0700377 /* For now we only support TCP and UDP punt */
378 if (protocol != IP_PROTOCOL_UDP && protocol != IP_PROTOCOL_TCP)
Alexander Popovsky (apopovsk)740bcdb2016-11-15 15:36:23 -0800379 return clib_error_return (0,
Florin Coras3ffe6ca2019-06-26 16:27:13 -0700380 "only UDP (%d) and TCP (%d) protocols are supported, got %d",
381 IP_PROTOCOL_UDP, IP_PROTOCOL_TCP, protocol);
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700382
Alexander Popovsky (apopovsk)740bcdb2016-11-15 15:36:23 -0800383 if (port == (u16) ~ 0)
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700384 {
Neale Ranns50f0ac02019-05-15 02:13:37 -0700385 if (protocol == IP_PROTOCOL_UDP)
BenoƮt Ganne7c7b5052021-10-04 12:03:20 +0200386 udp_punt_unknown (vm, is_ip4, is_add);
Neale Ranns50f0ac02019-05-15 02:13:37 -0700387 else if (protocol == IP_PROTOCOL_TCP)
BenoƮt Ganne7c7b5052021-10-04 12:03:20 +0200388 tcp_punt_unknown (vm, is_ip4, is_add);
Alexander Popovsky (apopovsk)740bcdb2016-11-15 15:36:23 -0800389
390 return 0;
391 }
392
393 else if (is_add)
394 {
BenoƮt Ganne7c7b5052021-10-04 12:03:20 +0200395 const vlib_node_registration_t *punt_node =
396 is_ip4 ? &udp4_punt_node : &udp6_punt_node;
397
Florin Coras3ffe6ca2019-06-26 16:27:13 -0700398 if (protocol == IP_PROTOCOL_TCP)
399 return clib_error_return (0, "punt TCP ports is not supported yet");
Pierre Pfister7fe51f32017-09-20 08:48:36 +0200400
BenoƮt Ganne7c7b5052021-10-04 12:03:20 +0200401 udp_register_dst_port (vm, port, punt_node->index, is_ip4);
Alexander Popovsky (apopovsk)740bcdb2016-11-15 15:36:23 -0800402
403 return 0;
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700404 }
405 else
Pavel Kotucek41b923a2018-12-05 17:16:23 +0100406 {
Florin Coras3ffe6ca2019-06-26 16:27:13 -0700407 if (protocol == IP_PROTOCOL_TCP)
408 return clib_error_return (0, "punt TCP ports is not supported yet");
Pavel Kotucek41b923a2018-12-05 17:16:23 +0100409
BenoƮt Ganne7c7b5052021-10-04 12:03:20 +0200410 udp_unregister_dst_port (vm, port, is_ip4);
Pavel Kotucek41b923a2018-12-05 17:16:23 +0100411
412 return 0;
413 }
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700414}
Neale Ranns50f0ac02019-05-15 02:13:37 -0700415
Mohammed Hawari45723b82021-02-05 15:40:00 +0100416/**
417 * @brief Request exception traffic punt.
418 *
419 * @param reason Punting reason
420 *
421 * @returns 0 on success, non-zero value otherwise
422 */
423static clib_error_t *
424punt_exception_add_del (vlib_punt_reason_t reason, bool is_add)
425{
426 punt_main_t *pm = &punt_main;
427 int rv = 0;
428 vnet_punt_reason_flag_t flag = vlib_punt_reason_get_flags (reason);
429 const char *node_name =
430 vnet_punt_reason_flag_is_IP6_PACKET (flag) ? "ip6-punt" : "ip4-punt";
431 if (is_add)
432 rv = vlib_punt_register (pm->hdl, reason, node_name);
433 else
434 rv = vlib_punt_unregister (pm->hdl, reason, node_name);
435 if (!rv)
436 return 0;
437 else
438 return clib_error_return (0, is_add ? "Existing punting registration..." :
439 "Punting registration not found...");
440}
441
Neale Ranns50f0ac02019-05-15 02:13:37 -0700442clib_error_t *
443vnet_punt_add_del (vlib_main_t * vm, const punt_reg_t * pr, bool is_add)
444{
445 switch (pr->type)
446 {
447 case PUNT_TYPE_L4:
448 return (punt_l4_add_del (vm, pr->punt.l4.af, pr->punt.l4.protocol,
449 pr->punt.l4.port, is_add));
450 case PUNT_TYPE_EXCEPTION:
Mohammed Hawari45723b82021-02-05 15:40:00 +0100451 return punt_exception_add_del (pr->punt.exception.reason, is_add);
Neale Rannsb538dd82019-05-21 06:54:54 -0700452 case PUNT_TYPE_IP_PROTO:
453 break;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700454 }
455
456 return (clib_error_return (0, "Unsupported punt type: %d", pr->type));
457}
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700458
459static clib_error_t *
Pierre Pfister7fe51f32017-09-20 08:48:36 +0200460punt_cli (vlib_main_t * vm,
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200461 unformat_input_t * input__, vlib_cli_command_t * cmd)
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700462{
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200463 unformat_input_t line_input, *input = &line_input;
Swarup Nayak1b708842017-12-13 13:27:23 +0530464 clib_error_t *error = NULL;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700465 bool is_add = true;
Neale Ranns68577d22019-06-04 13:31:23 +0000466 /* *INDENT-OFF* */
Neale Ranns50f0ac02019-05-15 02:13:37 -0700467 punt_reg_t pr = {
468 .punt = {
Neale Ranns68577d22019-06-04 13:31:23 +0000469 .l4 = {
470 .af = AF_IP4,
471 .port = ~0,
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400472 .protocol = IP_PROTOCOL_UDP,
Neale Ranns68577d22019-06-04 13:31:23 +0000473 },
474 },
Neale Ranns50f0ac02019-05-15 02:13:37 -0700475 .type = PUNT_TYPE_L4,
476 };
Neale Ranns68577d22019-06-04 13:31:23 +0000477 u32 port;
478 /* *INDENT-ON* */
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700479
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200480 if (!unformat_user (input__, unformat_line_input, input))
481 return 0;
482
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700483 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
484 {
485 if (unformat (input, "del"))
Ole Troanf7a55ad2017-05-16 14:59:29 +0200486 is_add = false;
Mohammed Hawari45723b82021-02-05 15:40:00 +0100487 else if (unformat (input, "reason %U", unformat_punt_reason,
488 &pr.punt.exception.reason))
489 pr.type = PUNT_TYPE_EXCEPTION;
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400490 else if (unformat (input, "ipv4"))
491 pr.punt.l4.af = AF_IP4;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700492 else if (unformat (input, "ipv6"))
493 pr.punt.l4.af = AF_IP6;
494 else if (unformat (input, "ip6"))
495 pr.punt.l4.af = AF_IP6;
Neale Ranns68577d22019-06-04 13:31:23 +0000496 else if (unformat (input, "%d", &port))
497 pr.punt.l4.port = port;
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400498 else if (unformat (input, "all"))
499 pr.punt.l4.port = ~0;
Pierre Pfister7fe51f32017-09-20 08:48:36 +0200500 else if (unformat (input, "udp"))
Neale Ranns50f0ac02019-05-15 02:13:37 -0700501 pr.punt.l4.protocol = IP_PROTOCOL_UDP;
Pierre Pfister7fe51f32017-09-20 08:48:36 +0200502 else if (unformat (input, "tcp"))
Neale Ranns50f0ac02019-05-15 02:13:37 -0700503 pr.punt.l4.protocol = IP_PROTOCOL_TCP;
Swarup Nayak1b708842017-12-13 13:27:23 +0530504 else
505 {
506 error = clib_error_return (0, "parse error: '%U'",
507 format_unformat_error, input);
508 goto done;
509 }
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700510 }
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100511
512 /* punt both IPv6 and IPv4 when used in CLI */
Neale Ranns50f0ac02019-05-15 02:13:37 -0700513 error = vnet_punt_add_del (vm, &pr, is_add);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100514 if (error)
515 {
516 clib_error_report (error);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100517 }
518
Swarup Nayak1b708842017-12-13 13:27:23 +0530519done:
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200520 unformat_free (input);
Swarup Nayak1b708842017-12-13 13:27:23 +0530521 return error;
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700522}
523
524/*?
525 * The set of '<em>set punt</em>' commands allows specific IP traffic to
526 * be punted to the host TCP/IP stack
527 *
528 * @em Note
529 * - UDP is the only protocol supported in the current implementation
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700530 * - All TCP traffic is currently punted to the host by default
531 *
532 * @cliexpar
533 * @parblock
534 * Example of how to request NTP traffic to be punted
535 * @cliexcmd{set punt udp 125}
536 *
Alexander Popovsky (apopovsk)740bcdb2016-11-15 15:36:23 -0800537 * Example of how to request all 'unknown' UDP traffic to be punted
538 * @cliexcmd{set punt udp all}
539 *
540 * Example of how to stop all 'unknown' UDP traffic to be punted
541 * @cliexcmd{set punt udp del all}
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700542 * @endparblock
543?*/
544/* *INDENT-OFF* */
Pierre Pfister7fe51f32017-09-20 08:48:36 +0200545VLIB_CLI_COMMAND (punt_command, static) = {
546 .path = "set punt",
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400547 .short_help = "set punt [IPV4|ip6|ipv6] [UDP|tcp] [del] [ALL|<port-num>]",
Pierre Pfister7fe51f32017-09-20 08:48:36 +0200548 .function = punt_cli,
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700549};
550/* *INDENT-ON* */
551
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100552static clib_error_t *
553punt_socket_register_cmd (vlib_main_t * vm,
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200554 unformat_input_t * input__,
555 vlib_cli_command_t * cmd)
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100556{
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200557 unformat_input_t line_input, *input = &line_input;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100558 u8 *socket_name = 0;
559 clib_error_t *error = NULL;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700560 /* *INDENT-OFF* */
561 punt_reg_t pr = {
562 .punt = {
563 .l4 = {
564 .af = AF_IP4,
565 .port = ~0,
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400566 .protocol = IP_PROTOCOL_UDP,
Neale Ranns50f0ac02019-05-15 02:13:37 -0700567 },
568 },
569 .type = PUNT_TYPE_L4,
570 };
571 /* *INDENT-ON* */
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100572
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200573 if (!unformat_user (input__, unformat_line_input, input))
574 return 0;
575
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100576 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
577 {
578 if (unformat (input, "ipv4"))
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400579 pr.punt.l4.af = AF_IP4;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100580 else if (unformat (input, "ipv6"))
Neale Ranns50f0ac02019-05-15 02:13:37 -0700581 pr.punt.l4.af = AF_IP6;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100582 else if (unformat (input, "udp"))
Neale Ranns50f0ac02019-05-15 02:13:37 -0700583 pr.punt.l4.protocol = IP_PROTOCOL_UDP;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100584 else if (unformat (input, "tcp"))
Neale Ranns50f0ac02019-05-15 02:13:37 -0700585 pr.punt.l4.protocol = IP_PROTOCOL_TCP;
586 else if (unformat (input, "%d", &pr.punt.l4.port))
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100587 ;
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400588 else if (unformat (input, "all"))
589 pr.punt.l4.port = ~0;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100590 else if (unformat (input, "socket %s", &socket_name))
591 ;
Arthur de Kerhora80ff132021-04-12 08:16:56 -0700592 else if (unformat (input, "reason %U", unformat_punt_reason,
593 &pr.punt.exception.reason))
594 pr.type = PUNT_TYPE_EXCEPTION;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100595 else
596 {
597 error = clib_error_return (0, "parse error: '%U'",
598 format_unformat_error, input);
599 goto done;
600 }
601 }
602
Neale Ranns4f3c1042019-06-11 01:39:08 -0700603 if (!socket_name)
604 error = clib_error_return (0, "socket name not specified");
605 else
606 error = vnet_punt_socket_add (vm, 1, &pr, (char *) socket_name);
Neale Ranns50f0ac02019-05-15 02:13:37 -0700607
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100608done:
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200609 unformat_free (input);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100610 return error;
611}
612
613/*?
614 *
615 * @cliexpar
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400616 * @cliexcmd{punt socket register socket punt_l4_foo.sock}
617
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100618 ?*/
619/* *INDENT-OFF* */
620VLIB_CLI_COMMAND (punt_socket_register_command, static) =
621{
622 .path = "punt socket register",
623 .function = punt_socket_register_cmd,
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400624 .short_help = "punt socket register [IPV4|ipv6] [UDP|tcp] [ALL|<port-num>] socket <socket>",
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100625 .is_mp_safe = 1,
626};
627/* *INDENT-ON* */
628
629static clib_error_t *
630punt_socket_deregister_cmd (vlib_main_t * vm,
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200631 unformat_input_t * input__,
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100632 vlib_cli_command_t * cmd)
633{
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200634 unformat_input_t line_input, *input = &line_input;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100635 clib_error_t *error = NULL;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700636 /* *INDENT-OFF* */
637 punt_reg_t pr = {
638 .punt = {
639 .l4 = {
640 .af = AF_IP4,
641 .port = ~0,
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400642 .protocol = IP_PROTOCOL_UDP,
Neale Ranns50f0ac02019-05-15 02:13:37 -0700643 },
644 },
645 .type = PUNT_TYPE_L4,
646 };
647 /* *INDENT-ON* */
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100648
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200649 if (!unformat_user (input__, unformat_line_input, input))
650 return 0;
651
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100652 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
653 {
654 if (unformat (input, "ipv4"))
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400655 pr.punt.l4.af = AF_IP4;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100656 else if (unformat (input, "ipv6"))
Neale Ranns50f0ac02019-05-15 02:13:37 -0700657 pr.punt.l4.af = AF_IP6;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100658 else if (unformat (input, "udp"))
Neale Ranns50f0ac02019-05-15 02:13:37 -0700659 pr.punt.l4.protocol = IP_PROTOCOL_UDP;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100660 else if (unformat (input, "tcp"))
Neale Ranns50f0ac02019-05-15 02:13:37 -0700661 pr.punt.l4.protocol = IP_PROTOCOL_TCP;
662 else if (unformat (input, "%d", &pr.punt.l4.port))
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100663 ;
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400664 else if (unformat (input, "all"))
665 pr.punt.l4.port = ~0;
Arthur de Kerhora80ff132021-04-12 08:16:56 -0700666 else if (unformat (input, "reason %U", unformat_punt_reason,
667 &pr.punt.exception.reason))
668 pr.type = PUNT_TYPE_EXCEPTION;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100669 else
670 {
671 error = clib_error_return (0, "parse error: '%U'",
672 format_unformat_error, input);
673 goto done;
674 }
675 }
676
Neale Ranns50f0ac02019-05-15 02:13:37 -0700677 error = vnet_punt_socket_del (vm, &pr);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100678done:
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200679 unformat_free (input);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100680 return error;
681}
682
683/*?
684 *
685 * @cliexpar
686 * @cliexcmd{punt socket register}
687 ?*/
688/* *INDENT-OFF* */
689VLIB_CLI_COMMAND (punt_socket_deregister_command, static) =
690{
691 .path = "punt socket deregister",
692 .function = punt_socket_deregister_cmd,
Paul Vinciguerra32c4d382019-10-23 16:07:32 -0400693 .short_help = "punt socket deregister [IPV4|ipv6] [UDP|tcp] [ALL|<port-num>]",
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100694 .is_mp_safe = 1,
695};
696/* *INDENT-ON* */
697
Neale Ranns50f0ac02019-05-15 02:13:37 -0700698void
699punt_client_walk (punt_type_t pt, punt_client_walk_cb_t cb, void *ctx)
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100700{
701 punt_main_t *pm = &punt_main;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100702
Neale Ranns50f0ac02019-05-15 02:13:37 -0700703 switch (pt)
704 {
705 case PUNT_TYPE_L4:
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100706 {
Neale Rannsb538dd82019-05-21 06:54:54 -0700707 u32 pci, key;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700708
709 /* *INDENT-OFF* */
Neale Rannsb538dd82019-05-21 06:54:54 -0700710 hash_foreach(key, pci, pm->db.clients_by_l4_port,
711 ({
712 cb (pool_elt_at_index(pm->punt_client_pool, pci), ctx);
713 }));
714 /* *INDENT-ON* */
715 break;
716 }
717 case PUNT_TYPE_IP_PROTO:
718 {
719 u32 pci, key;
720
721 /* *INDENT-OFF* */
722 hash_foreach(key, pci, pm->db.clients_by_ip_proto,
Neale Ranns50f0ac02019-05-15 02:13:37 -0700723 ({
724 cb (pool_elt_at_index(pm->punt_client_pool, pci), ctx);
725 }));
726 /* *INDENT-ON* */
727 break;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100728 }
Neale Ranns50f0ac02019-05-15 02:13:37 -0700729 case PUNT_TYPE_EXCEPTION:
730 {
731 u32 *pci;
732
733 vec_foreach (pci, pm->db.clients_by_exception)
734 {
735 if (~0 != *pci)
736 cb (pool_elt_at_index (pm->punt_client_pool, *pci), ctx);
737 }
738
739 break;
740 }
741 }
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100742}
743
Neale Ranns50f0ac02019-05-15 02:13:37 -0700744static u8 *
745format_punt_client (u8 * s, va_list * args)
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100746{
Neale Ranns50f0ac02019-05-15 02:13:37 -0700747 punt_client_t *pc = va_arg (*args, punt_client_t *);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100748
Neale Ranns50f0ac02019-05-15 02:13:37 -0700749 s = format (s, " punt ");
750
751 switch (pc->reg.type)
752 {
753 case PUNT_TYPE_L4:
754 s = format (s, "%U %U port %d",
755 format_ip_address_family, pc->reg.punt.l4.af,
756 format_ip_protocol, pc->reg.punt.l4.protocol,
757 pc->reg.punt.l4.port);
758 break;
Neale Rannsb538dd82019-05-21 06:54:54 -0700759 case PUNT_TYPE_IP_PROTO:
760 s = format (s, "%U %U",
761 format_ip_address_family, pc->reg.punt.ip_proto.af,
762 format_ip_protocol, pc->reg.punt.ip_proto.protocol);
763 break;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700764 case PUNT_TYPE_EXCEPTION:
765 s = format (s, " %U", format_vlib_punt_reason,
766 pc->reg.punt.exception.reason);
767 break;
768 }
769
770 s = format (s, " to socket %s \n", pc->caddr.sun_path);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100771
772 return (s);
773}
774
Neale Ranns50f0ac02019-05-15 02:13:37 -0700775static walk_rc_t
776punt_client_show_one (const punt_client_t * pc, void *ctx)
777{
778 vlib_cli_output (ctx, "%U", format_punt_client, pc);
779
780 return (WALK_CONTINUE);
781}
782
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100783static clib_error_t *
784punt_socket_show_cmd (vlib_main_t * vm,
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200785 unformat_input_t * input__, vlib_cli_command_t * cmd)
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100786{
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200787 unformat_input_t line_input, *input = &line_input;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100788 clib_error_t *error = NULL;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700789 punt_type_t pt;
790
791 pt = PUNT_TYPE_L4;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100792
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200793 if (!unformat_user (input__, unformat_line_input, input))
794 return 0;
795
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100796 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
797 {
Neale Ranns50f0ac02019-05-15 02:13:37 -0700798 if (unformat (input, "exception"))
799 pt = PUNT_TYPE_EXCEPTION;
800 else if (unformat (input, "l4"))
801 pt = PUNT_TYPE_L4;
Neale Rannsb538dd82019-05-21 06:54:54 -0700802 else if (unformat (input, "ip"))
803 pt = PUNT_TYPE_IP_PROTO;
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100804 else
805 {
806 error = clib_error_return (0, "parse error: '%U'",
807 format_unformat_error, input);
808 goto done;
809 }
810 }
811
Neale Ranns50f0ac02019-05-15 02:13:37 -0700812 punt_client_walk (pt, punt_client_show_one, vm);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100813
814done:
BenoƮt Ganne9ae3c6a2020-07-27 18:27:57 +0200815 unformat_free (input);
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100816 return (error);
817}
818
819/*?
820 *
821 * @cliexpar
822 * @cliexcmd{show punt socket ipv4}
823 ?*/
824/* *INDENT-OFF* */
825VLIB_CLI_COMMAND (show_punt_socket_registration_command, static) =
826{
827 .path = "show punt socket registrations",
828 .function = punt_socket_show_cmd,
Neale Ranns50f0ac02019-05-15 02:13:37 -0700829 .short_help = "show punt socket registrations [l4|exception]",
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100830 .is_mp_safe = 1,
831};
832/* *INDENT-ON* */
833
Ole Troanf7a55ad2017-05-16 14:59:29 +0200834clib_error_t *
Neale Ranns76b56492018-09-28 15:16:14 +0000835ip_punt_init (vlib_main_t * vm)
Ole Troanf7a55ad2017-05-16 14:59:29 +0200836{
Neale Ranns50f0ac02019-05-15 02:13:37 -0700837 clib_error_t *error = NULL;
Ole Troanf7a55ad2017-05-16 14:59:29 +0200838 punt_main_t *pm = &punt_main;
Neale Ranns39040a62019-07-10 01:47:15 -0700839 vlib_thread_main_t *tm = vlib_get_thread_main ();
Ole Troanf7a55ad2017-05-16 14:59:29 +0200840
Ole Troanf7a55ad2017-05-16 14:59:29 +0200841 pm->is_configured = false;
Neale Ranns50f0ac02019-05-15 02:13:37 -0700842 pm->interface_output_node =
843 vlib_get_node_by_name (vm, (u8 *) "interface-output");
844
845 if ((error = vlib_call_init_function (vm, punt_init)))
846 return error;
847
848 pm->hdl = vlib_punt_client_register ("ip-punt");
849
Neale Ranns39040a62019-07-10 01:47:15 -0700850 vec_validate_aligned (pm->thread_data, tm->n_vlib_mains,
851 CLIB_CACHE_LINE_BYTES);
852
Neale Ranns50f0ac02019-05-15 02:13:37 -0700853 return (error);
Ole Troanf7a55ad2017-05-16 14:59:29 +0200854}
855
Mohammed Hawari45723b82021-02-05 15:40:00 +0100856u8 *
857format_vnet_punt_reason_flags (u8 *s, va_list *args)
858{
859 vnet_punt_reason_flag_t flag = va_arg (*args, int);
860#define _(pos, len, value, name, str) \
861 if (vnet_punt_reason_flag_is_##name (flag)) \
862 s = format (s, "%s ", str);
863
864 foreach_vnet_punt_reason_flag
865#undef _
866 return (s);
867}
868
Neale Ranns76b56492018-09-28 15:16:14 +0000869VLIB_INIT_FUNCTION (ip_punt_init);
Ole Troanf7a55ad2017-05-16 14:59:29 +0200870
871static clib_error_t *
872punt_config (vlib_main_t * vm, unformat_input_t * input)
873{
874 punt_main_t *pm = &punt_main;
875 char *socket_path = 0;
876
877 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
878 {
879 if (unformat (input, "socket %s", &socket_path))
Pavel Kotuceke88865d2018-11-28 07:42:11 +0100880 strncpy (pm->sun_path, socket_path, UNIX_PATH_MAX - 1);
Ole Troanf7a55ad2017-05-16 14:59:29 +0200881 else
882 return clib_error_return (0, "unknown input `%U'",
883 format_unformat_error, input);
884 }
885
886 if (socket_path == 0)
887 return 0;
888
889 /* UNIX domain socket */
890 struct sockaddr_un addr;
891 if ((pm->socket_fd = socket (AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0)) == -1)
892 {
893 return clib_error_return (0, "socket error");
894 }
895
Dave Barachb7b92992018-10-17 10:38:51 -0400896 clib_memset (&addr, 0, sizeof (addr));
Ole Troanf7a55ad2017-05-16 14:59:29 +0200897 addr.sun_family = AF_UNIX;
898 if (*socket_path == '\0')
899 {
900 *addr.sun_path = '\0';
901 strncpy (addr.sun_path + 1, socket_path + 1,
902 sizeof (addr.sun_path) - 2);
903 }
904 else
905 {
906 strncpy (addr.sun_path, socket_path, sizeof (addr.sun_path) - 1);
907 unlink (socket_path);
908 }
909
910 if (bind (pm->socket_fd, (struct sockaddr *) &addr, sizeof (addr)) == -1)
911 {
912 return clib_error_return (0, "bind error");
913 }
914
Neale Ranns50f0ac02019-05-15 02:13:37 -0700915 int n_bytes = 0x10000;
916
917 if (setsockopt
918 (pm->socket_fd, SOL_SOCKET, SO_SNDBUF, &n_bytes,
919 sizeof (n_bytes)) == -1)
920 {
921 return clib_error_return (0, "setsockopt error");
922 }
923
Ole Troanf7a55ad2017-05-16 14:59:29 +0200924 /* Register socket */
Damjan Marion56dd5432017-09-08 19:52:02 +0200925 clib_file_main_t *fm = &file_main;
926 clib_file_t template = { 0 };
Ole Troanf7a55ad2017-05-16 14:59:29 +0200927 template.read_function = punt_socket_read_ready;
928 template.file_descriptor = pm->socket_fd;
Paul Vinciguerra5481ad42020-01-28 14:47:17 -0500929 template.description = format (0, "punt socket %s", socket_path);
Damjan Marion56dd5432017-09-08 19:52:02 +0200930 pm->clib_file_index = clib_file_add (fm, &template);
Ole Troanf7a55ad2017-05-16 14:59:29 +0200931
932 pm->is_configured = true;
933
934 return 0;
935}
936
937VLIB_CONFIG_FUNCTION (punt_config, "punt");
938
Alexander Popovsky (apopovsk)4a7e58b2016-10-05 22:31:23 -0700939/*
940 * fd.io coding-style-patch-verification: ON
941 *
942 * Local Variables:
943 * eval: (c-set-style "gnu")
944 * End:
945 */