Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Count packets dropped by pfil
details: https://anonhg.NetBSD.org/src/rev/2b30e8a230e9
branches: trunk
changeset: 999030:2b30e8a230e9
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon May 13 07:47:59 2019 +0000
description:
Count packets dropped by pfil
diffstat:
sys/netinet/ip_input.c | 5 +++--
sys/netinet/ip_output.c | 10 +++++-----
sys/netinet/ip_var.h | 6 ++++--
sys/netinet6/ip6_forward.c | 12 ++++++++----
sys/netinet6/ip6_input.c | 12 +++++++-----
sys/netinet6/ip6_output.c | 11 ++++++-----
sys/netinet6/ip6_var.h | 6 ++++--
7 files changed, 37 insertions(+), 25 deletions(-)
diffs (204 lines):
diff -r e2eb2360fe3c -r 2b30e8a230e9 sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c Mon May 13 05:04:17 2019 +0000
+++ b/sys/netinet/ip_input.c Mon May 13 07:47:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_input.c,v 1.388 2019/01/17 02:47:15 knakahara Exp $ */
+/* $NetBSD: ip_input.c,v 1.389 2019/05/13 07:47:59 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.388 2019/01/17 02:47:15 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.389 2019/05/13 07:47:59 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -578,6 +578,7 @@
freed = pfil_run_hooks(inet_pfil_hook, &m, ifp, PFIL_IN) != 0;
if (freed || m == NULL) {
m = NULL;
+ IP_STATINC(IP_STAT_PFILDROP_IN);
goto out;
}
KASSERT(m->m_len >= sizeof(struct ip));
diff -r e2eb2360fe3c -r 2b30e8a230e9 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c Mon May 13 05:04:17 2019 +0000
+++ b/sys/netinet/ip_output.c Mon May 13 07:47:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_output.c,v 1.310 2019/02/04 10:48:46 mrg Exp $ */
+/* $NetBSD: ip_output.c,v 1.311 2019/05/13 07:47:59 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.310 2019/02/04 10:48:46 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.311 2019/05/13 07:47:59 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -622,10 +622,10 @@
* Run through list of hooks for output packets.
*/
error = pfil_run_hooks(inet_pfil_hook, &m, ifp, PFIL_OUT);
- if (error)
+ if (error || m == NULL) {
+ IP_STATINC(IP_STAT_PFILDROP_OUT);
goto done;
- if (m == NULL)
- goto done;
+ }
ip = mtod(m, struct ip *);
hlen = ip->ip_hl << 2;
diff -r e2eb2360fe3c -r 2b30e8a230e9 sys/netinet/ip_var.h
--- a/sys/netinet/ip_var.h Mon May 13 05:04:17 2019 +0000
+++ b/sys/netinet/ip_var.h Mon May 13 07:47:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_var.h,v 1.127 2018/09/14 05:09:51 maxv Exp $ */
+/* $NetBSD: ip_var.h,v 1.128 2019/05/13 07:47:59 ozaki-r Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -147,8 +147,10 @@
#define IP_STAT_BADADDR 29 /* invalid address on header */
#define IP_STAT_NOL2TP 30 /* no match l2tp found */
#define IP_STAT_NOIPSEC 31 /* no match ipsec(4) found */
+#define IP_STAT_PFILDROP_IN 32 /* dropped by pfil (PFIL_IN) */
+#define IP_STAT_PFILDROP_OUT 33 /* dropped by pfil (PFIL_OUT) */
-#define IP_NSTATS 32
+#define IP_NSTATS 34
#ifdef _KERNEL
diff -r e2eb2360fe3c -r 2b30e8a230e9 sys/netinet6/ip6_forward.c
--- a/sys/netinet6/ip6_forward.c Mon May 13 05:04:17 2019 +0000
+++ b/sys/netinet6/ip6_forward.c Mon May 13 07:47:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_forward.c,v 1.95 2018/05/01 07:21:39 maxv Exp $ */
+/* $NetBSD: ip6_forward.c,v 1.96 2019/05/13 07:47:59 ozaki-r Exp $ */
/* $KAME: ip6_forward.c,v 1.109 2002/09/11 08:10:17 sakane Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.95 2018/05/01 07:21:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.96 2019/05/13 07:47:59 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_gateway.h"
@@ -393,10 +393,14 @@
* Run through list of hooks for output packets.
*/
if ((error = pfil_run_hooks(inet6_pfil_hook, &m, rt->rt_ifp,
- PFIL_OUT)) != 0)
+ PFIL_OUT)) != 0) {
+ IP6_STATINC(IP6_STAT_PFILDROP_OUT);
goto senderr;
- if (m == NULL)
+ }
+ if (m == NULL) {
+ IP6_STATINC(IP6_STAT_PFILDROP_OUT);
goto freecopy;
+ }
ip6 = mtod(m, struct ip6_hdr *);
error = ip6_if_output(rt->rt_ifp, origifp, m, dst, rt);
diff -r e2eb2360fe3c -r 2b30e8a230e9 sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c Mon May 13 05:04:17 2019 +0000
+++ b/sys/netinet6/ip6_input.c Mon May 13 07:47:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_input.c,v 1.207 2019/01/17 02:47:15 knakahara Exp $ */
+/* $NetBSD: ip6_input.c,v 1.208 2019/05/13 07:47:59 ozaki-r Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.207 2019/01/17 02:47:15 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.208 2019/05/13 07:47:59 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_gateway.h"
@@ -348,12 +348,14 @@
#endif
{
struct in6_addr odst;
+ int error;
odst = ip6->ip6_dst;
- if (pfil_run_hooks(inet6_pfil_hook, &m, rcvif, PFIL_IN) != 0)
+ error = pfil_run_hooks(inet6_pfil_hook, &m, rcvif, PFIL_IN);
+ if (error != 0 || m == NULL) {
+ IP6_STATINC(IP6_STAT_PFILDROP_IN);
return;
- if (m == NULL)
- return;
+ }
KASSERT(m->m_len >= sizeof(struct ip6_hdr));
ip6 = mtod(m, struct ip6_hdr *);
srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst);
diff -r e2eb2360fe3c -r 2b30e8a230e9 sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Mon May 13 05:04:17 2019 +0000
+++ b/sys/netinet6/ip6_output.c Mon May 13 07:47:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_output.c,v 1.218 2019/04/03 19:23:38 maxv Exp $ */
+/* $NetBSD: ip6_output.c,v 1.219 2019/05/13 07:47:59 ozaki-r Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.218 2019/04/03 19:23:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.219 2019/05/13 07:47:59 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -756,10 +756,11 @@
/*
* Run through list of hooks for output packets.
*/
- if ((error = pfil_run_hooks(inet6_pfil_hook, &m, ifp, PFIL_OUT)) != 0)
+ error = pfil_run_hooks(inet6_pfil_hook, &m, ifp, PFIL_OUT);
+ if (error != 0 || m == NULL) {
+ IP6_STATINC(IP6_STAT_PFILDROP_OUT);
goto done;
- if (m == NULL)
- goto done;
+ }
ip6 = mtod(m, struct ip6_hdr *);
/*
diff -r e2eb2360fe3c -r 2b30e8a230e9 sys/netinet6/ip6_var.h
--- a/sys/netinet6/ip6_var.h Mon May 13 05:04:17 2019 +0000
+++ b/sys/netinet6/ip6_var.h Mon May 13 07:47:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_var.h,v 1.81 2018/11/29 09:51:21 ozaki-r Exp $ */
+/* $NetBSD: ip6_var.h,v 1.82 2019/05/13 07:47:59 ozaki-r Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
@@ -186,8 +186,10 @@
#define IP6_STAT_FASTFORWARD 400 /* packets fast forwarded */
#define IP6_STAT_FASTFORWARDFLOWS 401 /* number of fast forward flows */
#define IP6_STAT_NOIPSEC 402 /* no match ipsec(4) found */
+#define IP6_STAT_PFILDROP_IN 403 /* dropped by pfil (PFIL_IN) */
+#define IP6_STAT_PFILDROP_OUT 404 /* dropped by pfil (PFIL_OUT) */
-#define IP6_NSTATS 403
+#define IP6_NSTATS 405
#define IP6FLOW_HASHBITS 6 /* should not be a multiple of 8 */
Home |
Main Index |
Thread Index |
Old Index