Commit 3d58b5fa authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[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: default avatarDenis V. Lunev <den@openvz.org>
Acked-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4f049b4f
...@@ -39,6 +39,11 @@ extern int inet_getname(struct socket *sock, ...@@ -39,6 +39,11 @@ extern int inet_getname(struct socket *sock,
extern int inet_ioctl(struct socket *sock, extern int inet_ioctl(struct socket *sock,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern int inet_ctl_sock_create(struct socket **sock,
unsigned short family,
unsigned short type,
unsigned char protocol);
#endif #endif
...@@ -327,11 +327,6 @@ extern void inet_csk_listen_stop(struct sock *sk); ...@@ -327,11 +327,6 @@ extern void inet_csk_listen_stop(struct sock *sk);
extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
extern int inet_csk_ctl_sock_create(struct socket **sock,
unsigned short family,
unsigned short type,
unsigned char protocol);
extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen); char __user *optval, int __user *optlen);
extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
......
...@@ -1003,7 +1003,7 @@ static int __init dccp_v4_init(void) ...@@ -1003,7 +1003,7 @@ static int __init dccp_v4_init(void)
inet_register_protosw(&dccp_v4_protosw); inet_register_protosw(&dccp_v4_protosw);
err = inet_csk_ctl_sock_create(&socket, PF_INET, err = inet_ctl_sock_create(&socket, PF_INET,
SOCK_DCCP, IPPROTO_DCCP); SOCK_DCCP, IPPROTO_DCCP);
if (err) if (err)
goto out_unregister_protosw; goto out_unregister_protosw;
......
...@@ -1185,7 +1185,7 @@ static int __init dccp_v6_init(void) ...@@ -1185,7 +1185,7 @@ static int __init dccp_v6_init(void)
inet6_register_protosw(&dccp_v6_protosw); inet6_register_protosw(&dccp_v6_protosw);
err = inet_csk_ctl_sock_create(&socket, PF_INET6, err = inet_ctl_sock_create(&socket, PF_INET6,
SOCK_DCCP, IPPROTO_DCCP); SOCK_DCCP, IPPROTO_DCCP);
if (err != 0) if (err != 0)
goto out_unregister_protosw; goto out_unregister_protosw;
......
...@@ -1250,6 +1250,25 @@ out: ...@@ -1250,6 +1250,25 @@ out:
return segs; return segs;
} }
int inet_ctl_sock_create(struct socket **sock, unsigned short family,
unsigned short type, unsigned char protocol)
{
int rc = sock_create_kern(family, type, protocol, sock);
if (rc == 0) {
(*sock)->sk->sk_allocation = GFP_ATOMIC;
inet_sk((*sock)->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.
*/
(*sock)->sk->sk_prot->unhash((*sock)->sk);
}
return rc;
}
EXPORT_SYMBOL_GPL(inet_ctl_sock_create);
unsigned long snmp_fold_field(void *mib[], int offt) unsigned long snmp_fold_field(void *mib[], int offt)
{ {
unsigned long res = 0; unsigned long res = 0;
......
...@@ -651,25 +651,6 @@ void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr) ...@@ -651,25 +651,6 @@ void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr)
EXPORT_SYMBOL_GPL(inet_csk_addr2sockaddr); EXPORT_SYMBOL_GPL(inet_csk_addr2sockaddr);
int inet_csk_ctl_sock_create(struct socket **sock, unsigned short family,
unsigned short type, unsigned char protocol)
{
int rc = sock_create_kern(family, type, protocol, sock);
if (rc == 0) {
(*sock)->sk->sk_allocation = GFP_ATOMIC;
inet_sk((*sock)->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.
*/
(*sock)->sk->sk_prot->unhash((*sock)->sk);
}
return rc;
}
EXPORT_SYMBOL_GPL(inet_csk_ctl_sock_create);
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
......
...@@ -2491,7 +2491,7 @@ struct proto tcp_prot = { ...@@ -2491,7 +2491,7 @@ struct proto tcp_prot = {
void __init tcp_v4_init(void) void __init tcp_v4_init(void)
{ {
struct socket *__tcp_socket; struct socket *__tcp_socket;
if (inet_csk_ctl_sock_create(&__tcp_socket, PF_INET, SOCK_RAW, if (inet_ctl_sock_create(&__tcp_socket, PF_INET, SOCK_RAW,
IPPROTO_TCP) < 0) IPPROTO_TCP) < 0)
panic("Failed to create the TCP control socket.\n"); panic("Failed to create the TCP control socket.\n");
tcp_sock = __tcp_socket->sk; tcp_sock = __tcp_socket->sk;
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <net/dsfield.h> #include <net/dsfield.h>
#include <net/timewait_sock.h> #include <net/timewait_sock.h>
#include <net/netdma.h> #include <net/netdma.h>
#include <net/inet_common.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -2202,7 +2203,7 @@ static int tcpv6_net_init(struct net *net) ...@@ -2202,7 +2203,7 @@ static int tcpv6_net_init(struct net *net)
struct socket *sock; struct socket *sock;
struct sock *sk; struct sock *sk;
err = inet_csk_ctl_sock_create(&sock, PF_INET6, SOCK_RAW, IPPROTO_TCP); err = inet_ctl_sock_create(&sock, PF_INET6, SOCK_RAW, IPPROTO_TCP);
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment