From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH net-next 1/7] ICMP: add struct net argument to icmp_out_count
Date: Mon, 07 Jul 2008 14:44:06 +0400 [thread overview]
Message-ID: <4871F376.3060609@openvz.org> (raw)
In-Reply-To: <4871F2D8.8030502@openvz.org>
This routine deals with ICMP statistics, but doesn't have a
struct net at hands, so add one.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
include/net/icmp.h | 3 ++-
net/ipv4/icmp.c | 2 +-
net/ipv4/ip_output.c | 3 ++-
net/ipv4/raw.c | 3 ++-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/net/icmp.h b/include/net/icmp.h
index dddb839..38ca2f3 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -44,12 +44,13 @@ DECLARE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics);
struct dst_entry;
struct net_proto_family;
struct sk_buff;
+struct net;
extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
extern int icmp_rcv(struct sk_buff *skb);
extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
extern int icmp_init(void);
-extern void icmp_out_count(unsigned char type);
+extern void icmp_out_count(struct net *net, unsigned char type);
/* Move into dst.h ? */
extern int xrlim_allow(struct dst_entry *dst, int timeout);
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index aa7cf46..1ffe7ad 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -296,7 +296,7 @@ out:
/*
* Maintain the counters used in the SNMP statistics for outgoing ICMP
*/
-void icmp_out_count(unsigned char type)
+void icmp_out_count(struct net *net, unsigned char type)
{
ICMPMSGOUT_INC_STATS(type);
ICMP_INC_STATS(ICMP_MIB_OUTMSGS);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index f1278ee..f003186 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1211,6 +1211,7 @@ int ip_push_pending_frames(struct sock *sk)
struct sk_buff *skb, *tmp_skb;
struct sk_buff **tail_skb;
struct inet_sock *inet = inet_sk(sk);
+ struct net *net = sock_net(sk);
struct ip_options *opt = NULL;
struct rtable *rt = (struct rtable *)inet->cork.dst;
struct iphdr *iph;
@@ -1280,7 +1281,7 @@ int ip_push_pending_frames(struct sock *sk)
skb->dst = dst_clone(&rt->u.dst);
if (iph->protocol == IPPROTO_ICMP)
- icmp_out_count(((struct icmphdr *)
+ icmp_out_count(net, ((struct icmphdr *)
skb_transport_header(skb))->type);
/* Netfilter gets whole the not fragmented skb. */
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 925fdf1..7f39ea4 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -320,6 +320,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
unsigned int flags)
{
struct inet_sock *inet = inet_sk(sk);
+ struct net *net = sock_net(sk);
struct iphdr *iph;
struct sk_buff *skb;
unsigned int iphlen;
@@ -368,7 +369,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
}
if (iph->protocol == IPPROTO_ICMP)
- icmp_out_count(((struct icmphdr *)
+ icmp_out_count(net, ((struct icmphdr *)
skb_transport_header(skb))->type);
err = NF_HOOK(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
--
1.5.3.4
next prev parent reply other threads:[~2008-07-07 10:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-07 10:41 [PATCH net-next 0/7] MIB: add struct net to ICMP accounting macros Pavel Emelyanov
2008-07-07 10:44 ` Pavel Emelyanov [this message]
2008-07-15 6:01 ` [PATCH net-next 1/7] ICMP: add struct net argument to icmp_out_count David Miller
2008-07-07 10:47 ` [PATCH net-next 2/7] INET: toss struct net initialization around Pavel Emelyanov
2008-07-15 6:01 ` David Miller
2008-07-07 10:50 ` [PATCH net-next 3/7] ICMP: drop unused MIB accounting wrappers Pavel Emelyanov
2008-07-15 6:02 ` David Miller
2008-07-07 10:51 ` [PATCH net-next 4/7] MIB: add struct net to ICMP_INC_STATS Pavel Emelyanov
2008-07-15 6:02 ` David Miller
2008-07-07 10:52 ` [PATCH net-next 5/7] MIB: add struct net to ICMP_INC_STATS_BH Pavel Emelyanov
2008-07-15 6:03 ` David Miller
2008-07-07 10:53 ` [PATCH net-next 6/7] MIB: add struct net to ICMPMSGOUT_INC_STATS Pavel Emelyanov
2008-07-15 6:03 ` David Miller
2008-07-07 10:53 ` [PATCH net-next 7/7] MIB: add struct net to ICMPMSGIN_INC_STATS_BH Pavel Emelyanov
2008-07-15 6:04 ` David Miller
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=4871F376.3060609@openvz.org \
--to=xemul@openvz.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).