From 14dd43dcdf0f6b68157afd14680c1f4c087f8286 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 18 Feb 2011 20:49:20 -0800 Subject: [PATCH] kernel - Fix fairq, PF table hash was not being initialized * fairq depends on the PF table entry hash, which was not being initialized. * Fixes problems with fairq not queueing fairly. --- sys/net/pf/pf.c | 6 ++++++ sys/net/pf/pf_ioctl.c | 1 + 2 files changed, 7 insertions(+) diff --git a/sys/net/pf/pf.c b/sys/net/pf/pf.c index 086f7a3931..27ee67e9e0 100644 --- a/sys/net/pf/pf.c +++ b/sys/net/pf/pf.c @@ -846,6 +846,12 @@ pf_state_insert(struct pfi_kif *kif, struct pf_state_key *skw, s->id = htobe64(pf_status.stateid++); s->creatorid = pf_status.hostid; } + + /* + * Calculate hash code for altq + */ + s->hash = crc32(s->key[PF_SK_WIRE], sizeof(*sks)); + if (RB_INSERT(pf_state_tree_id, &tree_id, s) != NULL) { if (pf_status.debug >= PF_DEBUG_MISC) { kprintf("pf: state insert failed: " diff --git a/sys/net/pf/pf_ioctl.c b/sys/net/pf/pf_ioctl.c index 57716a9b4a..6c517817df 100644 --- a/sys/net/pf/pf_ioctl.c +++ b/sys/net/pf/pf_ioctl.c @@ -3317,6 +3317,7 @@ pf_unload(void) pf_maskhead->rnh_walktree(pf_maskhead, pf_mask_del, pf_maskhead); Free(pf_maskhead); + pf_maskhead = NULL; } return 0; } -- 2.41.0