net: add sock_set_reuseaddr
Add a helper to directly set the SO_REUSEADDR sockopt from kernel space without going through a fake uaccess. For this the iscsi target now has to formally depend on inet to avoid a mostly theoretical compile failure. For actual operation it already did depend on having ipv4 or ipv6 support. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
1eba1110f0
commit
b58f0e8f38
@@ -712,6 +712,14 @@ bool sk_mc_loop(struct sock *sk)
|
||||
}
|
||||
EXPORT_SYMBOL(sk_mc_loop);
|
||||
|
||||
void sock_set_reuseaddr(struct sock *sk)
|
||||
{
|
||||
lock_sock(sk);
|
||||
sk->sk_reuse = SK_CAN_REUSE;
|
||||
release_sock(sk);
|
||||
}
|
||||
EXPORT_SYMBOL(sock_set_reuseaddr);
|
||||
|
||||
/*
|
||||
* This is meant for all protocols to use and covers goings on
|
||||
* at the socket level. Everything here is generic.
|
||||
|
||||
Reference in New Issue
Block a user