Skip to content

Commit 5540fbf

Browse files
williamtuborkmann
authored andcommitted
bpf: clear the ip_tunnel_info.
The percpu metadata_dst might carry the stale ip_tunnel_info and cause incorrect behavior. When mixing tests using ipv4/ipv6 bpf vxlan and geneve tunnel, the ipv6 tunnel info incorrectly uses ipv4's src ip addr as its ipv6 src address, because the previous tunnel info does not clean up. The patch zeros the fields in ip_tunnel_info. Signed-off-by: William Tu <[email protected]> Reported-by: Yifeng Sun <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent b3f8ade commit 5540fbf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/core/filter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,6 +3240,7 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
32403240
skb_dst_set(skb, (struct dst_entry *) md);
32413241

32423242
info = &md->u.tun_info;
3243+
memset(info, 0, sizeof(*info));
32433244
info->mode = IP_TUNNEL_INFO_TX;
32443245

32453246
info->key.tun_flags = TUNNEL_KEY | TUNNEL_CSUM | TUNNEL_NOCACHE;

0 commit comments

Comments
 (0)