aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorPavel Kotucek <pkotucek@cisco.com>2017-08-02 08:20:19 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-08-02 16:06:30 +0000
commit5780898e5be8e8c279ac469417688d5b884f0217 (patch)
tree478ff7245680d09a9e63cebfa92169e7716d18bc /src/vnet
parentac0c96bc569b3c75186a089b810ac98db4bf5780 (diff)
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>
Diffstat (limited to 'src/vnet')
-rwxr-xr-xsrc/vnet/ip/ip4_forward.c14
-rw-r--r--src/vnet/ip/ip6_forward.c15
2 files changed, 29 insertions, 0 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 4b05bf10c75..ee17ea8804e 100755
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -898,6 +898,13 @@ ip4_add_del_interface_address_internal (vlib_main_t * vm,
u32 if_address_index, elts_before;
ip4_address_fib_t ip4_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);
ip4_addr_fib_init (&ip4_af, address,
vec_elt (im->fib_index_by_sw_if_index, sw_if_index));
@@ -2319,6 +2326,13 @@ ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index)
&bi);
hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
+ if (PREDICT_FALSE (!hi->hw_address))
+ {
+ return clib_error_return (0, "%U: interface %U do not support ip probe",
+ format_ip4_address, dst,
+ format_vnet_sw_if_index_name, vnm,
+ sw_if_index);
+ }
clib_memcpy (h->ip4_over_ethernet[0].ethernet, hi->hw_address,
sizeof (h->ip4_over_ethernet[0].ethernet));
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 604e14924f9..bc66416e5ef 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -481,6 +481,13 @@ ip6_add_del_interface_address (vlib_main_t * vm,
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 @@ ip6_probe_neighbor (vlib_main_t * vm, ip6_address_t * dst, u32 sw_if_index)
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));