mirror of https://gitee.com/openkylin/linux.git
bpf: bpf_setsockopt: reset sock dst on SO_MARK changes
In sock_setsockopt() (net/core/sock.h), when SO_MARK option is used
to change sk_mark, sk_dst_reset(sk) is called. The same should be
done in bpf_setsockopt().
Fixes: 8c4b4c7e9f
("bpf: Add setsockopt helper function to bpf")
Reported-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Peter Oskolkov <posk@google.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
c61c27687a
commit
f4924f24da
|
@ -4132,7 +4132,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
|
||||||
sk->sk_rcvlowat = val ? : 1;
|
sk->sk_rcvlowat = val ? : 1;
|
||||||
break;
|
break;
|
||||||
case SO_MARK:
|
case SO_MARK:
|
||||||
sk->sk_mark = val;
|
if (sk->sk_mark != val) {
|
||||||
|
sk->sk_mark = val;
|
||||||
|
sk_dst_reset(sk);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
|
Loading…
Reference in New Issue