• Stanislav Fomichev's avatar
    selftests/bpf: fix vlan handling in flow dissector program · 2c3af7d9
    Stanislav Fomichev authored
    When we tail call PROG(VLAN) from parse_eth_proto we don't need to peek
    back to handle vlan proto because we didn't adjust nhoff/thoff yet. Use
    flow_keys->n_proto, that we set in parse_eth_proto instead and
    properly increment nhoff as well.
    
    Also, always use skb->protocol and don't look at skb->vlan_present.
    skb->vlan_present indicates that vlan information is stored out-of-band
    in skb->vlan_{tci,proto} and vlan header is already pulled from skb.
    That means, skb->vlan_present == true is not relevant for BPF flow
    dissector.
    
    Add simple test cases with VLAN tagged frames:
      * single vlan for ipv4
      * double vlan for ipv6
    Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    2c3af7d9
flow_dissector.c 4.26 KB