Module Name:    src
Committed By:   christos
Date:           Wed Jan 27 17:39:13 UTC 2021

Modified Files:
        src/sys/net/npf: npf_os.c

Log Message:
Don't silently ignore the errors from npfctl_run_op. We end up returning
packets to userland that are missing required fields (like in rule_add the
id of the rule) and npfctl aborts.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/net/npf/npf_os.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/npf/npf_os.c
diff -u src/sys/net/npf/npf_os.c:1.20 src/sys/net/npf/npf_os.c:1.21
--- src/sys/net/npf/npf_os.c:1.20	Mon Jan 25 12:17:19 2021
+++ src/sys/net/npf/npf_os.c	Wed Jan 27 12:39:13 2021
@@ -33,7 +33,7 @@
 
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.20 2021/01/25 17:17:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.21 2021/01/27 17:39:13 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pf.h"
@@ -298,8 +298,11 @@ npf_dev_ioctl(dev_t dev, u_long cmd, voi
 #endif
 	}
 	resp = nvlist_create(0);
-	npfctl_run_op(npf, cmd, req, resp);
-	error = nvlist_copyout(data, resp);
+
+	if ((error = npfctl_run_op(npf, cmd, req, resp)) == 0) {
+		error = nvlist_copyout(data, resp);
+	}
+
 	nvlist_destroy(resp);
 	nvlist_destroy(req);
 

Reply via email to