]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Fix the behaviour of `TagRule` with an empty string as value
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 22 May 2025 14:34:58 +0000 (16:34 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 22 May 2025 14:55:44 +0000 (16:55 +0200)
commit08ce46dbc75cc1470cbac4694bde81f1470f00e5
treef994406dec9f1003b6b1171855fdb848d4dc46b9
parentb836051de98a9e314e469e63fd190a54c0e0d358
dnsdist: Fix the behaviour of `TagRule` with an empty string as value

Before 2.0.0 passing an empty value to `TagRule` meant that only the
presence of the tag with an empty value would be accepted. That
behaviour changed when we introduced the YAML configuration format,
refactoring the selectors in the process, to instead mean that an
empty string meant that all values would be accepted, only the tag
presence being checked. This is an unfortunate side-effect of a
limitation of the `cxx` Rust <-> C++ interoperability layer that we
are using (lack of support for `Option<T>` <-> `std::optional<T>`,
namely). This PR fixes restores the exising behaviour by adding an
additional boolean to the YAML configuration, and ensuring that
passing an empty value to the Lua configuration is not treated as
not passing any value.
pdns/dnsdistdist/dnsdist-lua-rules.cc
pdns/dnsdistdist/dnsdist-lua-selectors-generated.cc
pdns/dnsdistdist/dnsdist-rules-factory.hh
pdns/dnsdistdist/dnsdist-rules-generator.py
pdns/dnsdistdist/dnsdist-rust-bridge-selectors-generated.cc
pdns/dnsdistdist/dnsdist-rust-lib/rust/src/lib.rs
pdns/dnsdistdist/dnsdist-selectors-definitions.yml
pdns/dnsdistdist/dnsdist-selectors-factory-generated.cc
pdns/dnsdistdist/dnsdist-selectors-factory-generated.hh