diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2019-10-09 18:35:16 +0200 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-10-27 10:06:30 +0000 |
commit | f872cb0dad453e39dedb5586a8dbf566a5ea9295 (patch) | |
tree | 62c708d69e1c2972ab808dbe96d6b8457d639dbc | |
parent | 13d35675f0a4daa7bbffa02a8cd4d22c8a2d6760 (diff) |
ping: Move to plugin
Type: refactor
Change-Id: I51d5bf54dfd408aa0c406cbdf0f4be10ef19d10d
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
(cherry picked from commit 26c7a4b0b6488423688f4a7f3c8aacf0d1b9c742)
-rw-r--r-- | MAINTAINERS | 5 | ||||
-rw-r--r-- | src/plugins/ping/CMakeLists.txt | 17 | ||||
-rwxr-xr-x | src/plugins/ping/ping.c (renamed from src/vnet/ip/ping.c) | 16 | ||||
-rw-r--r-- | src/plugins/ping/ping.h (renamed from src/vnet/ip/ping.h) | 6 | ||||
-rw-r--r-- | src/vnet/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/vnet/ip/icmp4.c | 9 | ||||
-rw-r--r-- | src/vnet/ip/icmp4.h | 16 | ||||
-rw-r--r-- | src/vnet/ip/ip4.h | 3 |
8 files changed, 50 insertions, 23 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index f48d59f3461..410e876b319 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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> diff --git a/src/plugins/ping/CMakeLists.txt b/src/plugins/ping/CMakeLists.txt new file mode 100644 index 00000000000..2828f769fcc --- /dev/null +++ b/src/plugins/ping/CMakeLists.txt @@ -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 +) diff --git a/src/vnet/ip/ping.c b/src/plugins/ping/ping.c index 3847d837962..7d503774a30 100755 --- a/src/vnet/ip/ping.c +++ b/src/plugins/ping/ping.c @@ -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 * diff --git a/src/vnet/ip/ping.h b/src/plugins/ping/ping.h index f1faa998f7d..7826945ea8b 100644 --- a/src/vnet/ip/ping.h +++ b/src/plugins/ping/ping.h @@ -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 */ diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt index aaa16d8389b..197f3c31eb6 100644 --- a/src/vnet/CMakeLists.txt +++ b/src/vnet/CMakeLists.txt @@ -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 diff --git a/src/vnet/ip/icmp4.c b/src/vnet/ip/icmp4.c index 1cf6a93be50..1fab6471d2a 100644 --- a/src/vnet/ip/icmp4.c +++ b/src/vnet/ip/icmp4.c @@ -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) { diff --git a/src/vnet/ip/icmp4.h b/src/vnet/ip/icmp4.h index ae805148c89..73bd1f40efd 100644 --- a/src/vnet/ip/icmp4.h +++ b/src/vnet/ip/icmp4.h @@ -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 */ diff --git a/src/vnet/ip/ip4.h b/src/vnet/ip/ip4.h index 9da5926e13f..2a3743febb3 100644 --- a/src/vnet/ip/ip4.h +++ b/src/vnet/ip/ip4.h @@ -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); |