Skip to content
Commit 9840a4ff authored by Petar Penkov's avatar Petar Penkov Committed by Daniel Borkmann
Browse files

selftests/bpf: fix race in flow dissector tests

Since the "last_dissection" map holds only the flow keys for the most
recent packet, there is a small race in the skb-less flow dissector
tests if a new packet comes between transmitting the test packet, and
reading its keys from the map. If this happens, the test packet keys
will be overwritten and the test will fail.

Changing the "last_dissection" map to a hash map, keyed on the
source/dest port pair resolves this issue. Additionally, let's clear the
last test results from the map between tests to prevent previous test
cases from interfering with the following test cases.

Fixes: 0905beec

 ("selftests/bpf: run flow dissector tests in skb-less mode")
Signed-off-by: default avatarPetar Penkov <ppenkov@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent d66fa3c7
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment