]> git.ipfire.org Git - thirdparty/iptables.git/commit
extensions: dccp: Fix for DCCP type 'INVALID'
authorPhil Sutter <phil@nwl.cc>
Wed, 2 Dec 2020 12:37:06 +0000 (13:37 +0100)
committerPhil Sutter <phil@nwl.cc>
Wed, 9 Dec 2020 09:27:31 +0000 (10:27 +0100)
commit4bcbc8e11a2764f4537dc405962f83cd072cccfe
tree70e064cdf529e3f6649e1af66d416d2686161e41
parent93d0c97e8b6713f51ba679e01a1338d4f9076e7c
extensions: dccp: Fix for DCCP type 'INVALID'

Support for matching on invalid DCCP type field values was pretty
broken: While RFC4340 declares any type value from 10 to 15 invalid, the
extension's type name 'INVALID' mapped to type value 10 only. Fix this
by introduction of INVALID_OTHER_TYPE_MASK which has the remaining
invalid type's bits set and apply it if bit 10 is set after parsing the
type list. When printing, stop searching type names after printing
'INVALID' - unless numeric output was requested. The latter prints all
actual type values. Since parsing types in numeric form is not
supported, changing the output should not break existing scripts.

When translating into nftables syntax, the code returned prematurely if
'INVALID' was among the list of types - thereby emitting invalid syntax.
Instead print a real match for invalid types by use of a range
expression.

While being at it, fix syntax of translator output: If only
'--dccp-types' was translated, the output contained an extra 'dccp'. On
the other hand, if '--sport' and '--dport' was present, a required
'dccp' between the translations of both was missing.

Fixes: e40b11d7ef827 ("add support for new 'dccp' protocol match")
Fixes: c94a998724143 ("extensions: libxt_dccp: Add translation to nft")
Signed-off-by: Phil Sutter <phil@nwl.cc>
extensions/libxt_dccp.c
extensions/libxt_dccp.txlate