aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c63
1 files changed, 26 insertions, 37 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index b73a605c0847..96128d0fd8d2 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1655,6 +1655,30 @@ out:
1655 return ERR_PTR(err); 1655 return ERR_PTR(err);
1656} 1656}
1657 1657
1658static struct socket *xs_create_sock6(struct rpc_xprt *xprt,
1659 struct sock_xprt *transport, int type, int protocol)
1660{
1661 struct socket *sock;
1662 int err;
1663
1664 err = __sock_create(xprt->xprt_net, PF_INET6, type, protocol, &sock, 1);
1665 if (err < 0) {
1666 dprintk("RPC: can't create %d transport socket (%d).\n",
1667 protocol, -err);
1668 goto out;
1669 }
1670 xs_reclassify_socket6(sock);
1671
1672 if (xs_bind6(transport, sock)) {
1673 sock_release(sock);
1674 goto out;
1675 }
1676
1677 return sock;
1678out:
1679 return ERR_PTR(err);
1680}
1681
1658static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) 1682static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1659{ 1683{
1660 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 1684 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
@@ -1745,24 +1769,7 @@ static void xs_udp_connect_worker4(struct work_struct *work)
1745static struct socket *xs_create_udp_sock6(struct rpc_xprt *xprt, 1769static struct socket *xs_create_udp_sock6(struct rpc_xprt *xprt,
1746 struct sock_xprt *transport) 1770 struct sock_xprt *transport)
1747{ 1771{
1748 struct socket *sock; 1772 return xs_create_sock6(xprt, transport, SOCK_DGRAM, IPPROTO_UDP);
1749 int err;
1750
1751 err = __sock_create(xprt->xprt_net, PF_INET6, SOCK_DGRAM, IPPROTO_UDP, &sock, 1);
1752 if (err < 0) {
1753 dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
1754 goto out;
1755 }
1756 xs_reclassify_socket6(sock);
1757
1758 if (xs_bind6(transport, sock) < 0) {
1759 sock_release(sock);
1760 goto out;
1761 }
1762
1763 return sock;
1764out:
1765 return ERR_PTR(err);
1766} 1773}
1767 1774
1768static void xs_udp_connect_worker6(struct work_struct *work) 1775static void xs_udp_connect_worker6(struct work_struct *work)
@@ -1970,25 +1977,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
1970static struct socket *xs_create_tcp_sock6(struct rpc_xprt *xprt, 1977static struct socket *xs_create_tcp_sock6(struct rpc_xprt *xprt,
1971 struct sock_xprt *transport) 1978 struct sock_xprt *transport)
1972{ 1979{
1973 struct socket *sock; 1980 return xs_create_sock6(xprt, transport, SOCK_STREAM, IPPROTO_TCP);
1974 int err;
1975
1976 /* start from scratch */
1977 err = __sock_create(xprt->xprt_net, PF_INET6, SOCK_STREAM, IPPROTO_TCP, &sock, 1);
1978 if (err < 0) {
1979 dprintk("RPC: can't create TCP transport socket (%d).\n",
1980 -err);
1981 goto out_err;
1982 }
1983 xs_reclassify_socket6(sock);
1984
1985 if (xs_bind6(transport, sock) < 0) {
1986 sock_release(sock);
1987 goto out_err;
1988 }
1989 return sock;
1990out_err:
1991 return ERR_PTR(-EIO);
1992} 1981}
1993 1982
1994/** 1983/**