aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-03-10 10:15:54 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-10 13:45:28 -0400
commit34160ea3f9c96b5ae71a11459f9b9f6c298b8930 (patch)
treea2b18975c94f3a924a24a09301bfac37f34d888f /net/ipv4
parente31c5e0e486226e0808a2e90a7af40daa084ed09 (diff)
inet_diag: add const to inet_diag_req_v2
diag dumpers should not modify the request. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/inet_diag.c22
-rw-r--r--net/ipv4/tcp_diag.c4
-rw-r--r--net/ipv4/udp_diag.c22
3 files changed, 26 insertions, 22 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index cd261f6e3abb..ac3bfb458afd 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -71,7 +71,7 @@ static void inet_diag_unlock_handler(const struct inet_diag_handler *handler)
71} 71}
72 72
73int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, 73int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
74 struct sk_buff *skb, struct inet_diag_req_v2 *req, 74 struct sk_buff *skb, const struct inet_diag_req_v2 *req,
75 struct user_namespace *user_ns, 75 struct user_namespace *user_ns,
76 u32 portid, u32 seq, u16 nlmsg_flags, 76 u32 portid, u32 seq, u16 nlmsg_flags,
77 const struct nlmsghdr *unlh) 77 const struct nlmsghdr *unlh)
@@ -212,7 +212,7 @@ EXPORT_SYMBOL_GPL(inet_sk_diag_fill);
212 212
213static int inet_csk_diag_fill(struct sock *sk, 213static int inet_csk_diag_fill(struct sock *sk,
214 struct sk_buff *skb, 214 struct sk_buff *skb,
215 struct inet_diag_req_v2 *req, 215 const struct inet_diag_req_v2 *req,
216 struct user_namespace *user_ns, 216 struct user_namespace *user_ns,
217 u32 portid, u32 seq, u16 nlmsg_flags, 217 u32 portid, u32 seq, u16 nlmsg_flags,
218 const struct nlmsghdr *unlh) 218 const struct nlmsghdr *unlh)
@@ -223,7 +223,7 @@ static int inet_csk_diag_fill(struct sock *sk,
223 223
224static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, 224static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
225 struct sk_buff *skb, 225 struct sk_buff *skb,
226 struct inet_diag_req_v2 *req, 226 const struct inet_diag_req_v2 *req,
227 u32 portid, u32 seq, u16 nlmsg_flags, 227 u32 portid, u32 seq, u16 nlmsg_flags,
228 const struct nlmsghdr *unlh) 228 const struct nlmsghdr *unlh)
229{ 229{
@@ -277,7 +277,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
277} 277}
278 278
279static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, 279static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
280 struct inet_diag_req_v2 *r, 280 const struct inet_diag_req_v2 *r,
281 struct user_namespace *user_ns, 281 struct user_namespace *user_ns,
282 u32 portid, u32 seq, u16 nlmsg_flags, 282 u32 portid, u32 seq, u16 nlmsg_flags,
283 const struct nlmsghdr *unlh) 283 const struct nlmsghdr *unlh)
@@ -293,7 +293,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
293int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, 293int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
294 struct sk_buff *in_skb, 294 struct sk_buff *in_skb,
295 const struct nlmsghdr *nlh, 295 const struct nlmsghdr *nlh,
296 struct inet_diag_req_v2 *req) 296 const struct inet_diag_req_v2 *req)
297{ 297{
298 struct net *net = sock_net(in_skb->sk); 298 struct net *net = sock_net(in_skb->sk);
299 struct sk_buff *rep; 299 struct sk_buff *rep;
@@ -358,7 +358,7 @@ EXPORT_SYMBOL_GPL(inet_diag_dump_one_icsk);
358 358
359static int inet_diag_get_exact(struct sk_buff *in_skb, 359static int inet_diag_get_exact(struct sk_buff *in_skb,
360 const struct nlmsghdr *nlh, 360 const struct nlmsghdr *nlh,
361 struct inet_diag_req_v2 *req) 361 const struct inet_diag_req_v2 *req)
362{ 362{
363 const struct inet_diag_handler *handler; 363 const struct inet_diag_handler *handler;
364 int err; 364 int err;
@@ -626,7 +626,7 @@ static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
626static int inet_csk_diag_dump(struct sock *sk, 626static int inet_csk_diag_dump(struct sock *sk,
627 struct sk_buff *skb, 627 struct sk_buff *skb,
628 struct netlink_callback *cb, 628 struct netlink_callback *cb,
629 struct inet_diag_req_v2 *r, 629 const struct inet_diag_req_v2 *r,
630 const struct nlattr *bc) 630 const struct nlattr *bc)
631{ 631{
632 if (!inet_diag_bc_sk(bc, sk)) 632 if (!inet_diag_bc_sk(bc, sk))
@@ -667,7 +667,7 @@ static void twsk_build_assert(void)
667static int inet_twsk_diag_dump(struct sock *sk, 667static int inet_twsk_diag_dump(struct sock *sk,
668 struct sk_buff *skb, 668 struct sk_buff *skb,
669 struct netlink_callback *cb, 669 struct netlink_callback *cb,
670 struct inet_diag_req_v2 *r, 670 const struct inet_diag_req_v2 *r,
671 const struct nlattr *bc) 671 const struct nlattr *bc)
672{ 672{
673 twsk_build_assert(); 673 twsk_build_assert();
@@ -770,7 +770,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
770 770
771static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, 771static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
772 struct netlink_callback *cb, 772 struct netlink_callback *cb,
773 struct inet_diag_req_v2 *r, 773 const struct inet_diag_req_v2 *r,
774 const struct nlattr *bc) 774 const struct nlattr *bc)
775{ 775{
776 struct inet_connection_sock *icsk = inet_csk(sk); 776 struct inet_connection_sock *icsk = inet_csk(sk);
@@ -842,7 +842,7 @@ out:
842 842
843void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb, 843void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb,
844 struct netlink_callback *cb, 844 struct netlink_callback *cb,
845 struct inet_diag_req_v2 *r, struct nlattr *bc) 845 const struct inet_diag_req_v2 *r, struct nlattr *bc)
846{ 846{
847 struct net *net = sock_net(skb->sk); 847 struct net *net = sock_net(skb->sk);
848 int i, num, s_i, s_num; 848 int i, num, s_i, s_num;
@@ -978,7 +978,7 @@ out:
978EXPORT_SYMBOL_GPL(inet_diag_dump_icsk); 978EXPORT_SYMBOL_GPL(inet_diag_dump_icsk);
979 979
980static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 980static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
981 struct inet_diag_req_v2 *r, 981 const struct inet_diag_req_v2 *r,
982 struct nlattr *bc) 982 struct nlattr *bc)
983{ 983{
984 const struct inet_diag_handler *handler; 984 const struct inet_diag_handler *handler;
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 0d73f9ddb55b..86dc119a3815 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -34,13 +34,13 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
34} 34}
35 35
36static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 36static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
37 struct inet_diag_req_v2 *r, struct nlattr *bc) 37 const struct inet_diag_req_v2 *r, struct nlattr *bc)
38{ 38{
39 inet_diag_dump_icsk(&tcp_hashinfo, skb, cb, r, bc); 39 inet_diag_dump_icsk(&tcp_hashinfo, skb, cb, r, bc);
40} 40}
41 41
42static int tcp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, 42static int tcp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
43 struct inet_diag_req_v2 *req) 43 const struct inet_diag_req_v2 *req)
44{ 44{
45 return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req); 45 return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req);
46} 46}
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 4a000f1dd757..2dbfc1f1f7b3 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -18,8 +18,9 @@
18#include <linux/sock_diag.h> 18#include <linux/sock_diag.h>
19 19
20static int sk_diag_dump(struct sock *sk, struct sk_buff *skb, 20static int sk_diag_dump(struct sock *sk, struct sk_buff *skb,
21 struct netlink_callback *cb, struct inet_diag_req_v2 *req, 21 struct netlink_callback *cb,
22 struct nlattr *bc) 22 const struct inet_diag_req_v2 *req,
23 struct nlattr *bc)
23{ 24{
24 if (!inet_diag_bc_sk(bc, sk)) 25 if (!inet_diag_bc_sk(bc, sk))
25 return 0; 26 return 0;
@@ -31,7 +32,8 @@ static int sk_diag_dump(struct sock *sk, struct sk_buff *skb,
31} 32}
32 33
33static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb, 34static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb,
34 const struct nlmsghdr *nlh, struct inet_diag_req_v2 *req) 35 const struct nlmsghdr *nlh,
36 const struct inet_diag_req_v2 *req)
35{ 37{
36 int err = -EINVAL; 38 int err = -EINVAL;
37 struct sock *sk; 39 struct sock *sk;
@@ -90,8 +92,9 @@ out_nosk:
90 return err; 92 return err;
91} 93}
92 94
93static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlink_callback *cb, 95static void udp_dump(struct udp_table *table, struct sk_buff *skb,
94 struct inet_diag_req_v2 *r, struct nlattr *bc) 96 struct netlink_callback *cb,
97 const struct inet_diag_req_v2 *r, struct nlattr *bc)
95{ 98{
96 int num, s_num, slot, s_slot; 99 int num, s_num, slot, s_slot;
97 struct net *net = sock_net(skb->sk); 100 struct net *net = sock_net(skb->sk);
@@ -144,13 +147,13 @@ done:
144} 147}
145 148
146static void udp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 149static void udp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
147 struct inet_diag_req_v2 *r, struct nlattr *bc) 150 const struct inet_diag_req_v2 *r, struct nlattr *bc)
148{ 151{
149 udp_dump(&udp_table, skb, cb, r, bc); 152 udp_dump(&udp_table, skb, cb, r, bc);
150} 153}
151 154
152static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, 155static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
153 struct inet_diag_req_v2 *req) 156 const struct inet_diag_req_v2 *req)
154{ 157{
155 return udp_dump_one(&udp_table, in_skb, nlh, req); 158 return udp_dump_one(&udp_table, in_skb, nlh, req);
156} 159}
@@ -170,13 +173,14 @@ static const struct inet_diag_handler udp_diag_handler = {
170}; 173};
171 174
172static void udplite_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 175static void udplite_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
173 struct inet_diag_req_v2 *r, struct nlattr *bc) 176 const struct inet_diag_req_v2 *r,
177 struct nlattr *bc)
174{ 178{
175 udp_dump(&udplite_table, skb, cb, r, bc); 179 udp_dump(&udplite_table, skb, cb, r, bc);
176} 180}
177 181
178static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, 182static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
179 struct inet_diag_req_v2 *req) 183 const struct inet_diag_req_v2 *req)
180{ 184{
181 return udp_dump_one(&udplite_table, in_skb, nlh, req); 185 return udp_dump_one(&udplite_table, in_skb, nlh, req);
182} 186}