Commit 0388b004 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

icmp: add struct net argument to icmp_out_count

This routine deals with ICMP statistics, but doesn't have a
struct net at hands, so add one.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 61362766
...@@ -44,12 +44,13 @@ DECLARE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics); ...@@ -44,12 +44,13 @@ DECLARE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics);
struct dst_entry; struct dst_entry;
struct net_proto_family; struct net_proto_family;
struct sk_buff; struct sk_buff;
struct net;
extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 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_rcv(struct sk_buff *skb);
extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
extern int icmp_init(void); 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 ? */ /* Move into dst.h ? */
extern int xrlim_allow(struct dst_entry *dst, int timeout); extern int xrlim_allow(struct dst_entry *dst, int timeout);
......
...@@ -296,7 +296,7 @@ static inline int icmpv4_xrlim_allow(struct net *net, struct rtable *rt, ...@@ -296,7 +296,7 @@ static inline int icmpv4_xrlim_allow(struct net *net, struct rtable *rt,
/* /*
* Maintain the counters used in the SNMP statistics for outgoing ICMP * 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); ICMPMSGOUT_INC_STATS(type);
ICMP_INC_STATS(ICMP_MIB_OUTMSGS); ICMP_INC_STATS(ICMP_MIB_OUTMSGS);
......
...@@ -1211,6 +1211,7 @@ int ip_push_pending_frames(struct sock *sk) ...@@ -1211,6 +1211,7 @@ int ip_push_pending_frames(struct sock *sk)
struct sk_buff *skb, *tmp_skb; struct sk_buff *skb, *tmp_skb;
struct sk_buff **tail_skb; struct sk_buff **tail_skb;
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
struct net *net = sock_net(sk);
struct ip_options *opt = NULL; struct ip_options *opt = NULL;
struct rtable *rt = (struct rtable *)inet->cork.dst; struct rtable *rt = (struct rtable *)inet->cork.dst;
struct iphdr *iph; struct iphdr *iph;
...@@ -1280,7 +1281,7 @@ int ip_push_pending_frames(struct sock *sk) ...@@ -1280,7 +1281,7 @@ int ip_push_pending_frames(struct sock *sk)
skb->dst = dst_clone(&rt->u.dst); skb->dst = dst_clone(&rt->u.dst);
if (iph->protocol == IPPROTO_ICMP) if (iph->protocol == IPPROTO_ICMP)
icmp_out_count(((struct icmphdr *) icmp_out_count(net, ((struct icmphdr *)
skb_transport_header(skb))->type); skb_transport_header(skb))->type);
/* Netfilter gets whole the not fragmented skb. */ /* Netfilter gets whole the not fragmented skb. */
......
...@@ -320,6 +320,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, ...@@ -320,6 +320,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
unsigned int flags) unsigned int flags)
{ {
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
struct net *net = sock_net(sk);
struct iphdr *iph; struct iphdr *iph;
struct sk_buff *skb; struct sk_buff *skb;
unsigned int iphlen; unsigned int iphlen;
...@@ -368,7 +369,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, ...@@ -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); iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
} }
if (iph->protocol == IPPROTO_ICMP) if (iph->protocol == IPPROTO_ICMP)
icmp_out_count(((struct icmphdr *) icmp_out_count(net, ((struct icmphdr *)
skb_transport_header(skb))->type); skb_transport_header(skb))->type);
err = NF_HOOK(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, err = NF_HOOK(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment