/* The routines beyond this point handle the behaviour of an AF_INET socket object. Mostly it punts to the subprotocols of IP to do the work. Automatically bind an unbound socket.  */
static int inet_autobind(struct sock *sk)
/* The routines beyond this point handle the behaviour of an AF_INET socket object. Mostly it punts to the subprotocols of IP to do the work. Automatically bind an unbound socket.  */
static int inet_autobind(struct sock *sk)
{
	struct inet_sock *inet;
	lock_sock(sk);
	inet = inet_sk(sk);
	if (!inet->inet_num) {
		if (sk->sk_prot->get_port(sk, 0)) {
			release_sock(sk);
			return -EAGAIN;
		}
		inet->inet_sport = htons(inet->inet_num);
	}
	release_sock(sk);
	return 0;
}