From 47cb0632e8fd3fbc59f783c422a09db38d443300 Mon Sep 17 00:00:00 2001 From: Eugene Grosbein Date: Thu, 4 Jun 2020 14:15:39 +0000 Subject: [PATCH] ipfw: unbreak matching with big table type flow. Test case: # n=32769 # ipfw -q table 1 create type flow:proto,dst-ip,dst-port # jot -w 'table 1 add tcp,127.0.0.1,' $n 1 | ipfw -q /dev/stdin # ipfw -q add 5 unreach filter-prohib flow 'table(1)' The rule 5 matches nothing without the fix if n>=32769. With the fix, it works: # telnet localhost 10001 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Permission denied telnet: Unable to connect to remote host MFC after: 2 weeks Discussed with: ae, melifaro --- sys/netpfil/ipfw/ip_fw_table_algo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_fw_table_algo.c b/sys/netpfil/ipfw/ip_fw_table_algo.c index 2f329b6e121e..faf9472bac42 100644 --- a/sys/netpfil/ipfw/ip_fw_table_algo.c +++ b/sys/netpfil/ipfw/ip_fw_table_algo.c @@ -3204,7 +3204,8 @@ ta_lookup_fhash(struct table_info *ti, void *key, uint32_t keylen, struct fhashentry *ent; struct fhashentry4 *m4; struct ipfw_flow_id *id; - uint16_t hash, hsize; + uint32_t hsize; + uint16_t hash; id = (struct ipfw_flow_id *)key; head = (struct fhashbhead *)ti->state;