summaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-03-20 22:01:03 -0800
committerDavid S. Miller <davem@davemloft.net>2006-03-20 22:01:03 -0800
commitc4d9390941aee136fd35bb38eb1d6de4e3b1487d (patch)
treefcaf0032ba5971145b5f527b8635cd7aa3a39d8c /net/dccp
parent72478873571d869906f7a250b09e12fa5b65e321 (diff)
[ICSK]: Introduce inet_csk_ctl_sock_create
Consolidating open coded sequences in tcp and dccp, v4 and v6. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ipv4.c26
-rw-r--r--net/dccp/ipv6.c27
2 files changed, 5 insertions, 48 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index f53bce590ad..7098f1055f4 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -1099,29 +1099,6 @@ static struct inet_protosw dccp_v4_protosw = {
.flags = INET_PROTOSW_ICSK,
};
-static char dccp_v4_ctl_socket_err_msg[] __initdata =
- KERN_ERR "DCCP: Failed to create the control socket.\n";
-
-static int __init dccp_v4_ctl_sock_init(void)
-{
- int rc = sock_create_kern(PF_INET, SOCK_DCCP, IPPROTO_DCCP,
- &dccp_v4_ctl_socket);
- if (rc < 0)
- printk(dccp_v4_ctl_socket_err_msg);
- else {
- dccp_v4_ctl_socket->sk->sk_allocation = GFP_ATOMIC;
- inet_sk(dccp_v4_ctl_socket->sk)->uc_ttl = -1;
-
- /* Unhash it so that IP input processing does not even
- * see it, we do not wish this socket to see incoming
- * packets.
- */
- dccp_v4_ctl_socket->sk->sk_prot->unhash(dccp_v4_ctl_socket->sk);
- }
-
- return rc;
-}
-
static int __init dccp_v4_init(void)
{
int err = proto_register(&dccp_v4_prot, 1);
@@ -1135,7 +1112,8 @@ static int __init dccp_v4_init(void)
inet_register_protosw(&dccp_v4_protosw);
- err = dccp_v4_ctl_sock_init();
+ err = inet_csk_ctl_sock_create(&dccp_v4_ctl_socket, PF_INET,
+ SOCK_DCCP, IPPROTO_DCCP);
if (err)
goto out_unregister_protosw;
out:
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 3c9f0836404..6bd9979334a 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -1229,29 +1229,6 @@ static struct inet_protosw dccp_v6_protosw = {
.flags = INET_PROTOSW_ICSK,
};
-static char dccp_v6_ctl_socket_err_msg[] __initdata =
- KERN_ERR "DCCP: Failed to create the control socket.\n";
-
-static int __init dccp_v6_ctl_sock_init(void)
-{
- int rc = sock_create_kern(PF_INET6, SOCK_DCCP, IPPROTO_DCCP,
- &dccp_v6_ctl_socket);
- if (rc < 0)
- printk(dccp_v6_ctl_socket_err_msg);
- else {
- dccp_v6_ctl_socket->sk->sk_allocation = GFP_ATOMIC;
- inet_sk(dccp_v6_ctl_socket->sk)->uc_ttl = -1;
-
- /* Unhash it so that IP input processing does not even
- * see it, we do not wish this socket to see incoming
- * packets.
- */
- dccp_v6_ctl_socket->sk->sk_prot->unhash(dccp_v6_ctl_socket->sk);
- }
-
- return rc;
-}
-
static int __init dccp_v6_init(void)
{
int err = proto_register(&dccp_v6_prot, 1);
@@ -1265,7 +1242,9 @@ static int __init dccp_v6_init(void)
inet6_register_protosw(&dccp_v6_protosw);
- if (dccp_v6_ctl_sock_init() != 0)
+ err = inet_csk_ctl_sock_create(&dccp_v6_ctl_socket, PF_INET6,
+ SOCK_DCCP, IPPROTO_DCCP);
+ if (err != 0)
goto out_unregister_protosw;
out:
return err;