ping: Move to plugin

Type: refactor

Change-Id: I51d5bf54dfd408aa0c406cbdf0f4be10ef19d10d
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
(cherry picked from commit 26c7a4b0b6488423688f4a7f3c8aacf0d1b9c742)
This commit is contained in:
Mohsin Kazmi
2019-10-09 18:35:16 +02:00
committed by Andrew Yourtchenko
parent 13d35675f0
commit f872cb0dad
8 changed files with 50 additions and 23 deletions

View File

@ -361,6 +361,11 @@ I: pppoe
M: Hongjun Ni <hongjun.ni@intel.com>
F: src/plugins/pppoe/
Plugin - Ping
I: ping
M: Andrew Yourtchenko <ayourtch@gmail.com>
F: src/plugins/ping
Plugin - IPv6 Segment Routing Dynamic Proxy
I: srv6-ad
M: Francois Clad <fclad@cisco.com>

View File

@ -0,0 +1,17 @@
# Copyright (c) 2018 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.
add_vpp_plugin(ping
SOURCES
ping.c
)

View File

@ -14,11 +14,16 @@
*/
#include <stddef.h>
#include <vnet/ip/ping.h>
#include <vlib/vlib.h>
#include <vnet/fib/ip6_fib.h>
#include <vnet/fib/ip4_fib.h>
#include <vnet/fib/fib_entry.h>
#include <vlib/vlib.h>
#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
#include <vnet/ip/icmp4.h>
#include <ping/ping.h>
ping_main_t ping_main;
@ -1252,6 +1257,13 @@ ping_cli_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (ping_cli_init);
/* *INDENT-OFF* */
VLIB_PLUGIN_REGISTER () = {
.version = VPP_BUILD_VER,
.description = "Ping (ping)",
};
/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
*

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef included_vnet_ping_h
#define included_vnet_ping_h
#ifndef included_ping_ping_h
#define included_ping_ping_h
#include <vnet/ip/ip.h>
@ -88,4 +88,4 @@ typedef enum
ICMP46_ECHO_REPLY_N_NEXT,
} icmp46_echo_reply_next_t;
#endif /* included_vnet_ping_h */
#endif /* included_ping_ping_h */

View File

@ -452,7 +452,6 @@ list(APPEND VNET_SOURCES
ip/ip_in_out_acl.c
ip/ip_punt_drop.c
ip/lookup.c
ip/ping.c
ip/punt_api.c
ip/punt.c
ip/punt_node.c

View File

@ -41,7 +41,6 @@
#include <vnet/ip/ip.h>
#include <vnet/pg/pg.h>
static char *icmp_error_strings[] = {
#define _(f,s) s,
foreach_icmp4_error
@ -422,14 +421,6 @@ typedef enum
IP4_ICMP_ERROR_N_NEXT,
} ip4_icmp_error_next_t;
void
icmp4_error_set_vnet_buffer (vlib_buffer_t * b, u8 type, u8 code, u32 data)
{
vnet_buffer (b)->ip.icmp.type = type;
vnet_buffer (b)->ip.icmp.code = code;
vnet_buffer (b)->ip.icmp.data = data;
}
static u8
icmp4_icmp_type_to_error (u8 type)
{

View File

@ -26,9 +26,9 @@
_ (OPTION_WITH_ZERO_LENGTH, "option has zero length") \
_ (ECHO_REPLIES_SENT, "echo replies sent") \
_ (DST_LOOKUP_MISS, "icmp6 dst address lookup misses") \
_ (DEST_UNREACH_SENT, "destination unreachable response sent") \
_ (TTL_EXPIRE_SENT, "hop limit exceeded response sent") \
_ (PARAM_PROBLEM_SENT, "parameter problem response sent") \
_ (DEST_UNREACH_SENT, "destination unreachable response sent") \
_ (TTL_EXPIRE_SENT, "hop limit exceeded response sent") \
_ (PARAM_PROBLEM_SENT, "parameter problem response sent") \
_ (DROP, "error message dropped")
typedef enum
@ -46,8 +46,14 @@ typedef struct
format_function_t format_icmp4_input_trace;
void ip4_icmp_register_type (vlib_main_t * vm, icmp4_type_t type,
u32 node_index);
void icmp4_error_set_vnet_buffer (vlib_buffer_t * b, u8 type, u8 code,
u32 data);
static_always_inline void
icmp4_error_set_vnet_buffer (vlib_buffer_t * b, u8 type, u8 code, u32 data)
{
vnet_buffer (b)->ip.icmp.type = type;
vnet_buffer (b)->ip.icmp.code = code;
vnet_buffer (b)->ip.icmp.data = data;
}
#endif /* included_vnet_icmp4_h */

View File

@ -281,9 +281,6 @@ uword
ip4_udp_register_listener (vlib_main_t * vm,
u16 dst_port, u32 next_node_index);
void
ip4_icmp_register_type (vlib_main_t * vm, icmp4_type_t type, u32 node_index);
u16 ip4_tcp_udp_compute_checksum (vlib_main_t * vm, vlib_buffer_t * p0,
ip4_header_t * ip0);