Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Skip pfil_run_hooks if no packet filter configured i...



details:   https://anonhg.NetBSD.org/src/rev/dd783c21d6e3
branches:  trunk
changeset: 1009592:dd783c21d6e3
user:      nat <nat%NetBSD.org@localhost>
date:      Mon Apr 27 23:05:31 2020 +0000

description:
Skip pfil_run_hooks if no packet filter configured in kernel.

diffstat:

 sys/net/pfil.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r fc6c249009cb -r dd783c21d6e3 sys/net/pfil.c
--- a/sys/net/pfil.c    Mon Apr 27 22:31:47 2020 +0000
+++ b/sys/net/pfil.c    Mon Apr 27 23:05:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.36 2020/02/01 02:54:31 riastradh Exp $      */
+/*     $NetBSD: pfil.c,v 1.37 2020/04/27 23:05:31 nat Exp $    */
 
 /*
  * Copyright (c) 2013 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.36 2020/02/01 02:54:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.37 2020/04/27 23:05:31 nat Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -398,6 +398,11 @@
        int ret = 0;
 
        KASSERT(dir == PFIL_IN || dir == PFIL_OUT);
+
+       if (__predict_false(ph == NULL)) {
+               return ret;
+       }
+
        if (__predict_false((phlistset = pfil_hook_get(dir, ph)) == NULL)) {
                return ret;
        }



Home | Main Index | Thread Index | Old Index