aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/af_inet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r--net/ipv4/af_inet.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 3ceb025b16f2..6a1100c25a9f 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -727,28 +727,31 @@ int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
727 sock_rps_record_flow(sk); 727 sock_rps_record_flow(sk);
728 728
729 /* We may need to bind the socket. */ 729 /* We may need to bind the socket. */
730 if (!inet_sk(sk)->inet_num && inet_autobind(sk)) 730 if (!inet_sk(sk)->inet_num && !sk->sk_prot->no_autobind &&
731 inet_autobind(sk))
731 return -EAGAIN; 732 return -EAGAIN;
732 733
733 return sk->sk_prot->sendmsg(iocb, sk, msg, size); 734 return sk->sk_prot->sendmsg(iocb, sk, msg, size);
734} 735}
735EXPORT_SYMBOL(inet_sendmsg); 736EXPORT_SYMBOL(inet_sendmsg);
736 737
737static ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, 738ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
738 size_t size, int flags) 739 size_t size, int flags)
739{ 740{
740 struct sock *sk = sock->sk; 741 struct sock *sk = sock->sk;
741 742
742 sock_rps_record_flow(sk); 743 sock_rps_record_flow(sk);
743 744
744 /* We may need to bind the socket. */ 745 /* We may need to bind the socket. */
745 if (!inet_sk(sk)->inet_num && inet_autobind(sk)) 746 if (!inet_sk(sk)->inet_num && !sk->sk_prot->no_autobind &&
747 inet_autobind(sk))
746 return -EAGAIN; 748 return -EAGAIN;
747 749
748 if (sk->sk_prot->sendpage) 750 if (sk->sk_prot->sendpage)
749 return sk->sk_prot->sendpage(sk, page, offset, size, flags); 751 return sk->sk_prot->sendpage(sk, page, offset, size, flags);
750 return sock_no_sendpage(sock, page, offset, size, flags); 752 return sock_no_sendpage(sock, page, offset, size, flags);
751} 753}
754EXPORT_SYMBOL(inet_sendpage);
752 755
753int inet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, 756int inet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
754 size_t size, int flags) 757 size_t size, int flags)
@@ -894,10 +897,10 @@ const struct proto_ops inet_stream_ops = {
894 .shutdown = inet_shutdown, 897 .shutdown = inet_shutdown,
895 .setsockopt = sock_common_setsockopt, 898 .setsockopt = sock_common_setsockopt,
896 .getsockopt = sock_common_getsockopt, 899 .getsockopt = sock_common_getsockopt,
897 .sendmsg = tcp_sendmsg, 900 .sendmsg = inet_sendmsg,
898 .recvmsg = inet_recvmsg, 901 .recvmsg = inet_recvmsg,
899 .mmap = sock_no_mmap, 902 .mmap = sock_no_mmap,
900 .sendpage = tcp_sendpage, 903 .sendpage = inet_sendpage,
901 .splice_read = tcp_splice_read, 904 .splice_read = tcp_splice_read,
902#ifdef CONFIG_COMPAT 905#ifdef CONFIG_COMPAT
903 .compat_setsockopt = compat_sock_common_setsockopt, 906 .compat_setsockopt = compat_sock_common_setsockopt,