aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/icmp.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-04-03 17:29:00 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-03 17:29:00 -0400
commitc1e9894d486dc249331f4f04859c26147a778154 (patch)
tree5e376745609144b381f9c2088b4395f709a8855d /net/ipv4/icmp.c
parent5677242f432102dea9e6eceec1dc089e2f709ca4 (diff)
[ICMP]: Simplify ICMP control socket creation.
Replace sock_create_kern with inet_ctl_sock_create. 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>
Diffstat (limited to 'net/ipv4/icmp.c')
-rw-r--r--net/ipv4/icmp.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 803bc9f173a7..efc7cbe759c9 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -93,6 +93,7 @@
93#include <asm/uaccess.h> 93#include <asm/uaccess.h>
94#include <net/checksum.h> 94#include <net/checksum.h>
95#include <net/xfrm.h> 95#include <net/xfrm.h>
96#include <net/inet_common.h>
96 97
97/* 98/*
98 * Build xmit assembly blocks 99 * Build xmit assembly blocks
@@ -1136,7 +1137,7 @@ static void __net_exit icmp_sk_exit(struct net *net)
1136 int i; 1137 int i;
1137 1138
1138 for_each_possible_cpu(i) 1139 for_each_possible_cpu(i)
1139 sk_release_kernel(net->ipv4.icmp_sk[i]); 1140 inet_ctl_sock_destroy(net->ipv4.icmp_sk[i]);
1140 kfree(net->ipv4.icmp_sk); 1141 kfree(net->ipv4.icmp_sk);
1141 net->ipv4.icmp_sk = NULL; 1142 net->ipv4.icmp_sk = NULL;
1142} 1143}
@@ -1152,17 +1153,13 @@ int __net_init icmp_sk_init(struct net *net)
1152 1153
1153 for_each_possible_cpu(i) { 1154 for_each_possible_cpu(i) {
1154 struct sock *sk; 1155 struct sock *sk;
1155 struct socket *sock;
1156 struct inet_sock *inet;
1157 1156
1158 err = sock_create_kern(PF_INET, SOCK_RAW, IPPROTO_ICMP, &sock); 1157 err = inet_ctl_sock_create(&sk, PF_INET,
1158 SOCK_RAW, IPPROTO_ICMP, net);
1159 if (err < 0) 1159 if (err < 0)
1160 goto fail; 1160 goto fail;
1161 1161
1162 net->ipv4.icmp_sk[i] = sk = sock->sk; 1162 net->ipv4.icmp_sk[i] = sk;
1163 sk_change_net(sk, net);
1164
1165 sk->sk_allocation = GFP_ATOMIC;
1166 1163
1167 /* Enough space for 2 64K ICMP packets, including 1164 /* Enough space for 2 64K ICMP packets, including
1168 * sk_buff struct overhead. 1165 * sk_buff struct overhead.
@@ -1170,15 +1167,7 @@ int __net_init icmp_sk_init(struct net *net)
1170 sk->sk_sndbuf = 1167 sk->sk_sndbuf =
1171 (2 * ((64 * 1024) + sizeof(struct sk_buff))); 1168 (2 * ((64 * 1024) + sizeof(struct sk_buff)));
1172 1169
1173 inet = inet_sk(sk); 1170 inet_sk(sk)->pmtudisc = IP_PMTUDISC_DONT;
1174 inet->uc_ttl = -1;
1175 inet->pmtudisc = IP_PMTUDISC_DONT;
1176
1177 /* Unhash it so that IP input processing does not even
1178 * see it, we do not wish this socket to see incoming
1179 * packets.
1180 */
1181 sk->sk_prot->unhash(sk);
1182 } 1171 }
1183 1172
1184 /* Control parameters for ECHO replies. */ 1173 /* Control parameters for ECHO replies. */
@@ -1208,7 +1197,7 @@ int __net_init icmp_sk_init(struct net *net)
1208 1197
1209fail: 1198fail:
1210 for_each_possible_cpu(i) 1199 for_each_possible_cpu(i)
1211 sk_release_kernel(net->ipv4.icmp_sk[i]); 1200 inet_ctl_sock_destroy(net->ipv4.icmp_sk[i]);
1212 kfree(net->ipv4.icmp_sk); 1201 kfree(net->ipv4.icmp_sk);
1213 return err; 1202 return err;
1214} 1203}