Summary: | ipfw lookup tables match on index instead of value | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Allan Jude <allanjude> | ||||
Component: | kern | Assignee: | Andrey V. Elsukov <ae> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Many People | CC: | cem, crest, ipfw, melifaro, rgrimes | ||||
Priority: | --- | Flags: | rgrimes:
mfc-stable11+
|
||||
Version: | CURRENT | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
Allan Jude
2017-02-21 02:19:33 UTC
Created attachment 180444 [details]
Proposed patch
Hi, can you test this patch? I think it should fix the problem.
I ran the tests Allan posted here against your patch on an 11.0p1 system and it indeed has fixed the problem. Please note that we need this and r307628 merged back to 11.0-stable and it would probably be a good idea to file an EN as this has a silent failure mode that allows unwanted packets through certain firewall types, though I doubt many are using the table,value mechanism it caused me a fair bit of trouble. A commit references this bug: Author: ae Date: Fri Mar 3 20:22:42 UTC 2017 New revision: 314614 URL: https://svnweb.freebsd.org/changeset/base/314614 Log: Fix matching table entry value. Use real table value instead of its index in valuestate array. When opcode has size equal to ipfw_insn_u32, this means that it should additionally match value specified in d[0] with table entry value. ipfw_table_lookup() returns table value index, use TARG_VAL() macro to convert it to its value. The actual 32-bit value stored in the tag field of table_value structure, where all unspecified u32 values are kept. PR: 217262 Reviewed by: melifaro MFC after: 1 week Sponsored by: Yandex LLC Changes: head/sys/netpfil/ipfw/ip_fw2.c A commit references this bug: Author: ae Date: Fri Mar 10 05:44:14 UTC 2017 New revision: 314990 URL: https://svnweb.freebsd.org/changeset/base/314990 Log: MFC r314614: Fix matching table entry value. Use real table value instead of its index in valuestate array. When opcode has size equal to ipfw_insn_u32, this means that it should additionally match value specified in d[0] with table entry value. ipfw_table_lookup() returns table value index, use TARG_VAL() macro to convert it to its value. The actual 32-bit value stored in the tag field of table_value structure, where all unspecified u32 values are kept. PR: 217262 Changes: _U stable/11/ stable/11/sys/netpfil/ipfw/ip_fw2.c |