Commit 3626b045 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/net-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 10fb0484 71d50c2b
...@@ -150,7 +150,7 @@ struct ipv4_config ...@@ -150,7 +150,7 @@ struct ipv4_config
}; };
extern struct ipv4_config ipv4_config; extern struct ipv4_config ipv4_config;
DECLARE_SNMP_STAT(struct ip_mib, ip_statistics); DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics);
#define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field) #define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field)
#define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field) #define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field)
#define IP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ip_statistics, field) #define IP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ip_statistics, field)
......
...@@ -57,6 +57,8 @@ struct rt6_info ...@@ -57,6 +57,8 @@ struct rt6_info
struct rt6_info *next; struct rt6_info *next;
} u; } u;
struct inet6_dev *rt6i_idev;
#define rt6i_dev u.dst.dev #define rt6i_dev u.dst.dev
#define rt6i_nexthop u.dst.neighbour #define rt6i_nexthop u.dst.neighbour
#define rt6i_expires u.dst.expires #define rt6i_expires u.dst.expires
......
...@@ -111,7 +111,7 @@ extern int sysctl_ipv6_bindv6only; ...@@ -111,7 +111,7 @@ extern int sysctl_ipv6_bindv6only;
extern int sysctl_mld_max_msf; extern int sysctl_mld_max_msf;
/* MIBs */ /* MIBs */
DECLARE_SNMP_STAT(struct ipv6_mib, ipv6_statistics); DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
#define IP6_INC_STATS(field) SNMP_INC_STATS(ipv6_statistics, field) #define IP6_INC_STATS(field) SNMP_INC_STATS(ipv6_statistics, field)
#define IP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(ipv6_statistics, field) #define IP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(ipv6_statistics, field)
#define IP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(ipv6_statistics, field) #define IP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(ipv6_statistics, field)
......
...@@ -55,6 +55,8 @@ struct rtable ...@@ -55,6 +55,8 @@ struct rtable
struct rtable *rt_next; struct rtable *rt_next;
} u; } u;
struct in_device *idev;
unsigned rt_flags; unsigned rt_flags;
unsigned rt_type; unsigned rt_type;
......
...@@ -41,61 +41,52 @@ ...@@ -41,61 +41,52 @@
* cacheline machine it makes a *lot* of sense -AK * cacheline machine it makes a *lot* of sense -AK
*/ */
struct snmp_item {
char *name;
int offset;
};
#define SNMP_ITEM(mib,entry,procname) { \
.name = procname, \
.offset = offsetof(mib, entry), \
}
#define SNMP_ITEM_SENTINEL { \
.name = NULL, \
.offset = 0, \
}
/* /*
* RFC 1213: MIB-II * RFC 1213: MIB-II
* RFC 2011 (updates 1213): SNMPv2-MIB-IP * RFC 2011 (updates 1213): SNMPv2-MIB-IP
* RFC 2863: Interfaces Group MIB * RFC 2863: Interfaces Group MIB
*/
struct ip_mib
{
unsigned long IpInReceives;
unsigned long IpInHdrErrors;
unsigned long IpInAddrErrors;
unsigned long IpForwDatagrams;
unsigned long IpInUnknownProtos;
unsigned long IpInDiscards;
unsigned long IpInDelivers;
unsigned long IpOutRequests;
unsigned long IpOutDiscards;
unsigned long IpOutNoRoutes;
unsigned long IpReasmTimeout;
unsigned long IpReasmReqds;
unsigned long IpReasmOKs;
unsigned long IpReasmFails;
unsigned long IpFragOKs;
unsigned long IpFragFails;
unsigned long IpFragCreates;
unsigned long __pad[0];
};
/*
* RFC 2465: IPv6 MIB: General Group * RFC 2465: IPv6 MIB: General Group
* draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables
*/ */
struct ipv6_mib struct ipstats_mib
{ {
unsigned long Ip6InReceives; unsigned long InReceives;
unsigned long Ip6InHdrErrors; unsigned long InHdrErrors;
unsigned long Ip6InTooBigErrors; unsigned long InTooBigErrors;
unsigned long Ip6InNoRoutes; unsigned long InNoRoutes;
unsigned long Ip6InAddrErrors; unsigned long InAddrErrors;
unsigned long Ip6InUnknownProtos; unsigned long InUnknownProtos;
unsigned long Ip6InTruncatedPkts; unsigned long InTruncatedPkts;
unsigned long Ip6InDiscards; unsigned long InDiscards;
unsigned long Ip6InDelivers; unsigned long InDelivers;
unsigned long Ip6OutForwDatagrams; unsigned long OutForwDatagrams;
unsigned long Ip6OutRequests; unsigned long OutRequests;
unsigned long Ip6OutDiscards; unsigned long OutDiscards;
unsigned long Ip6OutNoRoutes; unsigned long OutNoRoutes;
unsigned long Ip6ReasmTimeout; unsigned long ReasmTimeout;
unsigned long Ip6ReasmReqds; unsigned long ReasmReqds;
unsigned long Ip6ReasmOKs; unsigned long ReasmOKs;
unsigned long Ip6ReasmFails; unsigned long ReasmFails;
unsigned long Ip6FragOKs; unsigned long FragOKs;
unsigned long Ip6FragFails; unsigned long FragFails;
unsigned long Ip6FragCreates; unsigned long FragCreates;
unsigned long Ip6InMcastPkts; unsigned long InMcastPkts;
unsigned long Ip6OutMcastPkts; unsigned long OutMcastPkts;
unsigned long __pad[0]; unsigned long __pad[0];
}; };
......
...@@ -1066,8 +1066,8 @@ static int __init init_ipv4_mibs(void) ...@@ -1066,8 +1066,8 @@ static int __init init_ipv4_mibs(void)
{ {
net_statistics[0] = alloc_percpu(struct linux_mib); net_statistics[0] = alloc_percpu(struct linux_mib);
net_statistics[1] = alloc_percpu(struct linux_mib); net_statistics[1] = alloc_percpu(struct linux_mib);
ip_statistics[0] = alloc_percpu(struct ip_mib); ip_statistics[0] = alloc_percpu(struct ipstats_mib);
ip_statistics[1] = alloc_percpu(struct ip_mib); ip_statistics[1] = alloc_percpu(struct ipstats_mib);
icmp_statistics[0] = alloc_percpu(struct icmp_mib); icmp_statistics[0] = alloc_percpu(struct icmp_mib);
icmp_statistics[1] = alloc_percpu(struct icmp_mib); icmp_statistics[1] = alloc_percpu(struct icmp_mib);
tcp_statistics[0] = alloc_percpu(struct tcp_mib); tcp_statistics[0] = alloc_percpu(struct tcp_mib);
......
...@@ -46,7 +46,7 @@ static inline int ip_forward_finish(struct sk_buff *skb) ...@@ -46,7 +46,7 @@ static inline int ip_forward_finish(struct sk_buff *skb)
{ {
struct ip_options * opt = &(IPCB(skb)->opt); struct ip_options * opt = &(IPCB(skb)->opt);
IP_INC_STATS_BH(IpForwDatagrams); IP_INC_STATS_BH(OutForwDatagrams);
if (unlikely(opt->optlen)) if (unlikely(opt->optlen))
ip_forward_options(skb); ip_forward_options(skb);
......
...@@ -263,7 +263,7 @@ static void ip_evictor(void) ...@@ -263,7 +263,7 @@ static void ip_evictor(void)
spin_unlock(&qp->lock); spin_unlock(&qp->lock);
ipq_put(qp); ipq_put(qp);
IP_INC_STATS_BH(IpReasmFails); IP_INC_STATS_BH(ReasmFails);
} }
} }
...@@ -281,8 +281,8 @@ static void ip_expire(unsigned long arg) ...@@ -281,8 +281,8 @@ static void ip_expire(unsigned long arg)
ipq_kill(qp); ipq_kill(qp);
IP_INC_STATS_BH(IpReasmTimeout); IP_INC_STATS_BH(ReasmTimeout);
IP_INC_STATS_BH(IpReasmFails); IP_INC_STATS_BH(ReasmFails);
if ((qp->last_in&FIRST_IN) && qp->fragments != NULL) { if ((qp->last_in&FIRST_IN) && qp->fragments != NULL) {
struct sk_buff *head = qp->fragments; struct sk_buff *head = qp->fragments;
...@@ -609,7 +609,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev) ...@@ -609,7 +609,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
iph = head->nh.iph; iph = head->nh.iph;
iph->frag_off = 0; iph->frag_off = 0;
iph->tot_len = htons(len); iph->tot_len = htons(len);
IP_INC_STATS_BH(IpReasmOKs); IP_INC_STATS_BH(ReasmOKs);
qp->fragments = NULL; qp->fragments = NULL;
return head; return head;
...@@ -625,7 +625,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev) ...@@ -625,7 +625,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
"Oversized IP packet from %d.%d.%d.%d.\n", "Oversized IP packet from %d.%d.%d.%d.\n",
NIPQUAD(qp->saddr)); NIPQUAD(qp->saddr));
out_fail: out_fail:
IP_INC_STATS_BH(IpReasmFails); IP_INC_STATS_BH(ReasmFails);
return NULL; return NULL;
} }
...@@ -636,7 +636,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb) ...@@ -636,7 +636,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb)
struct ipq *qp; struct ipq *qp;
struct net_device *dev; struct net_device *dev;
IP_INC_STATS_BH(IpReasmReqds); IP_INC_STATS_BH(ReasmReqds);
/* Start by cleaning up the memory. */ /* Start by cleaning up the memory. */
if (atomic_read(&ip_frag_mem) > sysctl_ipfrag_high_thresh) if (atomic_read(&ip_frag_mem) > sysctl_ipfrag_high_thresh)
...@@ -661,7 +661,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb) ...@@ -661,7 +661,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb)
return ret; return ret;
} }
IP_INC_STATS_BH(IpReasmFails); IP_INC_STATS_BH(ReasmFails);
kfree_skb(skb); kfree_skb(skb);
return NULL; return NULL;
} }
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
* SNMP management statistics * SNMP management statistics
*/ */
DEFINE_SNMP_STAT(struct ip_mib, ip_statistics); DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics);
/* /*
* Process Router Attention IP option * Process Router Attention IP option
...@@ -249,16 +249,16 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb) ...@@ -249,16 +249,16 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb)
protocol = -ret; protocol = -ret;
goto resubmit; goto resubmit;
} }
IP_INC_STATS_BH(IpInDelivers); IP_INC_STATS_BH(InDelivers);
} else { } else {
if (!raw_sk) { if (!raw_sk) {
if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
IP_INC_STATS_BH(IpInUnknownProtos); IP_INC_STATS_BH(InUnknownProtos);
icmp_send(skb, ICMP_DEST_UNREACH, icmp_send(skb, ICMP_DEST_UNREACH,
ICMP_PROT_UNREACH, 0); ICMP_PROT_UNREACH, 0);
} }
} else } else
IP_INC_STATS_BH(IpInDelivers); IP_INC_STATS_BH(InDelivers);
kfree_skb(skb); kfree_skb(skb);
} }
} }
...@@ -324,7 +324,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb) ...@@ -324,7 +324,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
*/ */
if (skb_cow(skb, skb_headroom(skb))) { if (skb_cow(skb, skb_headroom(skb))) {
IP_INC_STATS_BH(IpInDiscards); IP_INC_STATS_BH(InDiscards);
goto drop; goto drop;
} }
iph = skb->nh.iph; iph = skb->nh.iph;
...@@ -353,7 +353,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb) ...@@ -353,7 +353,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
return dst_input(skb); return dst_input(skb);
inhdr_error: inhdr_error:
IP_INC_STATS_BH(IpInHdrErrors); IP_INC_STATS_BH(InHdrErrors);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
return NET_RX_DROP; return NET_RX_DROP;
...@@ -372,10 +372,10 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) ...@@ -372,10 +372,10 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
if (skb->pkt_type == PACKET_OTHERHOST) if (skb->pkt_type == PACKET_OTHERHOST)
goto drop; goto drop;
IP_INC_STATS_BH(IpInReceives); IP_INC_STATS_BH(InReceives);
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
IP_INC_STATS_BH(IpInDiscards); IP_INC_STATS_BH(InDiscards);
goto out; goto out;
} }
...@@ -426,7 +426,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) ...@@ -426,7 +426,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
ip_rcv_finish); ip_rcv_finish);
inhdr_error: inhdr_error:
IP_INC_STATS_BH(IpInHdrErrors); IP_INC_STATS_BH(InHdrErrors);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
out: out:
......
...@@ -232,7 +232,7 @@ int ip_mc_output(struct sk_buff *skb) ...@@ -232,7 +232,7 @@ int ip_mc_output(struct sk_buff *skb)
/* /*
* If the indicated interface is up and running, send the packet. * If the indicated interface is up and running, send the packet.
*/ */
IP_INC_STATS(IpOutRequests); IP_INC_STATS(OutRequests);
skb->dev = dev; skb->dev = dev;
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
...@@ -285,7 +285,7 @@ int ip_mc_output(struct sk_buff *skb) ...@@ -285,7 +285,7 @@ int ip_mc_output(struct sk_buff *skb)
int ip_output(struct sk_buff *skb) int ip_output(struct sk_buff *skb)
{ {
IP_INC_STATS(IpOutRequests); IP_INC_STATS(OutRequests);
if ((skb->len > dst_pmtu(skb->dst) || skb_shinfo(skb)->frag_list) && if ((skb->len > dst_pmtu(skb->dst) || skb_shinfo(skb)->frag_list) &&
!skb_shinfo(skb)->tso_size) !skb_shinfo(skb)->tso_size)
...@@ -390,7 +390,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) ...@@ -390,7 +390,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
dst_output); dst_output);
no_route: no_route:
IP_INC_STATS(IpOutNoRoutes); IP_INC_STATS(OutNoRoutes);
kfree_skb(skb); kfree_skb(skb);
return -EHOSTUNREACH; return -EHOSTUNREACH;
} }
...@@ -547,7 +547,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -547,7 +547,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
} }
if (err == 0) { if (err == 0) {
IP_INC_STATS(IpFragOKs); IP_INC_STATS(FragOKs);
return 0; return 0;
} }
...@@ -556,7 +556,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -556,7 +556,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
kfree_skb(frag); kfree_skb(frag);
frag = skb; frag = skb;
} }
IP_INC_STATS(IpFragFails); IP_INC_STATS(FragFails);
return err; return err;
} }
...@@ -662,7 +662,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -662,7 +662,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
* Put this fragment into the sending queue. * Put this fragment into the sending queue.
*/ */
IP_INC_STATS(IpFragCreates); IP_INC_STATS(FragCreates);
iph->tot_len = htons(len + hlen); iph->tot_len = htons(len + hlen);
...@@ -673,12 +673,12 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -673,12 +673,12 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
goto fail; goto fail;
} }
kfree_skb(skb); kfree_skb(skb);
IP_INC_STATS(IpFragOKs); IP_INC_STATS(FragOKs);
return err; return err;
fail: fail:
kfree_skb(skb); kfree_skb(skb);
IP_INC_STATS(IpFragFails); IP_INC_STATS(FragFails);
return err; return err;
} }
...@@ -975,7 +975,7 @@ int ip_append_data(struct sock *sk, ...@@ -975,7 +975,7 @@ int ip_append_data(struct sock *sk,
error: error:
inet->cork.length -= length; inet->cork.length -= length;
IP_INC_STATS(IpOutDiscards); IP_INC_STATS(OutDiscards);
return err; return err;
} }
...@@ -1088,7 +1088,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, ...@@ -1088,7 +1088,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
error: error:
inet->cork.length -= size; inet->cork.length -= size;
IP_INC_STATS(IpOutDiscards); IP_INC_STATS(OutDiscards);
return err; return err;
} }
...@@ -1198,7 +1198,7 @@ int ip_push_pending_frames(struct sock *sk) ...@@ -1198,7 +1198,7 @@ int ip_push_pending_frames(struct sock *sk)
return err; return err;
error: error:
IP_INC_STATS(IpOutDiscards); IP_INC_STATS(OutDiscards);
goto out; goto out;
} }
......
...@@ -339,6 +339,7 @@ static void ipcomp_destroy(struct xfrm_state *x) ...@@ -339,6 +339,7 @@ static void ipcomp_destroy(struct xfrm_state *x)
struct ipcomp_data *ipcd = x->data; struct ipcomp_data *ipcd = x->data;
if (!ipcd) if (!ipcd)
return; return;
xfrm_state_delete_tunnel(x);
ipcomp_free_data(ipcd); ipcomp_free_data(ipcd);
kfree(ipcd); kfree(ipcd);
} }
......
...@@ -1115,7 +1115,7 @@ static inline int ipmr_forward_finish(struct sk_buff *skb) ...@@ -1115,7 +1115,7 @@ static inline int ipmr_forward_finish(struct sk_buff *skb)
{ {
struct ip_options * opt = &(IPCB(skb)->opt); struct ip_options * opt = &(IPCB(skb)->opt);
IP_INC_STATS_BH(IpForwDatagrams); IP_INC_STATS_BH(OutForwDatagrams);
if (unlikely(opt->optlen)) if (unlikely(opt->optlen))
ip_forward_options(skb); ip_forward_options(skb);
...@@ -1178,7 +1178,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) ...@@ -1178,7 +1178,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
to blackhole. to blackhole.
*/ */
IP_INC_STATS_BH(IpFragFails); IP_INC_STATS_BH(FragFails);
ip_rt_put(rt); ip_rt_put(rt);
goto out_free; goto out_free;
} }
......
...@@ -88,7 +88,7 @@ static struct file_operations sockstat_seq_fops = { ...@@ -88,7 +88,7 @@ static struct file_operations sockstat_seq_fops = {
}; };
static unsigned long static unsigned long
fold_field(void *mib[], int nr) __fold_field(void *mib[], int offt)
{ {
unsigned long res = 0; unsigned long res = 0;
int i; int i;
...@@ -98,14 +98,41 @@ fold_field(void *mib[], int nr) ...@@ -98,14 +98,41 @@ fold_field(void *mib[], int nr)
continue; continue;
res += res +=
*((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) + *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) +
sizeof (unsigned long) * nr)); offt));
res += res +=
*((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) + *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) +
sizeof (unsigned long) * nr)); offt));
} }
return res; return res;
} }
#define fold_field(_mib, _nr) __fold_field(_mib, (sizeof(unsigned long) * (_nr)))
/* snmp items */
static struct snmp_item snmp4_ipstats_list[] = {
#define __SNMP_GEN(x,y) SNMP_ITEM(struct ipstats_mib, x, y)
#define SNMP_GEN(x) __SNMP_GEN(x, #x)
SNMP_GEN(InReceives),
SNMP_GEN(InHdrErrors),
SNMP_GEN(InAddrErrors),
__SNMP_GEN(OutForwDatagrams,"ForwDatagrams"), /* for backward compatibility */
SNMP_GEN(InUnknownProtos),
SNMP_GEN(InDiscards),
SNMP_GEN(InDelivers),
SNMP_GEN(OutRequests),
SNMP_GEN(OutDiscards),
SNMP_GEN(OutNoRoutes),
SNMP_GEN(ReasmTimeout),
SNMP_GEN(ReasmReqds),
SNMP_GEN(ReasmOKs),
SNMP_GEN(ReasmFails),
SNMP_GEN(FragOKs),
SNMP_GEN(FragFails),
SNMP_GEN(FragCreates),
SNMP_ITEM_SENTINEL
#undef SNMP_GEN
};
/* /*
* Called from the PROCfs module. This outputs /proc/net/snmp. * Called from the PROCfs module. This outputs /proc/net/snmp.
*/ */
...@@ -113,17 +140,18 @@ static int snmp_seq_show(struct seq_file *seq, void *v) ...@@ -113,17 +140,18 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
{ {
int i; int i;
seq_printf(seq, "Ip: Forwarding DefaultTTL InReceives InHdrErrors " seq_printf(seq, "Ip: Forwarding DefaultTTL");
"InAddrErrors ForwDatagrams InUnknownProtos "
"InDiscards InDelivers OutRequests OutDiscards " for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
"OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs " seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
"ReasmFails FragOKs FragFails FragCreates\nIp: %d %d",
seq_printf(seq, "\nIp: %d %d",
ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl); ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl);
for (i = 0; for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
i < offsetof(struct ip_mib, __pad) / sizeof(unsigned long); i++)
seq_printf(seq, " %lu", seq_printf(seq, " %lu",
fold_field((void **) ip_statistics, i)); __fold_field((void **) ip_statistics,
snmp4_ipstats_list[i].offset));
seq_printf(seq, "\nIcmp: InMsgs InErrors InDestUnreachs InTimeExcds " seq_printf(seq, "\nIcmp: InMsgs InErrors InDestUnreachs InTimeExcds "
"InParmProbs InSrcQuenchs InRedirects InEchos " "InParmProbs InSrcQuenchs InRedirects InEchos "
......
...@@ -319,7 +319,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, int length, ...@@ -319,7 +319,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, int length,
err = -EFAULT; err = -EFAULT;
kfree_skb(skb); kfree_skb(skb);
error: error:
IP_INC_STATS(IpOutDiscards); IP_INC_STATS(OutDiscards);
return err; return err;
} }
......
...@@ -1040,6 +1040,8 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, ...@@ -1040,6 +1040,8 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
rt->u.dst.child = NULL; rt->u.dst.child = NULL;
if (rt->u.dst.dev) if (rt->u.dst.dev)
dev_hold(rt->u.dst.dev); dev_hold(rt->u.dst.dev);
if (rt->idev)
in_dev_hold(rt->idev);
rt->u.dst.obsolete = 0; rt->u.dst.obsolete = 0;
rt->u.dst.lastuse = jiffies; rt->u.dst.lastuse = jiffies;
rt->u.dst.path = &rt->u.dst; rt->u.dst.path = &rt->u.dst;
...@@ -1321,11 +1323,17 @@ static void ipv4_dst_destroy(struct dst_entry *dst) ...@@ -1321,11 +1323,17 @@ static void ipv4_dst_destroy(struct dst_entry *dst)
{ {
struct rtable *rt = (struct rtable *) dst; struct rtable *rt = (struct rtable *) dst;
struct inet_peer *peer = rt->peer; struct inet_peer *peer = rt->peer;
struct in_device *idev = rt->idev;
if (peer) { if (peer) {
rt->peer = NULL; rt->peer = NULL;
inet_putpeer(peer); inet_putpeer(peer);
} }
if (idev) {
rt->idev = NULL;
in_dev_put(idev);
}
} }
static void ipv4_link_failure(struct sk_buff *skb) static void ipv4_link_failure(struct sk_buff *skb)
...@@ -1486,6 +1494,7 @@ static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr, ...@@ -1486,6 +1494,7 @@ static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr,
rth->fl.iif = dev->ifindex; rth->fl.iif = dev->ifindex;
rth->u.dst.dev = &loopback_dev; rth->u.dst.dev = &loopback_dev;
dev_hold(rth->u.dst.dev); dev_hold(rth->u.dst.dev);
rth->idev = in_dev_get(rth->u.dst.dev);
rth->fl.oif = 0; rth->fl.oif = 0;
rth->rt_gateway = daddr; rth->rt_gateway = daddr;
rth->rt_spec_dst= spec_dst; rth->rt_spec_dst= spec_dst;
...@@ -1695,6 +1704,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, ...@@ -1695,6 +1704,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
rth->fl.iif = dev->ifindex; rth->fl.iif = dev->ifindex;
rth->u.dst.dev = out_dev->dev; rth->u.dst.dev = out_dev->dev;
dev_hold(rth->u.dst.dev); dev_hold(rth->u.dst.dev);
rth->idev = in_dev_get(rth->u.dst.dev);
rth->fl.oif = 0; rth->fl.oif = 0;
rth->rt_spec_dst= spec_dst; rth->rt_spec_dst= spec_dst;
...@@ -1774,6 +1784,7 @@ out: return err; ...@@ -1774,6 +1784,7 @@ out: return err;
rth->fl.iif = dev->ifindex; rth->fl.iif = dev->ifindex;
rth->u.dst.dev = &loopback_dev; rth->u.dst.dev = &loopback_dev;
dev_hold(rth->u.dst.dev); dev_hold(rth->u.dst.dev);
rth->idev = in_dev_get(rth->u.dst.dev);
rth->rt_gateway = daddr; rth->rt_gateway = daddr;
rth->rt_spec_dst= spec_dst; rth->rt_spec_dst= spec_dst;
rth->u.dst.input= ip_local_deliver; rth->u.dst.input= ip_local_deliver;
...@@ -2157,6 +2168,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) ...@@ -2157,6 +2168,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
rth->rt_iif = oldflp->oif ? : dev_out->ifindex; rth->rt_iif = oldflp->oif ? : dev_out->ifindex;
rth->u.dst.dev = dev_out; rth->u.dst.dev = dev_out;
dev_hold(dev_out); dev_hold(dev_out);
rth->idev = in_dev_get(dev_out);
rth->rt_gateway = fl.fl4_dst; rth->rt_gateway = fl.fl4_dst;
rth->rt_spec_dst= fl.fl4_src; rth->rt_spec_dst= fl.fl4_src;
......
...@@ -1290,12 +1290,12 @@ static struct dst_entry* tcp_v4_route_req(struct sock *sk, ...@@ -1290,12 +1290,12 @@ static struct dst_entry* tcp_v4_route_req(struct sock *sk,
.dport = req->rmt_port } } }; .dport = req->rmt_port } } };
if (ip_route_output_flow(&rt, &fl, sk, 0)) { if (ip_route_output_flow(&rt, &fl, sk, 0)) {
IP_INC_STATS_BH(IpOutNoRoutes); IP_INC_STATS_BH(OutNoRoutes);
return NULL; return NULL;
} }
if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) { if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) {
ip_rt_put(rt); ip_rt_put(rt);
IP_INC_STATS_BH(IpOutNoRoutes); IP_INC_STATS_BH(OutNoRoutes);
return NULL; return NULL;
} }
return &rt->u.dst; return &rt->u.dst;
......
...@@ -667,14 +667,14 @@ snmp6_mib_free(void *ptr[2]) ...@@ -667,14 +667,14 @@ snmp6_mib_free(void *ptr[2])
static int __init init_ipv6_mibs(void) static int __init init_ipv6_mibs(void)
{ {
if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipv6_mib), if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipstats_mib),
__alignof__(struct ipv6_mib)) < 0) __alignof__(struct ipstats_mib)) < 0)
goto err_ip_mib; goto err_ip_mib;
if (snmp6_mib_init((void **)icmpv6_statistics, sizeof (struct icmpv6_mib), if (snmp6_mib_init((void **)icmpv6_statistics, sizeof (struct icmpv6_mib),
__alignof__(struct ipv6_mib)) < 0) __alignof__(struct icmpv6_mib)) < 0)
goto err_icmp_mib; goto err_icmp_mib;
if (snmp6_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib), if (snmp6_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib),
__alignof__(struct ipv6_mib)) < 0) __alignof__(struct udp_mib)) < 0)
goto err_udp_mib; goto err_udp_mib;
return 0; return 0;
......
...@@ -159,7 +159,7 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -159,7 +159,7 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
!pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
} }
...@@ -172,7 +172,7 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -172,7 +172,7 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
return 1; return 1;
} }
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
return -1; return -1;
} }
...@@ -227,7 +227,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -227,7 +227,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
!pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
} }
...@@ -236,7 +236,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -236,7 +236,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) || if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) ||
skb->pkt_type != PACKET_HOST) { skb->pkt_type != PACKET_HOST) {
IP6_INC_STATS_BH(Ip6InAddrErrors); IP6_INC_STATS_BH(InAddrErrors);
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
} }
...@@ -252,13 +252,13 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -252,13 +252,13 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
} }
if (hdr->type != IPV6_SRCRT_TYPE_0) { if (hdr->type != IPV6_SRCRT_TYPE_0) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->type) - skb->nh.raw); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->type) - skb->nh.raw);
return -1; return -1;
} }
if (hdr->hdrlen & 0x01) { if (hdr->hdrlen & 0x01) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->hdrlen) - skb->nh.raw); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->hdrlen) - skb->nh.raw);
return -1; return -1;
} }
...@@ -271,7 +271,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -271,7 +271,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
n = hdr->hdrlen >> 1; n = hdr->hdrlen >> 1;
if (hdr->segments_left > n) { if (hdr->segments_left > n) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->segments_left) - skb->nh.raw); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->segments_left) - skb->nh.raw);
return -1; return -1;
} }
...@@ -284,7 +284,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -284,7 +284,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
kfree_skb(skb); kfree_skb(skb);
/* the copy is a forwarded packet */ /* the copy is a forwarded packet */
if (skb2 == NULL) { if (skb2 == NULL) {
IP6_INC_STATS_BH(Ip6OutDiscards); IP6_INC_STATS_BH(OutDiscards);
return -1; return -1;
} }
*skbp = skb = skb2; *skbp = skb = skb2;
...@@ -302,7 +302,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -302,7 +302,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
addr += i - 1; addr += i - 1;
if (ipv6_addr_is_multicast(addr)) { if (ipv6_addr_is_multicast(addr)) {
IP6_INC_STATS_BH(Ip6InAddrErrors); IP6_INC_STATS_BH(InAddrErrors);
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
} }
...@@ -319,7 +319,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -319,7 +319,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
} }
if (skb->dst->dev->flags&IFF_LOOPBACK) { if (skb->dst->dev->flags&IFF_LOOPBACK) {
if (skb->nh.ipv6h->hop_limit <= 1) { if (skb->nh.ipv6h->hop_limit <= 1) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
0, skb->dev); 0, skb->dev);
kfree_skb(skb); kfree_skb(skb);
...@@ -436,24 +436,24 @@ static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff) ...@@ -436,24 +436,24 @@ static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
if (skb->nh.raw[optoff+1] != 4 || (optoff&3) != 2) { if (skb->nh.raw[optoff+1] != 4 || (optoff&3) != 2) {
LIMIT_NETDEBUG( LIMIT_NETDEBUG(
printk(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", skb->nh.raw[optoff+1])); printk(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", skb->nh.raw[optoff+1]));
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
goto drop; goto drop;
} }
pkt_len = ntohl(*(u32*)(skb->nh.raw+optoff+2)); pkt_len = ntohl(*(u32*)(skb->nh.raw+optoff+2));
if (pkt_len <= IPV6_MAXPLEN) { if (pkt_len <= IPV6_MAXPLEN) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
return 0; return 0;
} }
if (skb->nh.ipv6h->payload_len) { if (skb->nh.ipv6h->payload_len) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
return 0; return 0;
} }
if (pkt_len > skb->len - sizeof(struct ipv6hdr)) { if (pkt_len > skb->len - sizeof(struct ipv6hdr)) {
IP6_INC_STATS_BH(Ip6InTruncatedPkts); IP6_INC_STATS_BH(InTruncatedPkts);
goto drop; goto drop;
} }
if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { if (pkt_len + sizeof(struct ipv6hdr) < skb->len) {
......
...@@ -174,7 +174,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type, ...@@ -174,7 +174,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
*/ */
dst = ip6_route_output(sk, fl); dst = ip6_route_output(sk, fl);
if (dst->error) { if (dst->error) {
IP6_INC_STATS(Ip6OutNoRoutes); IP6_INC_STATS(OutNoRoutes);
} else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) { } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) {
res = 1; res = 1;
} else { } else {
......
...@@ -64,10 +64,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt ...@@ -64,10 +64,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
if (skb->pkt_type == PACKET_OTHERHOST) if (skb->pkt_type == PACKET_OTHERHOST)
goto drop; goto drop;
IP6_INC_STATS_BH(Ip6InReceives); IP6_INC_STATS_BH(InReceives);
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
IP6_INC_STATS_BH(Ip6InDiscards); IP6_INC_STATS_BH(InDiscards);
goto out; goto out;
} }
...@@ -80,7 +80,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt ...@@ -80,7 +80,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
goto err; goto err;
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) { if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
goto drop; goto drop;
} }
...@@ -97,7 +97,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt ...@@ -97,7 +97,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
goto truncated; goto truncated;
if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { if (pkt_len + sizeof(struct ipv6hdr) < skb->len) {
if (__pskb_trim(skb, pkt_len + sizeof(struct ipv6hdr))){ if (__pskb_trim(skb, pkt_len + sizeof(struct ipv6hdr))){
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
goto drop; goto drop;
} }
hdr = skb->nh.ipv6h; hdr = skb->nh.ipv6h;
...@@ -109,7 +109,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt ...@@ -109,7 +109,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
if (hdr->nexthdr == NEXTHDR_HOP) { if (hdr->nexthdr == NEXTHDR_HOP) {
skb->h.raw = (u8*)(hdr+1); skb->h.raw = (u8*)(hdr+1);
if (ipv6_parse_hopopts(skb, offsetof(struct ipv6hdr, nexthdr)) < 0) { if (ipv6_parse_hopopts(skb, offsetof(struct ipv6hdr, nexthdr)) < 0) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
return 0; return 0;
} }
hdr = skb->nh.ipv6h; hdr = skb->nh.ipv6h;
...@@ -117,9 +117,9 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt ...@@ -117,9 +117,9 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish); return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish);
truncated: truncated:
IP6_INC_STATS_BH(Ip6InTruncatedPkts); IP6_INC_STATS_BH(InTruncatedPkts);
err: err:
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
out: out:
...@@ -194,15 +194,15 @@ static inline int ip6_input_finish(struct sk_buff *skb) ...@@ -194,15 +194,15 @@ static inline int ip6_input_finish(struct sk_buff *skb)
if (ret > 0) if (ret > 0)
goto resubmit; goto resubmit;
else if (ret == 0) else if (ret == 0)
IP6_INC_STATS_BH(Ip6InDelivers); IP6_INC_STATS_BH(InDelivers);
} else { } else {
if (!raw_sk) { if (!raw_sk) {
if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
IP6_INC_STATS_BH(Ip6InUnknownProtos); IP6_INC_STATS_BH(InUnknownProtos);
icmpv6_param_prob(skb, ICMPV6_UNK_NEXTHDR, nhoff); icmpv6_param_prob(skb, ICMPV6_UNK_NEXTHDR, nhoff);
} }
} else { } else {
IP6_INC_STATS_BH(Ip6InDelivers); IP6_INC_STATS_BH(InDelivers);
kfree_skb(skb); kfree_skb(skb);
} }
} }
...@@ -210,7 +210,7 @@ static inline int ip6_input_finish(struct sk_buff *skb) ...@@ -210,7 +210,7 @@ static inline int ip6_input_finish(struct sk_buff *skb)
return 0; return 0;
discard: discard:
IP6_INC_STATS_BH(Ip6InDiscards); IP6_INC_STATS_BH(InDiscards);
rcu_read_unlock(); rcu_read_unlock();
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
...@@ -227,7 +227,7 @@ int ip6_mc_input(struct sk_buff *skb) ...@@ -227,7 +227,7 @@ int ip6_mc_input(struct sk_buff *skb)
struct ipv6hdr *hdr; struct ipv6hdr *hdr;
int deliver; int deliver;
IP6_INC_STATS_BH(Ip6InMcastPkts); IP6_INC_STATS_BH(InMcastPkts);
hdr = skb->nh.ipv6h; hdr = skb->nh.ipv6h;
deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) || deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) ||
......
...@@ -87,7 +87,7 @@ static inline int ip6_output_finish(struct sk_buff *skb) ...@@ -87,7 +87,7 @@ static inline int ip6_output_finish(struct sk_buff *skb)
} else if (dst->neighbour) } else if (dst->neighbour)
return dst->neighbour->output(skb); return dst->neighbour->output(skb);
IP6_INC_STATS_BH(Ip6OutNoRoutes); IP6_INC_STATS_BH(OutNoRoutes);
kfree_skb(skb); kfree_skb(skb);
return -EINVAL; return -EINVAL;
...@@ -132,13 +132,13 @@ int ip6_output2(struct sk_buff *skb) ...@@ -132,13 +132,13 @@ int ip6_output2(struct sk_buff *skb)
ip6_dev_loopback_xmit); ip6_dev_loopback_xmit);
if (skb->nh.ipv6h->hop_limit == 0) { if (skb->nh.ipv6h->hop_limit == 0) {
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
} }
IP6_INC_STATS(Ip6OutMcastPkts); IP6_INC_STATS(OutMcastPkts);
} }
return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb,NULL, skb->dev,ip6_output_finish); return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb,NULL, skb->dev,ip6_output_finish);
...@@ -169,7 +169,7 @@ int ip6_route_me_harder(struct sk_buff *skb) ...@@ -169,7 +169,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
dst = ip6_route_output(skb->sk, &fl); dst = ip6_route_output(skb->sk, &fl);
if (dst->error) { if (dst->error) {
IP6_INC_STATS(Ip6OutNoRoutes); IP6_INC_STATS(OutNoRoutes);
LIMIT_NETDEBUG( LIMIT_NETDEBUG(
printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n")); printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n"));
dst_release(dst); dst_release(dst);
...@@ -228,7 +228,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -228,7 +228,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
kfree_skb(skb); kfree_skb(skb);
skb = skb2; skb = skb2;
if (skb == NULL) { if (skb == NULL) {
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
return -ENOBUFS; return -ENOBUFS;
} }
if (sk) if (sk)
...@@ -262,7 +262,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -262,7 +262,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
mtu = dst_pmtu(dst); mtu = dst_pmtu(dst);
if ((skb->len <= mtu) || ipfragok) { if ((skb->len <= mtu) || ipfragok) {
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
return NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, ip6_maybe_reroute); return NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, ip6_maybe_reroute);
} }
...@@ -270,7 +270,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -270,7 +270,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n"); printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n");
skb->dev = dst->dev; skb->dev = dst->dev;
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
IP6_INC_STATS(Ip6FragFails); IP6_INC_STATS(FragFails);
kfree_skb(skb); kfree_skb(skb);
return -EMSGSIZE; return -EMSGSIZE;
} }
...@@ -352,7 +352,7 @@ int ip6_forward(struct sk_buff *skb) ...@@ -352,7 +352,7 @@ int ip6_forward(struct sk_buff *skb)
goto error; goto error;
if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
IP6_INC_STATS(Ip6InDiscards); IP6_INC_STATS(InDiscards);
goto drop; goto drop;
} }
...@@ -391,7 +391,7 @@ int ip6_forward(struct sk_buff *skb) ...@@ -391,7 +391,7 @@ int ip6_forward(struct sk_buff *skb)
} }
if (!xfrm6_route_forward(skb)) { if (!xfrm6_route_forward(skb)) {
IP6_INC_STATS(Ip6InDiscards); IP6_INC_STATS(InDiscards);
goto drop; goto drop;
} }
...@@ -429,14 +429,14 @@ int ip6_forward(struct sk_buff *skb) ...@@ -429,14 +429,14 @@ int ip6_forward(struct sk_buff *skb)
/* Again, force OUTPUT device used as source address */ /* Again, force OUTPUT device used as source address */
skb->dev = dst->dev; skb->dev = dst->dev;
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_pmtu(dst), skb->dev); icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_pmtu(dst), skb->dev);
IP6_INC_STATS_BH(Ip6InTooBigErrors); IP6_INC_STATS_BH(InTooBigErrors);
IP6_INC_STATS_BH(Ip6FragFails); IP6_INC_STATS_BH(FragFails);
kfree_skb(skb); kfree_skb(skb);
return -EMSGSIZE; return -EMSGSIZE;
} }
if (skb_cow(skb, dst->dev->hard_header_len)) { if (skb_cow(skb, dst->dev->hard_header_len)) {
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
goto drop; goto drop;
} }
...@@ -446,11 +446,11 @@ int ip6_forward(struct sk_buff *skb) ...@@ -446,11 +446,11 @@ int ip6_forward(struct sk_buff *skb)
hdr->hop_limit--; hdr->hop_limit--;
IP6_INC_STATS_BH(Ip6OutForwDatagrams); IP6_INC_STATS_BH(OutForwDatagrams);
return NF_HOOK(PF_INET6,NF_IP6_FORWARD, skb, skb->dev, dst->dev, ip6_forward_finish); return NF_HOOK(PF_INET6,NF_IP6_FORWARD, skb, skb->dev, dst->dev, ip6_forward_finish);
error: error:
IP6_INC_STATS_BH(Ip6InAddrErrors); IP6_INC_STATS_BH(InAddrErrors);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
return -EINVAL; return -EINVAL;
...@@ -563,7 +563,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -563,7 +563,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
tmp_hdr = kmalloc(hlen, GFP_ATOMIC); tmp_hdr = kmalloc(hlen, GFP_ATOMIC);
if (!tmp_hdr) { if (!tmp_hdr) {
IP6_INC_STATS(Ip6FragFails); IP6_INC_STATS(FragFails);
return -ENOMEM; return -ENOMEM;
} }
...@@ -618,7 +618,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -618,7 +618,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
kfree(tmp_hdr); kfree(tmp_hdr);
if (err == 0) { if (err == 0) {
IP6_INC_STATS(Ip6FragOKs); IP6_INC_STATS(FragOKs);
return 0; return 0;
} }
...@@ -628,7 +628,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -628,7 +628,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
frag = skb; frag = skb;
} }
IP6_INC_STATS(Ip6FragFails); IP6_INC_STATS(FragFails);
return err; return err;
} }
...@@ -661,7 +661,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -661,7 +661,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_RESERVED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_RESERVED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) {
NETDEBUG(printk(KERN_INFO "IPv6: frag: no memory for new fragment!\n")); NETDEBUG(printk(KERN_INFO "IPv6: frag: no memory for new fragment!\n"));
IP6_INC_STATS(Ip6FragFails); IP6_INC_STATS(FragFails);
err = -ENOMEM; err = -ENOMEM;
goto fail; goto fail;
} }
...@@ -719,19 +719,19 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -719,19 +719,19 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
* Put this fragment into the sending queue. * Put this fragment into the sending queue.
*/ */
IP6_INC_STATS(Ip6FragCreates); IP6_INC_STATS(FragCreates);
err = output(frag); err = output(frag);
if (err) if (err)
goto fail; goto fail;
} }
kfree_skb(skb); kfree_skb(skb);
IP6_INC_STATS(Ip6FragOKs); IP6_INC_STATS(FragOKs);
return err; return err;
fail: fail:
kfree_skb(skb); kfree_skb(skb);
IP6_INC_STATS(Ip6FragFails); IP6_INC_STATS(FragFails);
return err; return err;
} }
...@@ -1016,7 +1016,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse ...@@ -1016,7 +1016,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
return 0; return 0;
error: error:
inet->cork.length -= length; inet->cork.length -= length;
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
return err; return err;
} }
...@@ -1076,7 +1076,7 @@ int ip6_push_pending_frames(struct sock *sk) ...@@ -1076,7 +1076,7 @@ int ip6_push_pending_frames(struct sock *sk)
ipv6_addr_copy(&hdr->daddr, final_dst); ipv6_addr_copy(&hdr->daddr, final_dst);
skb->dst = dst_clone(&rt->u.dst); skb->dst = dst_clone(&rt->u.dst);
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output);
if (err) { if (err) {
if (err > 0) if (err > 0)
...@@ -1108,7 +1108,7 @@ void ip6_flush_pending_frames(struct sock *sk) ...@@ -1108,7 +1108,7 @@ void ip6_flush_pending_frames(struct sock *sk)
struct sk_buff *skb; struct sk_buff *skb;
while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
kfree_skb(skb); kfree_skb(skb);
} }
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
DEFINE_SNMP_STAT(struct ipv6_mib, ipv6_statistics); DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
static struct packet_type ipv6_packet_type = { static struct packet_type ipv6_packet_type = {
.type = __constant_htons(ETH_P_IPV6), .type = __constant_htons(ETH_P_IPV6),
......
...@@ -1317,7 +1317,7 @@ static void mld_sendpack(struct sk_buff *skb) ...@@ -1317,7 +1317,7 @@ static void mld_sendpack(struct sk_buff *skb)
struct inet6_dev *idev = in6_dev_get(skb->dev); struct inet6_dev *idev = in6_dev_get(skb->dev);
int err; int err;
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
payload_len = skb->tail - (unsigned char *)skb->nh.ipv6h - payload_len = skb->tail - (unsigned char *)skb->nh.ipv6h -
sizeof(struct ipv6hdr); sizeof(struct ipv6hdr);
mldlen = skb->tail - skb->h.raw; mldlen = skb->tail - skb->h.raw;
...@@ -1329,9 +1329,9 @@ static void mld_sendpack(struct sk_buff *skb) ...@@ -1329,9 +1329,9 @@ static void mld_sendpack(struct sk_buff *skb)
dev_queue_xmit); dev_queue_xmit);
if (!err) { if (!err) {
ICMP6_INC_STATS(idev,Icmp6OutMsgs); ICMP6_INC_STATS(idev,Icmp6OutMsgs);
IP6_INC_STATS(Ip6OutMcastPkts); IP6_INC_STATS(OutMcastPkts);
} else } else
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
if (likely(idev != NULL)) if (likely(idev != NULL))
in6_dev_put(idev); in6_dev_put(idev);
...@@ -1613,7 +1613,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ...@@ -1613,7 +1613,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
IPV6_TLV_ROUTERALERT, 2, 0, 0, IPV6_TLV_ROUTERALERT, 2, 0, 0,
IPV6_TLV_PADN, 0 }; IPV6_TLV_PADN, 0 };
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
snd_addr = addr; snd_addr = addr;
if (type == ICMPV6_MGM_REDUCTION) { if (type == ICMPV6_MGM_REDUCTION) {
snd_addr = &all_routers; snd_addr = &all_routers;
...@@ -1627,7 +1627,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ...@@ -1627,7 +1627,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err); skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err);
if (skb == NULL) { if (skb == NULL) {
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
return; return;
} }
...@@ -1672,16 +1672,16 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ...@@ -1672,16 +1672,16 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
else else
ICMP6_INC_STATS(idev, Icmp6OutGroupMembResponses); ICMP6_INC_STATS(idev, Icmp6OutGroupMembResponses);
ICMP6_INC_STATS(idev, Icmp6OutMsgs); ICMP6_INC_STATS(idev, Icmp6OutMsgs);
IP6_INC_STATS(Ip6OutMcastPkts); IP6_INC_STATS(OutMcastPkts);
} else } else
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
if (likely(idev != NULL)) if (likely(idev != NULL))
in6_dev_put(idev); in6_dev_put(idev);
return; return;
out: out:
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
kfree_skb(skb); kfree_skb(skb);
} }
......
...@@ -452,7 +452,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, ...@@ -452,7 +452,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
skb->dst = dst; skb->dst = dst;
idev = in6_dev_get(dst->dev); idev = in6_dev_get(dst->dev);
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
if (!err) { if (!err) {
ICMP6_INC_STATS(idev, Icmp6OutNeighborAdvertisements); ICMP6_INC_STATS(idev, Icmp6OutNeighborAdvertisements);
...@@ -536,7 +536,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, ...@@ -536,7 +536,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
/* send it! */ /* send it! */
skb->dst = dst; skb->dst = dst;
idev = in6_dev_get(dst->dev); idev = in6_dev_get(dst->dev);
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
if (!err) { if (!err) {
ICMP6_INC_STATS(idev, Icmp6OutNeighborSolicits); ICMP6_INC_STATS(idev, Icmp6OutNeighborSolicits);
...@@ -609,7 +609,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, ...@@ -609,7 +609,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
/* send it! */ /* send it! */
skb->dst = dst; skb->dst = dst;
idev = in6_dev_get(dst->dev); idev = in6_dev_get(dst->dev);
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
if (!err) { if (!err) {
ICMP6_INC_STATS(idev, Icmp6OutRouterSolicits); ICMP6_INC_STATS(idev, Icmp6OutRouterSolicits);
...@@ -1335,7 +1335,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1335,7 +1335,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
buff->dst = dst; buff->dst = dst;
idev = in6_dev_get(dst->dev); idev = in6_dev_get(dst->dev);
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output);
if (!err) { if (!err) {
ICMP6_INC_STATS(idev, Icmp6OutRedirects); ICMP6_INC_STATS(idev, Icmp6OutRedirects);
......
...@@ -57,43 +57,36 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v) ...@@ -57,43 +57,36 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
return 0; return 0;
} }
struct snmp6_item static struct snmp_item snmp6_ipstats_list[] = {
{
char *name;
int offset;
};
#define SNMP6_SENTINEL { .name = NULL, .offset = 0 }
static struct snmp6_item snmp6_ipv6_list[] = {
/* ipv6 mib according to RFC 2465 */ /* ipv6 mib according to RFC 2465 */
#define SNMP6_GEN(x) { .name = #x , .offset = offsetof(struct ipv6_mib, x) } #define SNMP6_GEN(x) SNMP_ITEM(struct ipstats_mib, x, "Ip6" #x)
SNMP6_GEN(Ip6InReceives), SNMP6_GEN(InReceives),
SNMP6_GEN(Ip6InHdrErrors), SNMP6_GEN(InHdrErrors),
SNMP6_GEN(Ip6InTooBigErrors), SNMP6_GEN(InTooBigErrors),
SNMP6_GEN(Ip6InNoRoutes), SNMP6_GEN(InNoRoutes),
SNMP6_GEN(Ip6InAddrErrors), SNMP6_GEN(InAddrErrors),
SNMP6_GEN(Ip6InUnknownProtos), SNMP6_GEN(InUnknownProtos),
SNMP6_GEN(Ip6InTruncatedPkts), SNMP6_GEN(InTruncatedPkts),
SNMP6_GEN(Ip6InDiscards), SNMP6_GEN(InDiscards),
SNMP6_GEN(Ip6InDelivers), SNMP6_GEN(InDelivers),
SNMP6_GEN(Ip6OutForwDatagrams), SNMP6_GEN(OutForwDatagrams),
SNMP6_GEN(Ip6OutRequests), SNMP6_GEN(OutRequests),
SNMP6_GEN(Ip6OutDiscards), SNMP6_GEN(OutDiscards),
SNMP6_GEN(Ip6OutNoRoutes), SNMP6_GEN(OutNoRoutes),
SNMP6_GEN(Ip6ReasmTimeout), SNMP6_GEN(ReasmTimeout),
SNMP6_GEN(Ip6ReasmReqds), SNMP6_GEN(ReasmReqds),
SNMP6_GEN(Ip6ReasmOKs), SNMP6_GEN(ReasmOKs),
SNMP6_GEN(Ip6ReasmFails), SNMP6_GEN(ReasmFails),
SNMP6_GEN(Ip6FragOKs), SNMP6_GEN(FragOKs),
SNMP6_GEN(Ip6FragFails), SNMP6_GEN(FragFails),
SNMP6_GEN(Ip6FragCreates), SNMP6_GEN(FragCreates),
SNMP6_GEN(Ip6InMcastPkts), SNMP6_GEN(InMcastPkts),
SNMP6_GEN(Ip6OutMcastPkts), SNMP6_GEN(OutMcastPkts),
#undef SNMP6_GEN #undef SNMP6_GEN
SNMP6_SENTINEL SNMP_ITEM_SENTINEL
}; };
static struct snmp6_item snmp6_icmp6_list[] = { static struct snmp_item snmp6_icmp6_list[] = {
/* icmpv6 mib according to RFC 2466 /* icmpv6 mib according to RFC 2466
Exceptions: {In|Out}AdminProhibs are removed, because I see Exceptions: {In|Out}AdminProhibs are removed, because I see
...@@ -104,7 +97,7 @@ static struct snmp6_item snmp6_icmp6_list[] = { ...@@ -104,7 +97,7 @@ static struct snmp6_item snmp6_icmp6_list[] = {
OutRouterAdvertisements too. OutRouterAdvertisements too.
OutGroupMembQueries too. OutGroupMembQueries too.
*/ */
#define SNMP6_GEN(x) { .name = #x , .offset = offsetof(struct icmpv6_mib, x) } #define SNMP6_GEN(x) SNMP_ITEM(struct icmpv6_mib, x, #x)
SNMP6_GEN(Icmp6InMsgs), SNMP6_GEN(Icmp6InMsgs),
SNMP6_GEN(Icmp6InErrors), SNMP6_GEN(Icmp6InErrors),
SNMP6_GEN(Icmp6InDestUnreachs), SNMP6_GEN(Icmp6InDestUnreachs),
...@@ -134,17 +127,17 @@ static struct snmp6_item snmp6_icmp6_list[] = { ...@@ -134,17 +127,17 @@ static struct snmp6_item snmp6_icmp6_list[] = {
SNMP6_GEN(Icmp6OutGroupMembResponses), SNMP6_GEN(Icmp6OutGroupMembResponses),
SNMP6_GEN(Icmp6OutGroupMembReductions), SNMP6_GEN(Icmp6OutGroupMembReductions),
#undef SNMP6_GEN #undef SNMP6_GEN
SNMP6_SENTINEL SNMP_ITEM_SENTINEL
}; };
static struct snmp6_item snmp6_udp6_list[] = { static struct snmp_item snmp6_udp6_list[] = {
#define SNMP6_GEN(x) { .name = "Udp6" #x , .offset = offsetof(struct udp_mib, Udp##x) } #define SNMP6_GEN(x) SNMP_ITEM(struct udp_mib, Udp##x, "Udp6" #x)
SNMP6_GEN(InDatagrams), SNMP6_GEN(InDatagrams),
SNMP6_GEN(NoPorts), SNMP6_GEN(NoPorts),
SNMP6_GEN(InErrors), SNMP6_GEN(InErrors),
SNMP6_GEN(OutDatagrams), SNMP6_GEN(OutDatagrams),
#undef SNMP6_GEN #undef SNMP6_GEN
SNMP6_SENTINEL SNMP_ITEM_SENTINEL
}; };
static unsigned long static unsigned long
...@@ -167,7 +160,7 @@ fold_field(void *mib[], int offt) ...@@ -167,7 +160,7 @@ fold_field(void *mib[], int offt)
} }
static inline void static inline void
snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp6_item *itemlist) snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_item *itemlist)
{ {
int i; int i;
for (i=0; itemlist[i].name; i++) for (i=0; itemlist[i].name; i++)
...@@ -183,7 +176,7 @@ static int snmp6_seq_show(struct seq_file *seq, void *v) ...@@ -183,7 +176,7 @@ static int snmp6_seq_show(struct seq_file *seq, void *v)
seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex);
snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list); snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list);
} else { } else {
snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipv6_list); snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list);
snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list); snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list);
snmp6_seq_show_item(seq, (void **)udp_stats_in6, snmp6_udp6_list); snmp6_seq_show_item(seq, (void **)udp_stats_in6, snmp6_udp6_list);
} }
......
...@@ -535,7 +535,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, ...@@ -535,7 +535,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
if (err) if (err)
goto error_fault; goto error_fault;
IP6_INC_STATS(Ip6OutRequests); IP6_INC_STATS(OutRequests);
err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, rt->u.dst.dev, err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
dst_output); dst_output);
if (err > 0) if (err > 0)
...@@ -549,7 +549,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, ...@@ -549,7 +549,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
err = -EFAULT; err = -EFAULT;
kfree_skb(skb); kfree_skb(skb);
error: error:
IP6_INC_STATS(Ip6OutDiscards); IP6_INC_STATS(OutDiscards);
return err; return err;
} }
static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
......
...@@ -284,7 +284,7 @@ static void ip6_evictor(void) ...@@ -284,7 +284,7 @@ static void ip6_evictor(void)
spin_unlock(&fq->lock); spin_unlock(&fq->lock);
fq_put(fq); fq_put(fq);
IP6_INC_STATS_BH(Ip6ReasmFails); IP6_INC_STATS_BH(ReasmFails);
} }
} }
...@@ -299,8 +299,8 @@ static void ip6_frag_expire(unsigned long data) ...@@ -299,8 +299,8 @@ static void ip6_frag_expire(unsigned long data)
fq_kill(fq); fq_kill(fq);
IP6_INC_STATS_BH(Ip6ReasmTimeout); IP6_INC_STATS_BH(ReasmTimeout);
IP6_INC_STATS_BH(Ip6ReasmFails); IP6_INC_STATS_BH(ReasmFails);
/* Send error only if the first segment arrived. */ /* Send error only if the first segment arrived. */
if (fq->last_in&FIRST_IN && fq->fragments) { if (fq->last_in&FIRST_IN && fq->fragments) {
...@@ -386,7 +386,7 @@ ip6_frag_create(unsigned int hash, u32 id, struct in6_addr *src, struct in6_addr ...@@ -386,7 +386,7 @@ ip6_frag_create(unsigned int hash, u32 id, struct in6_addr *src, struct in6_addr
return ip6_frag_intern(hash, fq); return ip6_frag_intern(hash, fq);
oom: oom:
IP6_INC_STATS_BH(Ip6ReasmFails); IP6_INC_STATS_BH(ReasmFails);
return NULL; return NULL;
} }
...@@ -426,7 +426,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, ...@@ -426,7 +426,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1))); ((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
if ((unsigned int)end > IPV6_MAXPLEN) { if ((unsigned int)end > IPV6_MAXPLEN) {
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw); icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw);
return; return;
} }
...@@ -453,7 +453,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, ...@@ -453,7 +453,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
/* RFC2460 says always send parameter problem in /* RFC2460 says always send parameter problem in
* this case. -DaveM * this case. -DaveM
*/ */
IP6_INC_STATS_BH(Ip6InHdrErrors); IP6_INC_STATS_BH(InHdrErrors);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
offsetof(struct ipv6hdr, payload_len)); offsetof(struct ipv6hdr, payload_len));
return; return;
...@@ -572,7 +572,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, ...@@ -572,7 +572,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
return; return;
err: err:
IP6_INC_STATS(Ip6ReasmFails); IP6_INC_STATS(ReasmFails);
kfree_skb(skb); kfree_skb(skb);
} }
...@@ -666,7 +666,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in, ...@@ -666,7 +666,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in,
if (head->ip_summed == CHECKSUM_HW) if (head->ip_summed == CHECKSUM_HW)
head->csum = csum_partial(head->nh.raw, head->h.raw-head->nh.raw, head->csum); head->csum = csum_partial(head->nh.raw, head->h.raw-head->nh.raw, head->csum);
IP6_INC_STATS_BH(Ip6ReasmOKs); IP6_INC_STATS_BH(ReasmOKs);
fq->fragments = NULL; fq->fragments = NULL;
*nhoffp = nhoff; *nhoffp = nhoff;
return 1; return 1;
...@@ -679,7 +679,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in, ...@@ -679,7 +679,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in,
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n"); printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n");
out_fail: out_fail:
IP6_INC_STATS_BH(Ip6ReasmFails); IP6_INC_STATS_BH(ReasmFails);
return -1; return -1;
} }
...@@ -693,16 +693,16 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -693,16 +693,16 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
hdr = skb->nh.ipv6h; hdr = skb->nh.ipv6h;
IP6_INC_STATS_BH(Ip6ReasmReqds); IP6_INC_STATS_BH(ReasmReqds);
/* Jumbo payload inhibits frag. header */ /* Jumbo payload inhibits frag. header */
if (hdr->payload_len==0) { if (hdr->payload_len==0) {
IP6_INC_STATS(Ip6InHdrErrors); IP6_INC_STATS(InHdrErrors);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
return -1; return -1;
} }
if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+sizeof(struct frag_hdr))) { if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+sizeof(struct frag_hdr))) {
IP6_INC_STATS(Ip6InHdrErrors); IP6_INC_STATS(InHdrErrors);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
return -1; return -1;
} }
...@@ -713,7 +713,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -713,7 +713,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
if (!(fhdr->frag_off & htons(0xFFF9))) { if (!(fhdr->frag_off & htons(0xFFF9))) {
/* It is not a fragmented frame */ /* It is not a fragmented frame */
skb->h.raw += sizeof(struct frag_hdr); skb->h.raw += sizeof(struct frag_hdr);
IP6_INC_STATS_BH(Ip6ReasmOKs); IP6_INC_STATS_BH(ReasmOKs);
*nhoffp = (u8*)fhdr - skb->nh.raw; *nhoffp = (u8*)fhdr - skb->nh.raw;
return 1; return 1;
...@@ -738,7 +738,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp) ...@@ -738,7 +738,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
return ret; return ret;
} }
IP6_INC_STATS_BH(Ip6ReasmFails); IP6_INC_STATS_BH(ReasmFails);
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
} }
......
...@@ -83,6 +83,7 @@ static int ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; ...@@ -83,6 +83,7 @@ static int ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40;
static struct rt6_info * ip6_rt_copy(struct rt6_info *ort); static struct rt6_info * ip6_rt_copy(struct rt6_info *ort);
static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie);
static struct dst_entry *ip6_negative_advice(struct dst_entry *); static struct dst_entry *ip6_negative_advice(struct dst_entry *);
static void ip6_dst_destroy(struct dst_entry *);
static int ip6_dst_gc(void); static int ip6_dst_gc(void);
static int ip6_pkt_discard(struct sk_buff *skb); static int ip6_pkt_discard(struct sk_buff *skb);
...@@ -95,6 +96,7 @@ static struct dst_ops ip6_dst_ops = { ...@@ -95,6 +96,7 @@ static struct dst_ops ip6_dst_ops = {
.gc = ip6_dst_gc, .gc = ip6_dst_gc,
.gc_thresh = 1024, .gc_thresh = 1024,
.check = ip6_dst_check, .check = ip6_dst_check,
.destroy = ip6_dst_destroy,
.negative_advice = ip6_negative_advice, .negative_advice = ip6_negative_advice,
.link_failure = ip6_link_failure, .link_failure = ip6_link_failure,
.update_pmtu = ip6_rt_update_pmtu, .update_pmtu = ip6_rt_update_pmtu,
...@@ -134,7 +136,15 @@ rwlock_t rt6_lock = RW_LOCK_UNLOCKED; ...@@ -134,7 +136,15 @@ rwlock_t rt6_lock = RW_LOCK_UNLOCKED;
/* allocate dst with ip6_dst_ops */ /* allocate dst with ip6_dst_ops */
static __inline__ struct rt6_info *ip6_dst_alloc(void) static __inline__ struct rt6_info *ip6_dst_alloc(void)
{ {
return dst_alloc(&ip6_dst_ops); return (struct rt6_info *)dst_alloc(&ip6_dst_ops);
}
static void ip6_dst_destroy(struct dst_entry *dst)
{
struct rt6_info *rt = (struct rt6_info *)dst;
if (rt->rt6i_idev != NULL)
in6_dev_put(rt->rt6i_idev);
} }
/* /*
...@@ -573,14 +583,14 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev, ...@@ -573,14 +583,14 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev,
if (unlikely(rt == NULL)) if (unlikely(rt == NULL))
goto out; goto out;
if (dev) dev_hold(dev);
dev_hold(dev);
if (neigh) if (neigh)
neigh_hold(neigh); neigh_hold(neigh);
else else
neigh = ndisc_get_neigh(dev, addr); neigh = ndisc_get_neigh(dev, addr);
rt->rt6i_dev = dev; rt->rt6i_dev = dev;
rt->rt6i_idev = in6_dev_get(dev);
rt->rt6i_nexthop = neigh; rt->rt6i_nexthop = neigh;
rt->rt6i_expires = 0; rt->rt6i_expires = 0;
rt->rt6i_flags = RTF_LOCAL; rt->rt6i_flags = RTF_LOCAL;
...@@ -714,6 +724,12 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) ...@@ -714,6 +724,12 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
if (rtmsg->rtmsg_src_len) if (rtmsg->rtmsg_src_len)
return -EINVAL; return -EINVAL;
#endif #endif
if (rtmsg->rtmsg_ifindex) {
dev = dev_get_by_index(rtmsg->rtmsg_ifindex);
if (!dev)
return -ENODEV;
}
if (rtmsg->rtmsg_metric == 0) if (rtmsg->rtmsg_metric == 0)
rtmsg->rtmsg_metric = IP6_RT_PRIO_USER; rtmsg->rtmsg_metric = IP6_RT_PRIO_USER;
...@@ -739,13 +755,6 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) ...@@ -739,13 +755,6 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
rt->u.dst.output = ip6_output; rt->u.dst.output = ip6_output;
if (rtmsg->rtmsg_ifindex) {
dev = dev_get_by_index(rtmsg->rtmsg_ifindex);
err = -ENODEV;
if (dev == NULL)
goto out;
}
ipv6_addr_prefix(&rt->rt6i_dst.addr, ipv6_addr_prefix(&rt->rt6i_dst.addr,
&rtmsg->rtmsg_dst, rtmsg->rtmsg_dst_len); &rtmsg->rtmsg_dst, rtmsg->rtmsg_dst_len);
rt->rt6i_dst.plen = rtmsg->rtmsg_dst_len; rt->rt6i_dst.plen = rtmsg->rtmsg_dst_len;
...@@ -872,6 +881,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) ...@@ -872,6 +881,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
if (!rt->u.dst.metrics[RTAX_ADVMSS-1]) if (!rt->u.dst.metrics[RTAX_ADVMSS-1])
rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst)); rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst));
rt->u.dst.dev = dev; rt->u.dst.dev = dev;
rt->rt6i_idev = in6_dev_get(dev);
return rt6_ins(rt, nlh, _rtattr); return rt6_ins(rt, nlh, _rtattr);
out: out:
...@@ -1138,6 +1148,9 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) ...@@ -1138,6 +1148,9 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort)
rt->u.dst.dev = ort->u.dst.dev; rt->u.dst.dev = ort->u.dst.dev;
if (rt->u.dst.dev) if (rt->u.dst.dev)
dev_hold(rt->u.dst.dev); dev_hold(rt->u.dst.dev);
rt->rt6i_idev = ort->rt6i_idev;
if (rt->rt6i_idev)
in6_dev_hold(rt->rt6i_idev);
rt->u.dst.lastuse = jiffies; rt->u.dst.lastuse = jiffies;
rt->rt6i_expires = 0; rt->rt6i_expires = 0;
...@@ -1259,7 +1272,7 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg) ...@@ -1259,7 +1272,7 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
int ip6_pkt_discard(struct sk_buff *skb) int ip6_pkt_discard(struct sk_buff *skb)
{ {
IP6_INC_STATS(Ip6OutNoRoutes); IP6_INC_STATS(OutNoRoutes);
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev); icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
...@@ -1282,6 +1295,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev, int anycast) ...@@ -1282,6 +1295,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev, int anycast)
rt->u.dst.input = ip6_input; rt->u.dst.input = ip6_input;
rt->u.dst.output = ip6_output; rt->u.dst.output = ip6_output;
rt->rt6i_dev = &loopback_dev; rt->rt6i_dev = &loopback_dev;
rt->rt6i_idev = in6_dev_get(&loopback_dev);
rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev); rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev);
rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst)); rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst));
rt->u.dst.metrics[RTAX_HOPLIMIT-1] = ipv6_get_hoplimit(rt->rt6i_dev); rt->u.dst.metrics[RTAX_HOPLIMIT-1] = ipv6_get_hoplimit(rt->rt6i_dev);
......
...@@ -496,7 +496,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) ...@@ -496,7 +496,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
return err; return err;
no_route: no_route:
kfree_skb(nskb); kfree_skb(nskb);
IP_INC_STATS_BH(IpOutNoRoutes); IP_INC_STATS_BH(OutNoRoutes);
/* FIXME: Returning the 'err' will effect all the associations /* FIXME: Returning the 'err' will effect all the associations
* associated with a socket, although only one of the paths of the * associated with a socket, although only one of the paths of the
......
...@@ -231,7 +231,6 @@ static void __xfrm_state_delete(struct xfrm_state *x) ...@@ -231,7 +231,6 @@ static void __xfrm_state_delete(struct xfrm_state *x)
void xfrm_state_delete(struct xfrm_state *x) void xfrm_state_delete(struct xfrm_state *x)
{ {
xfrm_state_delete_tunnel(x);
spin_lock_bh(&x->lock); spin_lock_bh(&x->lock);
__xfrm_state_delete(x); __xfrm_state_delete(x);
spin_unlock_bh(&x->lock); spin_unlock_bh(&x->lock);
......
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