Module Name: src
Committed By: christos
Date: Mon Apr 15 21:20:39 UTC 2013
Modified Files:
src/usr.bin/netstat: fast_ipsec.c
Log Message:
PR/47744: Frank Kardel: netstat -s stops output prematurely when ipsec is not
compiled.
If the first sysctl fails return silently.
XXX: pullup-6
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/netstat/fast_ipsec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/netstat/fast_ipsec.c
diff -u src/usr.bin/netstat/fast_ipsec.c:1.19 src/usr.bin/netstat/fast_ipsec.c:1.20
--- src/usr.bin/netstat/fast_ipsec.c:1.19 Thu Mar 22 16:34:43 2012
+++ src/usr.bin/netstat/fast_ipsec.c Mon Apr 15 17:20:39 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: fast_ipsec.c,v 1.19 2012/03/22 20:34:43 drochner Exp $ */
+/* $NetBSD: fast_ipsec.c,v 1.20 2013/04/15 21:20:39 christos Exp $ */
/* $FreeBSD: src/tools/tools/crypto/ipsecstats.c,v 1.1.4.1 2003/06/03 00:13:13 sam Exp $ */
/*-
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
#ifdef __NetBSD__
-__RCSID("$NetBSD: fast_ipsec.c,v 1.19 2012/03/22 20:34:43 drochner Exp $");
+__RCSID("$NetBSD: fast_ipsec.c,v 1.20 2013/04/15 21:20:39 christos Exp $");
#endif
#endif /* not lint*/
@@ -152,8 +152,12 @@ fast_ipsec_stats(u_long off, const char
slen = sizeof(ipsecstats);
status = sysctlbyname("net.inet.ipsec.ipsecstats", ipsecstats, &slen,
NULL, 0);
- if (status < 0 && errno != ENOMEM)
- err(1, "net.inet.ipsec.ipsecstats");
+ if (status < 0) {
+ if (errno == ENOENT)
+ return;
+ if (errno != ENOMEM)
+ err(1, "net.inet.ipsec.ipsecstats");
+ }
slen = sizeof (ahstats);
status = sysctlbyname("net.inet.ah.ah_stats", ahstats, &slen, NULL, 0);