FreeBSD Bugzilla – Attachment 176410 Details for
Bug 209475
pf didn't check if enough free RAM for net.pf.states_hashsize
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
The latest patch with console and logging facility outputs
pf.c.diff.v3 (text/plain), 1.51 KB, created by
fehmi noyan isi
on 2016-11-02 08:09:35 UTC
(
hide
)
Description:
The latest patch with console and logging facility outputs
Filename:
MIME Type:
Creator:
fehmi noyan isi
Created:
2016-11-02 08:09:35 UTC
Size:
1.51 KB
patch
obsolete
>--- pf.c.orig 2016-10-30 12:20:23.834100000 +1300 >+++ ../plan3/pf.c.vm3 2016-11-02 20:15:08.147099000 +1300 >@@ -59,6 +59,7 @@ > #include <sys/sysctl.h> > #include <sys/taskqueue.h> > #include <sys/ucred.h> >+#include <sys/proc.h> > > #include <net/if.h> > #include <net/if_var.h> >@@ -777,12 +778,34 @@ > struct pf_keyhash *kh; > struct pf_idhash *ih; > struct pf_srchash *sh; >+ u_long hw_physmem; > u_int i; >- >- if (pf_hashsize == 0 || !powerof2(pf_hashsize)) >+ size_t size; >+ >+ /* Get the available hardware memory */ >+ size=sizeof(hw_physmem); >+ if (kernel_sysctlbyname(&thread0, "hw.physmem", &hw_physmem, \ >+ &size, 0, 0, 0, 0) != 0) >+ /* make the check against hw.physmem irrelevant */ >+ hw_physmem = ULONG_MAX; >+ >+ if (pf_hashsize == 0 || !powerof2(pf_hashsize) || \ >+ (pf_hashsize * sizeof(struct pf_keyhash)) > hw_physmem || \ >+ (pf_hashsize * sizeof(struct pf_idhash)) > hw_physmem){ >+ printf("pf: Invalid states hash table size : %lu. " >+ "Using the default value %lu.\n", >+ (unsigned long)pf_hashsize, >+ (unsigned long)PF_HASHSIZ); > pf_hashsize = PF_HASHSIZ; >- if (pf_srchashsize == 0 || !powerof2(pf_srchashsize)) >+ } >+ if (pf_srchashsize == 0 || !powerof2(pf_srchashsize) || \ >+ (pf_srchashsize * sizeof(struct pf_srchash)) > hw_physmem ){ >+ printf("pf: Invalid source node hash table size : %lu. " >+ "Using the default value %lu.\n", >+ (unsigned long)pf_srchashsize, >+ (unsigned long)(PF_HASHSIZ/4)); > pf_srchashsize = PF_HASHSIZ / 4; >+ } > > V_pf_hashseed = arc4random(); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 209475
:
170810
|
176410
|
190429
|
190476
|
190574