FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
udp_ping_util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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 #ifndef PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_
17 #define PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_
18 
19 int udp_ping_create_ip6_pak (u8 * buf, /*u16 len, */
20  ip6_address_t src, ip6_address_t dst,
22  u8 msg_type, u16 ctx);
23 
24 int
25 udp_ping_compare_flow (ip46_address_t src, ip46_address_t dst,
26  u16 start_src_port, u16 end_src_port,
27  u16 start_dst_port, u16 end_dst_port,
29 
30 void
31 udp_ping_populate_flow (ip46_address_t src, ip46_address_t dst,
32  u16 start_src_port, u16 end_src_port,
33  u16 start_dst_port, u16 end_dst_port,
34  u16 interval, u8 fault_det,
36 
38 
40 
42 
43 /**
44  * @brief Create and send ipv6 udp-ping response packet.
45  *
46  */
47 always_inline void
50  udp_ping_t * udp)
51 {
52  ip6_address_t src;
53  u16 src_port;
54  ioam_trace_option_t *trace;
55 
56  src = ip->src_address;
57 
58  ip->src_address = ip->dst_address;
59  ip->dst_address = src;
60 
61  trace = (ioam_trace_option_t *)
64 
65  /* No need of endian transform */
66  src_port = udp->udp.src_port;
67 
68  udp->udp.src_port = udp->udp.dst_port;
69  udp->udp.dst_port = src_port;
70  udp->udp.checksum = 0; //FIXME
71 
73 }
74 
75 #endif /* PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_ */
76 
77 /*
78  * fd.io coding-style-patch-verification: ON
79  *
80  * Local Variables:
81  * eval: (c-set-style "gnu")
82  * End:
83  */
udp_header_t::src_port
u16 src_port
Definition: udp_packet.h:48
udp_ping_t
Definition: udp_ping_packet.h:140
udp_ping_data::msg_type
u8 msg_type
Definition: udp_ping_packet.h:128
trace
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
Definition: vlib_api_cli.c:870
dst_port
vl_api_ip_port_and_mask_t dst_port
Definition: flow_types.api:92
udp_ping_create_reply_from_probe_ip6
static void udp_ping_create_reply_from_probe_ip6(ip6_header_t *ip, ip6_hop_by_hop_header_t *hbh, udp_ping_t *udp)
Create and send ipv6 udp-ping response packet.
Definition: udp_ping_util.h:48
u16
unsigned short u16
Definition: types.h:57
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
flow
Definition: flow_types.api:196
ip6_hop_by_hop_header_t
Definition: ip6_hop_by_hop_packet.h:18
udp_ping_create_ip6_pak
int udp_ping_create_ip6_pak(u8 *buf, ip6_address_t src, ip6_address_t dst, u16 src_port, u16 dst_port, u8 msg_type, u16 ctx)
Frame IPv6 udp-ping probe packet.
Definition: udp_ping_util.c:61
udp_ping_compare_flow
int udp_ping_compare_flow(ip46_address_t src, ip46_address_t dst, u16 start_src_port, u16 end_src_port, u16 start_dst_port, u16 end_dst_port, ip46_udp_ping_flow *flow)
Definition: udp_ping_util.c:139
ip6_hbh_get_option
static ip6_hop_by_hop_option_t * ip6_hbh_get_option(ip6_hop_by_hop_header_t *hbh0, u8 option_to_search)
Definition: ip6_hop_by_hop.h:241
udp_ping_populate_flow
void udp_ping_populate_flow(ip46_address_t src, ip46_address_t dst, u16 start_src_port, u16 end_src_port, u16 start_dst_port, u16 end_dst_port, u16 interval, u8 fault_det, ip46_udp_ping_flow *flow)
Definition: udp_ping_util.c:158
src_port
vl_api_ip_port_and_mask_t src_port
Definition: flow_types.api:91
src
vl_api_address_t src
Definition: gre.api:54
interval
u16 interval
Definition: vrrp.api:34
udp_ping_free_flow_data
void udp_ping_free_flow_data(ip46_udp_ping_flow *flow)
Definition: udp_ping_util.c:218
udp_ping_t::udp
udp_header_t udp
Definition: udp_ping_packet.h:142
udp_header_t::checksum
u16 checksum
Definition: udp_packet.h:55
UDP_PING_REPLY
#define UDP_PING_REPLY
Definition: udp_ping_packet.h:24
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
buf
u64 buf
Definition: application.c:493
udp_header_t::dst_port
u16 dst_port
Definition: udp_packet.h:48
udp_ping_create_rewrite
void udp_ping_create_rewrite(ip46_udp_ping_flow *flow, u16 ctx)
Definition: udp_ping_util.c:175
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
ip6_header_t
Definition: ip6_packet.h:294
ip46_udp_ping_flow
udp-ping data.
Definition: udp_ping.h:85
udp_ping_t::ping_data
udp_ping_data ping_data
Definition: udp_ping_packet.h:143
vlib_main_t
Definition: main.h:102
u8
unsigned char u8
Definition: types.h:56
ip
vl_api_address_t ip
Definition: l2.api:558
udp_ping_send_ip6_pak
void udp_ping_send_ip6_pak(vlib_main_t *vm, ip46_udp_ping_flow *flow)
Create and send ipv6 udp-ping probe packet.
Definition: udp_ping_util.c:240
BIT_LOOPBACK
#define BIT_LOOPBACK
Definition: trace_util.h:94
HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
Definition: ip6_hop_by_hop_packet.h:44
ip6_hbh_ioam_trace_reset_bit
static void ip6_hbh_ioam_trace_reset_bit(ioam_trace_option_t *trace, u8 trace_bit)
Definition: ip6_ioam_trace.h:38