Fix vpp crash sending arp or probing neighb (VPP-917)
VPP crash when trying to send arp message or to probe neighbor over
interface with IP address but without hw address (local0 and tunnels
- vxlan, gre, ...)
Change-Id: I08a1c97d3ea913fc11b2886cf73b2ccc31356664
Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 604e149..bc66416 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -481,6 +481,13 @@
u32 if_address_index;
ip6_address_fib_t ip6_af, *addr_fib = 0;
+ /* local0 interface doesn't support IP addressing */
+ if (sw_if_index == 0)
+ {
+ return
+ clib_error_create ("local0 interface doesn't support IP addressing");
+ }
+
vec_validate (im->fib_index_by_sw_if_index, sw_if_index);
vec_validate (im->mfib_index_by_sw_if_index, sw_if_index);
@@ -1918,6 +1925,14 @@
h->ip.src_address = src[0];
h->neighbor.target_address = dst[0];
+ if (PREDICT_FALSE (!hi->hw_address))
+ {
+ return clib_error_return (0, "%U: interface %U do not support ip probe",
+ format_ip6_address, dst,
+ format_vnet_sw_if_index_name, vnm,
+ sw_if_index);
+ }
+
clib_memcpy (h->link_layer_option.ethernet_address, hi->hw_address,
vec_len (hi->hw_address));