VPP-621: ping: ICMP echo data size must be bounded by VLIB_BUFFER_DATA_SIZE minus headers.

Before the commit 878c6098 the VLIB_BUFFER_DATA_SIZE was different depending
on whether building "vpp" or "vpp_lite", resulting in an overrun in vpp_lite build.
Avoid the hardcoded value and make the upper bound for ICMP echo data size
dependent on the buffer size.

Change-Id: Id6c4d7fc73766a95af2610eb237881b5fe9ce9aa
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
diff --git a/src/vnet/ip/ping.h b/src/vnet/ip/ping.h
index 8f41f45..1887314 100644
--- a/src/vnet/ip/ping.h
+++ b/src/vnet/ip/ping.h
@@ -59,26 +59,31 @@
 #define PING_DEFAULT_DATA_LEN 60
 #define PING_DEFAULT_INTERVAL 1.0
 
-#define PING_MAXIMUM_DATA_SIZE 2000
+#define PING_MAXIMUM_DATA_SIZE (VLIB_BUFFER_DATA_SIZE - sizeof(ip6_header_t) - sizeof(icmp46_header_t) - offsetof(icmp46_echo_request_t, data))
 
-typedef CLIB_PACKED (struct
-		     {
-		     u16 id;
-		     u16 seq; f64 time_sent; u8 data[PING_MAXIMUM_DATA_SIZE];
-		     }) icmp46_echo_request_t;
+/* *INDENT-OFF* */
+
+typedef CLIB_PACKED (struct {
+  u16 id;
+  u16 seq;
+  f64 time_sent;
+  u8 data[0];
+}) icmp46_echo_request_t;
 
 
-typedef CLIB_PACKED (struct
-		     {
-		     ip6_header_t ip6;
-		     icmp46_header_t icmp; icmp46_echo_request_t icmp_echo;
-		     }) icmp6_echo_request_header_t;
+typedef CLIB_PACKED (struct {
+  ip6_header_t ip6;
+  icmp46_header_t icmp;
+  icmp46_echo_request_t icmp_echo;
+}) icmp6_echo_request_header_t;
 
-typedef CLIB_PACKED (struct
-		     {
-		     ip4_header_t ip4;
-		     icmp46_header_t icmp; icmp46_echo_request_t icmp_echo;
-		     }) icmp4_echo_request_header_t;
+typedef CLIB_PACKED (struct {
+  ip4_header_t ip4;
+  icmp46_header_t icmp;
+  icmp46_echo_request_t icmp_echo;
+}) icmp4_echo_request_header_t;
+
+/* *INDENT-ON* */
 
 
 typedef struct