ipv4: add ip_sock_set_freebind

Add a helper to directly set the IP_FREEBIND 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:27 +02:00
committed by David S. Miller
parent 6ebf71bab9
commit c4e446bf5a
3 changed files with 12 additions and 10 deletions

View File

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