summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaishuang Yan <yanhaishuang@cmss.chinamobile.com>2016-03-23 05:59:51 -0400
committerDavid S. Miller <davem@davemloft.net>2016-03-23 22:09:58 -0400
commit6579a023a881e0592ce9a98fdfcbcc0a2a096aa7 (patch)
treec2295896c35ebef4d8cc13db5ba63005bbd3d5b2
parent3f735131d9c2523eb54a6c5099fa8c60a4292d48 (diff)
net: ping: make ping_v6_sendmsg static
As ping_v6_sendmsg is used only in this file, making it static The body of "pingv6_prot" and "pingv6_protosw" were moved at the middle of the file, to avoid having to declare some static prototypes. Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ping.h1
-rw-r--r--net/ipv6/ping.c59
2 files changed, 29 insertions, 31 deletions
diff --git a/include/net/ping.h b/include/net/ping.h
index 5fd7cc244833..4cd90d6b5c25 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -79,7 +79,6 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
79 int flags, int *addr_len); 79 int flags, int *addr_len);
80int ping_common_sendmsg(int family, struct msghdr *msg, size_t len, 80int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
81 void *user_icmph, size_t icmph_len); 81 void *user_icmph, size_t icmph_len);
82int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len);
83int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 82int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
84bool ping_rcv(struct sk_buff *skb); 83bool ping_rcv(struct sk_buff *skb);
85 84
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 263a5164a6f5..c382db7a2e73 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -26,35 +26,6 @@
26#include <net/transp_v6.h> 26#include <net/transp_v6.h>
27#include <net/ping.h> 27#include <net/ping.h>
28 28
29struct proto pingv6_prot = {
30 .name = "PINGv6",
31 .owner = THIS_MODULE,
32 .init = ping_init_sock,
33 .close = ping_close,
34 .connect = ip6_datagram_connect_v6_only,
35 .disconnect = udp_disconnect,
36 .setsockopt = ipv6_setsockopt,
37 .getsockopt = ipv6_getsockopt,
38 .sendmsg = ping_v6_sendmsg,
39 .recvmsg = ping_recvmsg,
40 .bind = ping_bind,
41 .backlog_rcv = ping_queue_rcv_skb,
42 .hash = ping_hash,
43 .unhash = ping_unhash,
44 .get_port = ping_get_port,
45 .obj_size = sizeof(struct raw6_sock),
46};
47EXPORT_SYMBOL_GPL(pingv6_prot);
48
49static struct inet_protosw pingv6_protosw = {
50 .type = SOCK_DGRAM,
51 .protocol = IPPROTO_ICMPV6,
52 .prot = &pingv6_prot,
53 .ops = &inet6_dgram_ops,
54 .flags = INET_PROTOSW_REUSE,
55};
56
57
58/* Compatibility glue so we can support IPv6 when it's compiled as a module */ 29/* Compatibility glue so we can support IPv6 when it's compiled as a module */
59static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, 30static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len,
60 int *addr_len) 31 int *addr_len)
@@ -77,7 +48,7 @@ static int dummy_ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
77 return 0; 48 return 0;
78} 49}
79 50
80int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 51static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
81{ 52{
82 struct inet_sock *inet = inet_sk(sk); 53 struct inet_sock *inet = inet_sk(sk);
83 struct ipv6_pinfo *np = inet6_sk(sk); 54 struct ipv6_pinfo *np = inet6_sk(sk);
@@ -192,6 +163,34 @@ int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
192 return len; 163 return len;
193} 164}
194 165
166struct proto pingv6_prot = {
167 .name = "PINGv6",
168 .owner = THIS_MODULE,
169 .init = ping_init_sock,
170 .close = ping_close,
171 .connect = ip6_datagram_connect_v6_only,
172 .disconnect = udp_disconnect,
173 .setsockopt = ipv6_setsockopt,
174 .getsockopt = ipv6_getsockopt,
175 .sendmsg = ping_v6_sendmsg,
176 .recvmsg = ping_recvmsg,
177 .bind = ping_bind,
178 .backlog_rcv = ping_queue_rcv_skb,
179 .hash = ping_hash,
180 .unhash = ping_unhash,
181 .get_port = ping_get_port,
182 .obj_size = sizeof(struct raw6_sock),
183};
184EXPORT_SYMBOL_GPL(pingv6_prot);
185
186static struct inet_protosw pingv6_protosw = {
187 .type = SOCK_DGRAM,
188 .protocol = IPPROTO_ICMPV6,
189 .prot = &pingv6_prot,
190 .ops = &inet6_dgram_ops,
191 .flags = INET_PROTOSW_REUSE,
192};
193
195#ifdef CONFIG_PROC_FS 194#ifdef CONFIG_PROC_FS
196static void *ping_v6_seq_start(struct seq_file *seq, loff_t *pos) 195static void *ping_v6_seq_start(struct seq_file *seq, loff_t *pos)
197{ 196{