aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/vnic
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2017-11-10 22:17:30 +0000
committerEd Maste <emaste@FreeBSD.org>2017-11-10 22:17:30 +0000
commit2dc620ac8318f40c8843896e4e568bb08575fcda (patch)
treedb8c132ab73d420eb6d4979b03ef0bd99dc856ec /sys/dev/vnic
parent6555da9c5b651748fa0245d6525a3880d3d3993c (diff)
downloadsrc-2dc620ac8318f40c8843896e4e568bb08575fcda.tar.gz
src-2dc620ac8318f40c8843896e4e568bb08575fcda.zip
vnic: apply BPF tap before passing packet to hardware
Previously we passed tx packets to hardware via nicvf_tx_mbuf_locked and then to the BPF tap, with a possibly invalid mbuf which would result in a panic. PR: 223600 Discussed with: bz MFC after: 1 week Sponsored by: The FreeBSD Foundation, Packet.net (hardware)
Notes
Notes: svn path=/head/; revision=325683
Diffstat (limited to 'sys/dev/vnic')
-rw-r--r--sys/dev/vnic/nicvf_queues.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/vnic/nicvf_queues.c b/sys/dev/vnic/nicvf_queues.c
index bd65e40fe8ad..90e658d891bf 100644
--- a/sys/dev/vnic/nicvf_queues.c
+++ b/sys/dev/vnic/nicvf_queues.c
@@ -992,6 +992,9 @@ nicvf_xmit_locked(struct snd_queue *sq)
err = 0;
while ((next = drbr_peek(ifp, sq->br)) != NULL) {
+ /* Send a copy of the frame to the BPF listener */
+ ETHER_BPF_MTAP(ifp, next);
+
err = nicvf_tx_mbuf_locked(sq, &next);
if (err != 0) {
if (next == NULL)
@@ -1002,8 +1005,6 @@ nicvf_xmit_locked(struct snd_queue *sq)
break;
}
drbr_advance(ifp, sq->br);
- /* Send a copy of the frame to the BPF listener */
- ETHER_BPF_MTAP(ifp, next);
}
return (err);
}