]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
netmap: pkt-gen: fix bug in send_packets()
authorvmaffione <vmaffione@FreeBSD.org>
Fri, 1 Mar 2019 09:10:16 +0000 (09:10 +0000)
committervmaffione <vmaffione@FreeBSD.org>
Fri, 1 Mar 2019 09:10:16 +0000 (09:10 +0000)
commit866783d998d1857ae1d0e86a800a5db17663420f
tree6609cda036747be6de5be19e1e02d8dc763a028b
parentbd8ba96fed2d3797e6f4741bff0e4ed82967e23a
netmap: pkt-gen: fix bug in send_packets()

The send_packets() function was using ring->cur as index to scan
the transmit ring. This function may also set ring->cur ahead of
ring->head, in case no more slots are available. However, the function
also uses nm_ring_space() which looks at ring->head to check how many
slots are available. If ring->head and ring->cur are different, this
results in pkt-gen advancing ring->cur beyond ring->tail.

This patch fixes send_packets() (and similar source locations) to
use ring->head as a index, rather than using ring->cur.

MFC after: 1 week
tools/tools/netmap/pkt-gen.c