cdp/lldp: punt for no buffer 91/8591/1
authorSteven <sluong@cisco.com>
Thu, 28 Sep 2017 23:38:56 +0000 (16:38 -0700)
committerSteven <sluong@cisco.com>
Thu, 28 Sep 2017 23:38:56 +0000 (16:38 -0700)
When making a call to vlib_packet_template_get_packet(), it
is possible to get back a NULL if the system runs out of buffer.
This can happen when there is buffer leaks. But don't crash
just because we run out of buffers, just punt.

Change-Id: Ie90ea41f3dda6e583d48959cbd18ff124158d7f8
Signed-off-by: Steven <sluong@cisco.com>
src/vnet/cdp/cdp_periodic.c
src/vnet/lldp/lldp_output.c

index de11107..8899c49 100644 (file)
@@ -125,6 +125,9 @@ send_ethernet_hello (cdp_main_t * cm, cdp_neighbor_t * n, int count)
       h0 = vlib_packet_template_get_packet
        (vm, &cm->packet_templates[n->packet_template_index], &bi0);
 
+      if (!h0)
+       break;
+
       /* Add the interface's ethernet source address */
       hw = vnet_get_sup_hw_interface (vnm, n->sw_if_index);
 
index 950b79a..8698ec9 100644 (file)
@@ -145,6 +145,9 @@ lldp_send_ethernet (lldp_main_t * lm, lldp_intf_t * n, int shutdown)
    */
   h0 = vlib_packet_template_get_packet (vm, &lm->packet_template, &bi0);
 
+  if (!h0)
+    return;
+
   /* Add the interface's ethernet source address */
   hw = vnet_get_hw_interface (vnm, n->hw_if_index);