Lines 59-64
Link Here
|
59 |
#include <sys/sysctl.h> |
59 |
#include <sys/sysctl.h> |
60 |
#include <sys/taskqueue.h> |
60 |
#include <sys/taskqueue.h> |
61 |
#include <sys/ucred.h> |
61 |
#include <sys/ucred.h> |
|
|
62 |
#include <sys/proc.h> |
62 |
|
63 |
|
63 |
#include <net/if.h> |
64 |
#include <net/if.h> |
64 |
#include <net/if_var.h> |
65 |
#include <net/if_var.h> |
Lines 776-786
Link Here
|
776 |
struct pf_keyhash *kh; |
777 |
struct pf_keyhash *kh; |
777 |
struct pf_idhash *ih; |
778 |
struct pf_idhash *ih; |
778 |
struct pf_srchash *sh; |
779 |
struct pf_srchash *sh; |
|
|
780 |
u_long hw_physmem; |
779 |
u_int i; |
781 |
u_int i; |
780 |
|
782 |
size_t size; |
781 |
if (pf_hashsize == 0 || !powerof2(pf_hashsize)) |
783 |
|
|
|
784 |
/* Get the available hardware memory */ |
785 |
size=sizeof(hw_physmem); |
786 |
if (kernel_sysctlbyname(&thread0, "hw.physmem", &hw_physmem, \ |
787 |
&size, 0, 0, 0, 0) != 0) |
788 |
/* make the check against hw.physmem irrelevant */ |
789 |
hw_physmem = ULONG_MAX; |
790 |
|
791 |
if (pf_hashsize == 0 || !powerof2(pf_hashsize) || \ |
792 |
(pf_hashsize * sizeof(struct pf_keyhash)) > hw_physmem || \ |
793 |
(pf_hashsize * sizeof(struct pf_idhash)) > hw_physmem) |
782 |
pf_hashsize = PF_HASHSIZ; |
794 |
pf_hashsize = PF_HASHSIZ; |
783 |
if (pf_srchashsize == 0 || !powerof2(pf_srchashsize)) |
795 |
if (pf_srchashsize == 0 || !powerof2(pf_srchashsize) || \ |
|
|
796 |
(pf_srchashsize * sizeof(struct pf_srchash)) > hw_physmem ) |
784 |
pf_srchashsize = PF_HASHSIZ / 4; |
797 |
pf_srchashsize = PF_HASHSIZ / 4; |
785 |
|
798 |
|
786 |
V_pf_hashseed = arc4random(); |
799 |
V_pf_hashseed = arc4random(); |