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>
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 5ea7d8d..cf1011f 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -1476,6 +1476,8 @@
vlib_packet_template_get_packet (vm,
&im->discover_neighbor_packet_template,
&bi);
+ if (!h)
+ return clib_error_return (0, "ICMP6 NS packet allocation failed");
hi = vnet_get_sup_hw_interface (vnm, sw_if_index);