netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, containers@lists.osdl.org,
	"Denis V. Lunev" <den@openvz.org>
Subject: [PATCH 7/11 net-2.6.26] [ICMP]: Simplify ICMP control socket creation.
Date: Fri, 28 Mar 2008 12:08:54 +0300	[thread overview]
Message-ID: <1206695338-5947-7-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1206695071.3271.8.camel@iris.sw.ru>

Replace sock_create_kern with inet_csk_ctl_sock_create.

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 net/ipv4/icmp.c |   23 +++++------------------
 1 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 803bc9f..b00bc20 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -1152,33 +1152,20 @@ int __net_init icmp_sk_init(struct net *net)
 
 	for_each_possible_cpu(i) {
 		struct sock *sk;
-		struct socket *sock;
-		struct inet_sock *inet;
 
-		err = sock_create_kern(PF_INET, SOCK_RAW, IPPROTO_ICMP, &sock);
+		err = inet_csk_ctl_sock_create(&sk,
+					       PF_INET, SOCK_RAW, IPPROTO_ICMP);
 		if (err < 0)
 			goto fail;
 
-		net->ipv4.icmp_sk[i] = sk = sock->sk;
+		net->ipv4.icmp_sk[i] = sk;
 		sk_change_net(sk, net);
 
-		sk->sk_allocation = GFP_ATOMIC;
-
 		/* Enough space for 2 64K ICMP packets, including
 		 * sk_buff struct overhead.
 		 */
-		sk->sk_sndbuf =
-			(2 * ((64 * 1024) + sizeof(struct sk_buff)));
-
-		inet = inet_sk(sk);
-		inet->uc_ttl = -1;
-		inet->pmtudisc = IP_PMTUDISC_DONT;
-
-		/* Unhash it so that IP input processing does not even
-		 * see it, we do not wish this socket to see incoming
-		 * packets.
-		 */
-		sk->sk_prot->unhash(sk);
+		sk->sk_sndbuf = (2 * ((64 * 1024) + sizeof(struct sk_buff)));
+		inet_sk(sk)->pmtudisc = IP_PMTUDISC_DONT;
 	}
 
 	/* Control parameters for ECHO replies. */
-- 
1.5.3.rc5


  parent reply	other threads:[~2008-03-28  9:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-28  9:04 [PATCH 0/11 net-2.6.16] unify control socket usage for protocols Denis V. Lunev
2008-03-28  9:08 ` [PATCH 1/11 net-2.6.26] [TCP]: Replace socket with sock for reset sending Denis V. Lunev
2008-03-28  9:08 ` [PATCH 2/11 net-2.6.26] [DCCP]: " Denis V. Lunev
     [not found]   ` <1206695338-5947-2-git-send-email-den-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2008-03-28 14:39     ` Arnaldo Carvalho de Melo
2008-03-28 15:08       ` Denis V. Lunev
2008-03-28  9:08 ` [PATCH 3/11 net-2.6.26] [DCCP]: dccp_v(4|6)_ctl_socket is leaked Denis V. Lunev
     [not found]   ` <1206695338-5947-3-git-send-email-den-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2008-03-28 14:44     ` Arnaldo Carvalho de Melo
2008-03-28 15:22       ` Denis V. Lunev
2008-03-28 16:47         ` Arnaldo Carvalho de Melo
     [not found]           ` <20080328164752.GX14945-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2008-03-28 17:09             ` Denis V. Lunev
2008-03-28 23:34               ` David Miller
2008-03-28  9:08 ` [PATCH 4/11 net-2.6.26] [SCTP]: Use inet_csk_ctl_sock_create for control socket creation Denis V. Lunev
2008-03-28  9:08 ` [PATCH 5/11 net-2.6.26] [SCTP]: Replace socket with sock for sctp_ctl_sock Denis V. Lunev
2008-03-28  9:08 ` [PATCH 6/11 net-2.6.26] [INET]: Let inet_csk_ctl_sock_create return sock rather than socket Denis V. Lunev
2008-03-28  9:08 ` Denis V. Lunev [this message]
     [not found]   ` <1206695338-5947-7-git-send-email-den-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2008-03-28 14:47     ` [PATCH 7/11 net-2.6.26] [ICMP]: Simplify ICMP control socket creation Arnaldo Carvalho de Melo
2008-03-28  9:08 ` [PATCH 8/11 net-2.6.26] [INET]: uc_ttl assignment in inet_csk_ctl_sock_create is extra Denis V. Lunev
2008-03-28  9:08 ` [PATCH 9/11 net-2.6.26] [IPV6]: Simplify IPv6 control socket creation Denis V. Lunev
2008-03-28  9:08 ` [PATCH 10/11] [NETNS]: Create tcp control socket in the each namespace Denis V. Lunev
2008-03-28  9:08 ` [PATCH 11/11 net-2.6.26] [NETNS]: Use TCP control socket from a correct namespace Denis V. Lunev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1206695338-5947-7-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=containers@lists.osdl.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).