PING_RESPONSE_IP4,
} ping_response_type_t;
+#define foreach_ip46_ping_result \
+ _ (OK, "OK") \
+ _ (ALLOC_FAIL, "packet allocation failed") \
+ _ (NO_INTERFACE, "no egress interface") \
+ _ (NO_TABLE, "no FIB table for lookup") \
+ _ (NO_SRC_ADDRESS, "no source address for egress interface") \
+ _ (NO_BUFFERS, "could not allocate a new buffer") \
+
typedef enum
{
- SEND_PING_OK = 0,
- SEND_PING_ALLOC_FAIL,
- SEND_PING_NO_INTERFACE,
- SEND_PING_NO_TABLE,
+#define _(v, s) SEND_PING_##v,
+ foreach_ip46_ping_result
+#undef _
} send_ip46_ping_result_t;
/*
typedef struct ping_run_t
{
u16 icmp_id;
- u16 curr_seq;
uword cli_process_id;
} ping_run_t;
{
ip6_main_t *ip6_main;
ip4_main_t *ip4_main;
- ping_run_t *ping_runs;
- /* hash table to find back the CLI process for a reply */
- // uword *cli_proc_by_icmp_id;
- ping_run_t *ping_run_by_icmp_id;
+ /* a vector of current ping runs. */
+ ping_run_t *active_ping_runs;
+ /* a lock held while add/remove/search on active_ping_runs */
+ clib_spinlock_t ping_run_check_lock;
} ping_main_t;
-ping_main_t ping_main;
+extern ping_main_t ping_main;
#define PING_DEFAULT_DATA_LEN 60
#define PING_DEFAULT_INTERVAL 1.0
-#define PING_MAXIMUM_DATA_SIZE 2000
-
-typedef CLIB_PACKED (struct
- {
- u16 id;
- u16 seq; f64 time_sent; u8 data[PING_MAXIMUM_DATA_SIZE];
- }) icmp46_echo_request_t;
-
+#define PING_MAXIMUM_DATA_SIZE 32768
-typedef CLIB_PACKED (struct
- {
- ip6_header_t ip6;
- icmp46_header_t icmp; icmp46_echo_request_t icmp_echo;
- }) icmp6_echo_request_header_t;
+#define PING_CLI_UNKNOWN_NODE (~0)
-typedef CLIB_PACKED (struct
- {
- ip4_header_t ip4;
- icmp46_header_t icmp; icmp46_echo_request_t icmp_echo;
- }) icmp4_echo_request_header_t;
+/* *INDENT-OFF* */
-
-typedef struct
-{
+typedef CLIB_PACKED (struct {
u16 id;
u16 seq;
- u8 bound;
-} icmp_echo_trace_t;
+ u64 time_sent;
+ u8 data[0];
+}) icmp46_echo_request_t;
+/* *INDENT-ON* */
-
-typedef enum
-{
- ICMP6_ECHO_REPLY_NEXT_DROP,
- ICMP6_ECHO_REPLY_NEXT_PUNT,
- ICMP6_ECHO_REPLY_N_NEXT,
-} icmp6_echo_reply_next_t;
-
typedef enum
{
- ICMP4_ECHO_REPLY_NEXT_DROP,
- ICMP4_ECHO_REPLY_NEXT_PUNT,
- ICMP4_ECHO_REPLY_N_NEXT,
-} icmp4_echo_reply_next_t;
+ ICMP46_ECHO_REPLY_NEXT_DROP,
+ ICMP46_ECHO_REPLY_NEXT_PUNT,
+ ICMP46_ECHO_REPLY_N_NEXT,
+} icmp46_echo_reply_next_t;
#endif /* included_vnet_ping_h */