ipv4: add ip_sock_set_recverr

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christoph Hellwig
2020-05-28 07:12:28 +02:00
committed by David S. Miller
parent c4e446bf5a
commit db45c0ef25
3 changed files with 10 additions and 7 deletions

View File

@@ -589,6 +589,14 @@ void ip_sock_set_freebind(struct sock *sk)
}
EXPORT_SYMBOL(ip_sock_set_freebind);
void ip_sock_set_recverr(struct sock *sk)
{
lock_sock(sk);
inet_sk(sk)->recverr = true;
release_sock(sk);
}
EXPORT_SYMBOL(ip_sock_set_recverr);
/*
* Socket option code for IP. This is the end of the line after any
* TCP,UDP etc options on an IP socket.