ipv6: add ip6_sock_set_recvpktinfo

Add a helper to directly set the IPV6_RECVPKTINFO sockopt from kernel
space without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christoph Hellwig 2020-05-28 07:12:34 +02:00 committed by David S. Miller
parent 18d5ad6232
commit 7d7207c2d5
2 changed files with 9 additions and 8 deletions

View file

@ -1262,4 +1262,11 @@ static inline int ip6_sock_set_addr_preferences(struct sock *sk, bool val)
return ret;
}
static inline void ip6_sock_set_recvpktinfo(struct sock *sk)
{
lock_sock(sk);
inet6_sk(sk)->rxopt.bits.rxinfo = true;
release_sock(sk);
}
#endif /* _NET_IPV6_H */