diff options
author | John Lo <loj@cisco.com> | 2018-06-19 15:27:48 -0400 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-06-19 21:26:10 +0000 |
commit | 084606befb45507e9241b5555f86196fe08530f6 (patch) | |
tree | 25982dd871832335b2f62159657c3b3b31e361f2 /src/vnet/ethernet/arp.c | |
parent | 7e607a73898b81c21a24038a2350fdda3b1c67ff (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/ethernet/arp.c')
-rw-r--r-- | src/vnet/ethernet/arp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c index 37e3e88c2f2..a17f7dae02b 100644 --- a/src/vnet/ethernet/arp.c +++ b/src/vnet/ethernet/arp.c @@ -352,6 +352,8 @@ arp_nbr_probe (ip_adjacency_t * adj) h = vlib_packet_template_get_packet (vm, &im->ip4_arp_request_packet_template, &bi); + if (!h) + return; hi = vnet_get_sup_hw_interface (vnm, adj->rewrite_header.sw_if_index); @@ -2579,6 +2581,10 @@ send_ip4_garp_w_addr (vlib_main_t * vm, u32 bi = 0; ethernet_arp_header_t *h = vlib_packet_template_get_packet (vm, &i4m->ip4_arp_request_packet_template, &bi); + + if (!h) + return; + clib_memcpy (h->ip4_over_ethernet[0].ethernet, hi->hw_address, sizeof (h->ip4_over_ethernet[0].ethernet)); clib_memcpy (h->ip4_over_ethernet[1].ethernet, hi->hw_address, |