skip-cpp: true
parameters:
- name: "rcode"
- type: "u8"
+ type: "RCode"
+ rust-type: "String"
description: "The RCODE to respond with"
- name: "vars"
type: "ResponseConfig"
skip-cpp: true
parameters:
- name: "rcode"
- type: "u8"
+ type: "RCode"
+ rust-type: "String"
description: "The response code"
- name: "vars"
type: "ResponseConfig"
if inside_container:
return 'std::string'
return 'const std::string&'
+ if type_str == 'RCode':
+ return 'uint8_t'
return type_str
def get_cpp_object_name(name, is_class=True):
field = f'convertSVCRecordParameters({field})'
elif ptype == 'SOAParams':
field = f'convertSOAParams({field})'
+ elif ptype == 'RCode':
+ field = f'dnsdist::configuration::yaml::strToRCode("{struct_name}", "{name}", {field})'
output += field
return output
description: "Matches queries or responses with the specified rcode. The full 16bit RCode will be matched. If no EDNS OPT RR is present, the upper 12 bits are treated as 0"
parameters:
- name: "rcode"
- type: "u64"
+ type: "RCode"
+ rust-type: "String"
description: "The full 16bit RCode will be matched. If no EDNS OPT RR is present, the upper 12 bits are treated as 0"
- name: "HTTPHeader"
description: "Matches DNS over HTTPS queries with a HTTP header name whose content matches the supplied regular expression. It is necessary to set the ``keepIncomingHeaders`` to :func:`addDOHLocal()` to use this rule"
description: "Matches queries or responses with the specified rcode"
parameters:
- name: "rcode"
- type: "u64"
+ type: "RCode"
+ rust-type: "String"
description: "The response code, as a numerical value"
- name: "RD"
description: "Matches queries with the RD flag set"
Upgrade Guide
=============
+2.0.x to 2.1.0
+--------------
+
+Since 2.1.0, ``rcode``s in the ``YAML`` configuration can be specified either by their case-insensitive names (e.g. ``refused``), or by their numerical values (e.g. ``"5"``). Unfortunately in some contexts (:func:`RCodeRule`, :func:`ERCodeRule`, :func:`RCodeAction` and :func:`ERCodeAction`) this has a the side-effect that a numerical value (``5``) is no longer accepted and has to be converted to a string (``"5"``).
+
1.9.x to 2.0.0
--------------
qname: "refused.doh.tests.powerdns.com."
action:
type: "RCode"
- rcode: 5
+ rcode: "Refused"
- name: "Spoof"
selector:
type: "QName"
qname: "refused.doq.tests.powerdns.com."
action:
type: "RCode"
- rcode: 5
+ rcode: "Refused"
- name: "Spoof"
selector:
type: "QName"
qname: "refused.doq.tests.powerdns.com."
action:
type: "RCode"
- rcode: 5
+ rcode: "5"
- name: "Spoof"
selector:
type: "QName"
- "refused.yaml-lua-mix.test.powerdns.com."
action:
type: "RCode"
- rcode: 5
+ rcode: "Refused"
"""
_dnsDistPort = pickAvailablePort()