+static clib_error_t *
+punt_socket_register_cmd (vlib_main_t * vm,
+ unformat_input_t * input__,
+ vlib_cli_command_t * cmd)
+{
+ unformat_input_t line_input, *input = &line_input;
+ u8 *socket_name = 0;
+ clib_error_t *error = NULL;
+ punt_reg_t pr = {
+ .punt = {
+ .l4 = {
+ .af = AF_IP4,
+ .port = ~0,
+ .protocol = IP_PROTOCOL_UDP,
+ },
+ },
+ .type = PUNT_TYPE_L4,
+ };
+
+ if (!unformat_user (input__, unformat_line_input, input))
+ return 0;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "ipv4"))
+ pr.punt.l4.af = AF_IP4;
+ else if (unformat (input, "ipv6"))
+ pr.punt.l4.af = AF_IP6;
+ else if (unformat (input, "udp"))
+ pr.punt.l4.protocol = IP_PROTOCOL_UDP;
+ else if (unformat (input, "tcp"))
+ pr.punt.l4.protocol = IP_PROTOCOL_TCP;
+ else if (unformat (input, "%d", &pr.punt.l4.port))
+ ;
+ else if (unformat (input, "all"))
+ pr.punt.l4.port = ~0;
+ else if (unformat (input, "socket %s", &socket_name))
+ ;
+ else if (unformat (input, "reason %U", unformat_punt_reason,
+ &pr.punt.exception.reason))
+ pr.type = PUNT_TYPE_EXCEPTION;
+ else
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, input);
+ goto done;
+ }
+ }
+
+ if (!socket_name)
+ error = clib_error_return (0, "socket name not specified");
+ else
+ error = vnet_punt_socket_add (vm, 1, &pr, (char *) socket_name);
+
+done:
+ unformat_free (input);
+ return error;
+}
+
+/*?
+ *
+ * @cliexpar
+ * @cliexcmd{punt socket register socket punt_l4_foo.sock}
+
+ ?*/
+VLIB_CLI_COMMAND (punt_socket_register_command, static) =
+{
+ .path = "punt socket register",
+ .function = punt_socket_register_cmd,
+ .short_help = "punt socket register [IPV4|ipv6] [UDP|tcp] [ALL|<port-num>] socket <socket>",
+ .is_mp_safe = 1,
+};
+
+static clib_error_t *
+punt_socket_deregister_cmd (vlib_main_t * vm,
+ unformat_input_t * input__,
+ vlib_cli_command_t * cmd)
+{
+ unformat_input_t line_input, *input = &line_input;
+ clib_error_t *error = NULL;
+ punt_reg_t pr = {
+ .punt = {
+ .l4 = {
+ .af = AF_IP4,
+ .port = ~0,
+ .protocol = IP_PROTOCOL_UDP,
+ },
+ },
+ .type = PUNT_TYPE_L4,
+ };
+
+ if (!unformat_user (input__, unformat_line_input, input))
+ return 0;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "ipv4"))
+ pr.punt.l4.af = AF_IP4;
+ else if (unformat (input, "ipv6"))
+ pr.punt.l4.af = AF_IP6;
+ else if (unformat (input, "udp"))
+ pr.punt.l4.protocol = IP_PROTOCOL_UDP;
+ else if (unformat (input, "tcp"))
+ pr.punt.l4.protocol = IP_PROTOCOL_TCP;
+ else if (unformat (input, "%d", &pr.punt.l4.port))
+ ;
+ else if (unformat (input, "all"))
+ pr.punt.l4.port = ~0;
+ else if (unformat (input, "reason %U", unformat_punt_reason,
+ &pr.punt.exception.reason))
+ pr.type = PUNT_TYPE_EXCEPTION;
+ else
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, input);
+ goto done;
+ }
+ }
+
+ error = vnet_punt_socket_del (vm, &pr);
+done:
+ unformat_free (input);
+ return error;
+}
+
+/*?
+ *
+ * @cliexpar
+ * @cliexcmd{punt socket register}
+ ?*/
+VLIB_CLI_COMMAND (punt_socket_deregister_command, static) =
+{
+ .path = "punt socket deregister",
+ .function = punt_socket_deregister_cmd,
+ .short_help = "punt socket deregister [IPV4|ipv6] [UDP|tcp] [ALL|<port-num>]",
+ .is_mp_safe = 1,
+};
+
+void
+punt_client_walk (punt_type_t pt, punt_client_walk_cb_t cb, void *ctx)