aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-04-03 17:22:32 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-03 17:22:32 -0400
commit3d58b5fa8e4c461ab09afdacd3d1754fccca06ad (patch)
treeb5793c1cc2f0d41657c5e5d101cc00e07c515a60
parent4f049b4f33d07bd11335c3a074ebef14213a3e37 (diff)
[INET]: Rename inet_csk_ctl_sock_create to inet_ctl_sock_create.
This call is nothing common with INET connection sockets code. It simply creates an unhashes kernel sockets for protocol messages. Move the new call into af_inet.c after the rename. Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/inet_common.h5
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--net/dccp/ipv4.c4
-rw-r--r--net/dccp/ipv6.c4
-rw-r--r--net/ipv4/af_inet.c19
-rw-r--r--net/ipv4/inet_connection_sock.c19
-rw-r--r--net/ipv4/tcp_ipv4.c4
-rw-r--r--net/ipv6/tcp_ipv6.c3
8 files changed, 32 insertions, 31 deletions
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 38d5a1e9980d..d6238bdefbaf 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -39,6 +39,11 @@ extern int inet_getname(struct socket *sock,
39extern int inet_ioctl(struct socket *sock, 39extern int inet_ioctl(struct socket *sock,
40 unsigned int cmd, unsigned long arg); 40 unsigned int cmd, unsigned long arg);
41 41
42extern int inet_ctl_sock_create(struct socket **sock,
43 unsigned short family,
44 unsigned short type,
45 unsigned char protocol);
46
42#endif 47#endif
43 48
44 49
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index f00f0573627b..2ff545a56fb5 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -327,11 +327,6 @@ extern void inet_csk_listen_stop(struct sock *sk);
327 327
328extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 328extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
329 329
330extern int inet_csk_ctl_sock_create(struct socket **sock,
331 unsigned short family,
332 unsigned short type,
333 unsigned char protocol);
334
335extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 330extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
336 char __user *optval, int __user *optlen); 331 char __user *optval, int __user *optlen);
337extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 332extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 6d8f684a7a49..feb3fa5b7141 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -1003,8 +1003,8 @@ static int __init dccp_v4_init(void)
1003 1003
1004 inet_register_protosw(&dccp_v4_protosw); 1004 inet_register_protosw(&dccp_v4_protosw);
1005 1005
1006 err = inet_csk_ctl_sock_create(&socket, PF_INET, 1006 err = inet_ctl_sock_create(&socket, PF_INET,
1007 SOCK_DCCP, IPPROTO_DCCP); 1007 SOCK_DCCP, IPPROTO_DCCP);
1008 if (err) 1008 if (err)
1009 goto out_unregister_protosw; 1009 goto out_unregister_protosw;
1010 dccp_v4_ctl_sk = socket->sk; 1010 dccp_v4_ctl_sk = socket->sk;
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index c5d9d1be56f3..5690fbd3bf68 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -1185,8 +1185,8 @@ static int __init dccp_v6_init(void)
1185 1185
1186 inet6_register_protosw(&dccp_v6_protosw); 1186 inet6_register_protosw(&dccp_v6_protosw);
1187 1187
1188 err = inet_csk_ctl_sock_create(&socket, PF_INET6, 1188 err = inet_ctl_sock_create(&socket, PF_INET6,
1189 SOCK_DCCP, IPPROTO_DCCP); 1189 SOCK_DCCP, IPPROTO_DCCP);
1190 if (err != 0) 1190 if (err != 0)
1191 goto out_unregister_protosw; 1191 goto out_unregister_protosw;
1192 dccp_v6_ctl_sk = socket->sk; 1192 dccp_v6_ctl_sk = socket->sk;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 5882a1316441..7ab0bd64c9d1 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1250,6 +1250,25 @@ out:
1250 return segs; 1250 return segs;
1251} 1251}
1252 1252
1253int inet_ctl_sock_create(struct socket **sock, unsigned short family,
1254 unsigned short type, unsigned char protocol)
1255{
1256 int rc = sock_create_kern(family, type, protocol, sock);
1257
1258 if (rc == 0) {
1259 (*sock)->sk->sk_allocation = GFP_ATOMIC;
1260 inet_sk((*sock)->sk)->uc_ttl = -1;
1261 /*
1262 * Unhash it so that IP input processing does not even see it,
1263 * we do not wish this socket to see incoming packets.
1264 */
1265 (*sock)->sk->sk_prot->unhash((*sock)->sk);
1266 }
1267 return rc;
1268}
1269
1270EXPORT_SYMBOL_GPL(inet_ctl_sock_create);
1271
1253unsigned long snmp_fold_field(void *mib[], int offt) 1272unsigned long snmp_fold_field(void *mib[], int offt)
1254{ 1273{
1255 unsigned long res = 0; 1274 unsigned long res = 0;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index a7fcaf205644..ee55678a987d 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -651,25 +651,6 @@ void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr)
651 651
652EXPORT_SYMBOL_GPL(inet_csk_addr2sockaddr); 652EXPORT_SYMBOL_GPL(inet_csk_addr2sockaddr);
653 653
654int inet_csk_ctl_sock_create(struct socket **sock, unsigned short family,
655 unsigned short type, unsigned char protocol)
656{
657 int rc = sock_create_kern(family, type, protocol, sock);
658
659 if (rc == 0) {
660 (*sock)->sk->sk_allocation = GFP_ATOMIC;
661 inet_sk((*sock)->sk)->uc_ttl = -1;
662 /*
663 * Unhash it so that IP input processing does not even see it,
664 * we do not wish this socket to see incoming packets.
665 */
666 (*sock)->sk->sk_prot->unhash((*sock)->sk);
667 }
668 return rc;
669}
670
671EXPORT_SYMBOL_GPL(inet_csk_ctl_sock_create);
672
673#ifdef CONFIG_COMPAT 654#ifdef CONFIG_COMPAT
674int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 655int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
675 char __user *optval, int __user *optlen) 656 char __user *optval, int __user *optlen)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 1d77f37d7708..edf5a37bb5c3 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2491,8 +2491,8 @@ struct proto tcp_prot = {
2491void __init tcp_v4_init(void) 2491void __init tcp_v4_init(void)
2492{ 2492{
2493 struct socket *__tcp_socket; 2493 struct socket *__tcp_socket;
2494 if (inet_csk_ctl_sock_create(&__tcp_socket, PF_INET, SOCK_RAW, 2494 if (inet_ctl_sock_create(&__tcp_socket, PF_INET, SOCK_RAW,
2495 IPPROTO_TCP) < 0) 2495 IPPROTO_TCP) < 0)
2496 panic("Failed to create the TCP control socket.\n"); 2496 panic("Failed to create the TCP control socket.\n");
2497 tcp_sock = __tcp_socket->sk; 2497 tcp_sock = __tcp_socket->sk;
2498} 2498}
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 6d851c3c3db9..d98222fba041 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -60,6 +60,7 @@
60#include <net/dsfield.h> 60#include <net/dsfield.h>
61#include <net/timewait_sock.h> 61#include <net/timewait_sock.h>
62#include <net/netdma.h> 62#include <net/netdma.h>
63#include <net/inet_common.h>
63 64
64#include <asm/uaccess.h> 65#include <asm/uaccess.h>
65 66
@@ -2202,7 +2203,7 @@ static int tcpv6_net_init(struct net *net)
2202 struct socket *sock; 2203 struct socket *sock;
2203 struct sock *sk; 2204 struct sock *sk;
2204 2205
2205 err = inet_csk_ctl_sock_create(&sock, PF_INET6, SOCK_RAW, IPPROTO_TCP); 2206 err = inet_ctl_sock_create(&sock, PF_INET6, SOCK_RAW, IPPROTO_TCP);
2206 if (err) 2207 if (err)
2207 return err; 2208 return err;
2208 2209