mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
UPSTREAM: net: Refactor arguments of inet{,6}_bind
The intent is to add an additional bind parameter in the next commit. Instead of adding another argument, let's convert all existing flag arguments into an extendable bit field. No functional changes. Change-Id: I8b335adaa4989d837131f6307605cd90b7c98c8b Signed-off-by: Stanislav Fomichev <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Andrey Ignatov <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
This commit is contained in:
parent
39c446881b
commit
cce1ba71f9
5 changed files with 20 additions and 14 deletions
|
|
@ -277,7 +277,7 @@ out_sk_release:
|
|||
}
|
||||
|
||||
static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
|
||||
bool force_bind_address_no_port, bool with_lock)
|
||||
u32 flags)
|
||||
{
|
||||
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)uaddr;
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
|
|
@ -303,7 +303,7 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
|
|||
!ns_capable(net->user_ns, CAP_NET_BIND_SERVICE))
|
||||
return -EACCES;
|
||||
|
||||
if (with_lock)
|
||||
if (flags & BIND_WITH_LOCK)
|
||||
lock_sock(sk);
|
||||
|
||||
/* Check these errors (active socket, double bind). */
|
||||
|
|
@ -406,7 +406,7 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
|
|||
|
||||
/* Make sure we are allowed to bind here. */
|
||||
if (snum || !(inet->bind_address_no_port ||
|
||||
force_bind_address_no_port)) {
|
||||
(flags & BIND_FORCE_ADDRESS_NO_PORT))) {
|
||||
if (sk->sk_prot->get_port(sk, snum)) {
|
||||
sk->sk_ipv6only = saved_ipv6only;
|
||||
inet_reset_saddr(sk);
|
||||
|
|
@ -429,7 +429,7 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
|
|||
inet->inet_dport = 0;
|
||||
inet->inet_daddr = 0;
|
||||
out:
|
||||
if (with_lock)
|
||||
if (flags & BIND_WITH_LOCK)
|
||||
release_sock(sk);
|
||||
return err;
|
||||
out_unlock:
|
||||
|
|
@ -460,7 +460,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
return __inet6_bind(sk, uaddr, addr_len, false, true);
|
||||
return __inet6_bind(sk, uaddr, addr_len, BIND_WITH_LOCK);
|
||||
}
|
||||
EXPORT_SYMBOL(inet6_bind);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue