net: bpf: add a test for skb_segment in test_bpf module
authorYonghong Song <yhs@fb.com>
Wed, 21 Mar 2018 23:31:04 +0000 (16:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 25 Mar 2018 20:46:05 +0000 (16:46 -0400)
commit76db8087c4c991dcd17f5ea8ac0eafd0696ab450
tree363db69617b1f877f43821037fb803d56790c461
parent13acc94eff122b260a387d68668bf9d670738e6a
net: bpf: add a test for skb_segment in test_bpf module

Without the previous commit,
"modprobe test_bpf" will have the following errors:
...
[   98.149165] ------------[ cut here ]------------
[   98.159362] kernel BUG at net/core/skbuff.c:3667!
[   98.169756] invalid opcode: 0000 [#1] SMP PTI
[   98.179370] Modules linked in:
[   98.179371]  test_bpf(+)
...
which triggers the bug the previous commit intends to fix.

The skbs are constructed to mimic what mlx5 may generate.
The packet size/header may not mimic real cases in production. But
the processing flow is similar.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/test_bpf.c