af_packet driver needs to check VLIB_BUFFER_NEXT_PRESENT flag is set

when walking  vlib_buffer_t next_buffer chain on transmit.
On buffer allocation:
- next_buffer is not and may contain a stale invalid value that
  should be ignored if not overwritten by a valid value.
- VLIB_BUFFER_NEXT_PRESENT flag is cleared and only set
  if a valid value is written to next_buffer.

Change-Id: I9b0ccdc54f4f7456f8328ce7c4a0d52d0fba8caa
Signed-off-by: Jim Gibson <gibson+fdio@cisco.com>
This commit is contained in:
Jim Gibson
2017-03-27 19:46:12 +00:00
committed by Damjan Marion
parent da1f2c7cff
commit 22db11b491

View File

@ -125,7 +125,8 @@ af_packet_interface_tx (vlib_main_t * vm,
vlib_buffer_get_current (b0), len);
offset += len;
}
while ((bi = b0->next_buffer));
while ((bi =
(b0->flags & VLIB_BUFFER_NEXT_PRESENT) ? b0->next_buffer : 0));
tph->tp_len = tph->tp_snaplen = offset;
tph->tp_status = TP_STATUS_SEND_REQUEST;