From: Pieter Lexis Date: Tue, 9 Feb 2021 16:07:52 +0000 (+0100) Subject: SVCB: support ipvNhints=auto in text parser and writer X-Git-Tag: dnsdist-1.6.0-rc1~33^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed34c66a692abcae970d681483c3896620986ea0;p=thirdparty%2Fpdns.git SVCB: support ipvNhints=auto in text parser and writer --- diff --git a/pdns/rcpgenerator.cc b/pdns/rcpgenerator.cc index e84a6588b0..3210231160 100644 --- a/pdns/rcpgenerator.cc +++ b/pdns/rcpgenerator.cc @@ -356,11 +356,19 @@ void RecordTextReader::xfrSvcParamKeyVals(set& val) vector value; xfrSVCBValueList(value); vector hints; + bool doAuto{false}; try { for (auto const &v: value) { + if (v == "auto") { + doAuto = true; + hints.clear(); + break; + } hints.push_back(ComboAddress(v)); } - val.insert(SvcParam(key, std::move(hints))); + auto p = SvcParam(key, std::move(hints)); + p.setAutoHint(doAuto); + val.insert(p); } catch (const std::invalid_argument& e) { throw RecordTextException(e.what()); @@ -781,6 +789,10 @@ void RecordTextWriter::xfrSvcParamKeyVals(const set& val) { case SvcParam::ipv4hint: /* fall-through */ case SvcParam::ipv6hint: // TODO use xfrCA and put commas in between? + if (param.getAutoHint()) { + d_string.append("auto"); + break; + } d_string.append(ComboAddress::caContainerToString(param.getIPHints(), false)); break; case SvcParam::alpn: