Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109956419
D46927.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D46927.diff
View Options
diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c
--- a/sys/netpfil/pf/pf_table.c
+++ b/sys/netpfil/pf/pf_table.c
@@ -2245,7 +2245,7 @@
struct pf_addr addr, cur, mask, umask_addr;
union sockaddr_union uaddr, umask;
struct pfr_kentry *ke, *ke2 = NULL;
- int idx = -1, use_counter = 0;
+ int startidx, idx = -1, loop = 0, use_counter = 0;
MPASS(pidx != NULL);
MPASS(counter != NULL);
@@ -2272,18 +2272,29 @@
use_counter = 1;
if (idx < 0)
idx = 0;
+ startidx = idx;
_next_block:
- ke = pfr_kentry_byidx(kt, idx, af);
- if (ke == NULL) {
+ if (loop && startidx == idx) {
pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1);
return (1);
}
+
+ ke = pfr_kentry_byidx(kt, idx, af);
+ if (ke == NULL) {
+ /* we don't have this idx, try looping */
+ if (loop || (ke = pfr_kentry_byidx(kt, 0, af)) == NULL) {
+ pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1);
+ return (1);
+ }
+ idx = 0;
+ loop++;
+ }
pfr_prepare_network(&umask, af, ke->pfrke_net);
pfr_sockaddr_to_pf_addr(&ke->pfrke_sa, &cur);
pfr_sockaddr_to_pf_addr(&umask, &mask);
- if (use_counter) {
+ if (use_counter && !PF_AZERO(counter, af)) {
/* is supplied address within block? */
if (!PF_MATCHA(0, &cur, &mask, counter, af)) {
/* no, go to next block in table */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 12, 5:21 PM (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16613672
Default Alt Text
D46927.diff (1 KB)
Attached To
Mode
D46927: pf: ensure that we won't enter an endless loop
Attached
Detach File
Event Timeline
Log In to Comment