summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip6_neighbor.c
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2018-06-19 15:27:48 -0400
committerDave Barach <openvpp@barachs.net>2018-06-19 21:26:10 +0000
commit084606befb45507e9241b5555f86196fe08530f6 (patch)
tree25982dd871832335b2f62159657c3b3b31e361f2 /src/vnet/ip/ip6_neighbor.c
parent7e607a73898b81c21a24038a2350fdda3b1c67ff (diff)
Check get packet template allocation failure (VPP-1321)
After calling vlib_packet_template_get_packet(), make sure packet buffer is allocated before using it. Change-Id: Idb5199f4e2c9596137b2101e502d611f474a6ffe Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet/ip/ip6_neighbor.c')
-rw-r--r--src/vnet/ip/ip6_neighbor.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index e281d7e1d2f..6d91224c0b4 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -466,6 +466,8 @@ ip6_nbr_probe (ip_adjacency_t * adj)
h = vlib_packet_template_get_packet (vm,
&im->discover_neighbor_packet_template,
&bi);
+ if (!h)
+ return;
hi = vnet_get_sup_hw_interface (vnm, adj->rewrite_header.sw_if_index);
@@ -3285,6 +3287,8 @@ ip6_discover_neighbor_inline (vlib_main_t * vm,
h0 = vlib_packet_template_get_packet
(vm, &im->discover_neighbor_packet_template, &bi0);
+ if (!h0)
+ continue;
/*
* Build ethernet header.
@@ -5037,6 +5041,9 @@ send_ip6_na_w_addr (vlib_main_t * vm,
vlib_packet_template_get_packet (vm,
&i6m->discover_neighbor_packet_template,
&bi);
+ if (!h)
+ return;
+
ip6_set_reserved_multicast_address (&h->ip.dst_address,
IP6_MULTICAST_SCOPE_link_local,
IP6_MULTICAST_GROUP_ID_all_hosts);