diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-03-20 22:01:03 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 22:01:03 -0800 |
commit | c4d9390941aee136fd35bb38eb1d6de4e3b1487d (patch) | |
tree | fcaf0032ba5971145b5f527b8635cd7aa3a39d8c /net/ipv4/inet_connection_sock.c | |
parent | 72478873571d869906f7a250b09e12fa5b65e321 (diff) | |
download | linux-c4d9390941aee136fd35bb38eb1d6de4e3b1487d.tar.gz linux-c4d9390941aee136fd35bb38eb1d6de4e3b1487d.tar.bz2 linux-c4d9390941aee136fd35bb38eb1d6de4e3b1487d.zip |
[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/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index ae20281d8deb..359f48cec99a 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -648,3 +648,22 @@ void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr) } 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); |