svn commit: r236252 - projects/pf/head/sys/contrib/pf/net

Gleb Smirnoff glebius at FreeBSD.org
Tue May 29 19:46:43 UTC 2012


Author: glebius
Date: Tue May 29 19:46:42 2012
New Revision: 236252
URL: http://svn.freebsd.org/changeset/base/236252

Log:
  Restore crutch removed in r235991. When pf(4) is initialized at
  boot time, the time_second isn't initialized yet, and we need
  to workaround that. :(

Modified:
  projects/pf/head/sys/contrib/pf/net/pf_if.c

Modified: projects/pf/head/sys/contrib/pf/net/pf_if.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/pf_if.c	Tue May 29 18:44:53 2012	(r236251)
+++ projects/pf/head/sys/contrib/pf/net/pf_if.c	Tue May 29 19:46:42 2012	(r236252)
@@ -213,7 +213,14 @@ pfi_kif_attach(struct pfi_kif *kif, cons
 
 	bzero(kif, sizeof(*kif));
 	strlcpy(kif->pfik_name, kif_name, sizeof(kif->pfik_name));
-	kif->pfik_tzero = time_second;
+	/*
+	 * It seems that the value of time_second is in unintialzied state
+	 * when pf sets interface statistics clear time in boot phase if pf
+	 * was statically linked to kernel. Instead of setting the bogus
+	 * time value have pfi_get_ifaces handle this case. In
+	 * pfi_get_ifaces it uses time_second if it sees the time is 0.
+	 */
+        kif->pfik_tzero = time_second > 1 ? time_second : 0;
 	TAILQ_INIT(&kif->pfik_dynaddrs);
 
 	RB_INSERT(pfi_ifhead, &V_pfi_ifs, kif);


More information about the svn-src-projects mailing list