if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
+ if [ $HAS_PYYAML -ne 0 ]; then
+ n=$((n + 1))
+ echo_i "checking ednsopt LLQ prints as expected +yaml ($n)"
+ ret=0
+ dig_with_opts @10.53.0.3 +yaml +ednsopt=llq:0001000200001234567812345678fefefefe +qr a.example >dig.out.test$n 2>&1 || ret=1
+ $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS LLQ LLQ-VERSION >yamlget.out.test$n 2>&1 || ret=1
+ read -r value <yamlget.out.test$n
+ [ "$value" = "1" ] || ret=1
+ $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS LLQ LLQ-OPCODE >yamlget.out.test$n 2>&1 || ret=1
+ read -r value <yamlget.out.test$n
+ [ "$value" = "2" ] || ret=1
+ $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS LLQ LLQ-ERROR >yamlget.out.test$n 2>&1 || ret=1
+ read -r value <yamlget.out.test$n
+ [ "$value" = "0" ] || ret=1
+ $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS LLQ LLQ-ID >yamlget.out.test$n 2>&1 || ret=1
+ read -r value <yamlget.out.test$n
+ [ "$value" = "1311768465173141112" ] || ret=1
+ $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS LLQ LLQ-LEASE >yamlget.out.test$n 2>&1 || ret=1
+ read -r value <yamlget.out.test$n
+ [ "$value" = "4278124286" ] || ret=1
+ if [ $ret -ne 0 ]; then echo_i "failed"; fi
+ status=$((status + ret))
+ fi
+
n=$((n + 1))
echo_i "checking that dig warns about .local queries ($n)"
ret=0
}
static isc_result_t
-render_llq(isc_buffer_t *optbuf, isc_buffer_t *target) {
+render_llq(isc_buffer_t *optbuf, dns_message_t *msg,
+ const dns_master_style_t *style, isc_buffer_t *target) {
char buf[sizeof("18446744073709551615")]; /* 2^64-1 */
isc_result_t result = ISC_R_SUCCESS;
uint32_t u;
uint64_t q;
+ const char *sep1 = " ", *sep2 = ", ";
+ size_t count = msg->indent.count;
+ bool yaml = false;
+
+ if ((dns_master_styleflags(style) & DNS_STYLEFLAG_YAML) != 0) {
+ sep1 = sep2 = "\n";
+ msg->indent.count++;
+ yaml = true;
+ }
u = isc_buffer_getuint16(optbuf);
- ADD_STRING(target, " Version: ");
+ ADD_STRING(target, sep1);
+ INDENT(style);
+ if (yaml) {
+ ADD_STRING(target, "LLQ-VERSION: ");
+ } else {
+ ADD_STRING(target, "Version: ");
+ }
snprintf(buf, sizeof(buf), "%u", u);
ADD_STRING(target, buf);
u = isc_buffer_getuint16(optbuf);
- ADD_STRING(target, ", Opcode: ");
+ ADD_STRING(target, sep2);
+ INDENT(style);
+ if (yaml) {
+ ADD_STRING(target, "LLQ-OPCODE: ");
+ } else {
+ ADD_STRING(target, "Opcode: ");
+ }
snprintf(buf, sizeof(buf), "%u", u);
ADD_STRING(target, buf);
u = isc_buffer_getuint16(optbuf);
- ADD_STRING(target, ", Error: ");
+ ADD_STRING(target, sep2);
+ INDENT(style);
+ if (yaml) {
+ ADD_STRING(target, "LLQ-ERROR: ");
+ } else {
+ ADD_STRING(target, "Error: ");
+ }
snprintf(buf, sizeof(buf), "%u", u);
ADD_STRING(target, buf);
q = isc_buffer_getuint32(optbuf);
q <<= 32;
q |= isc_buffer_getuint32(optbuf);
- ADD_STRING(target, ", Identifier: ");
+ ADD_STRING(target, sep2);
+ INDENT(style);
+ if (yaml) {
+ ADD_STRING(target, "LLQ-ID: ");
+ } else {
+ ADD_STRING(target, "Identifier: ");
+ }
snprintf(buf, sizeof(buf), "%" PRIu64, q);
ADD_STRING(target, buf);
u = isc_buffer_getuint32(optbuf);
- ADD_STRING(target, ", Lifetime: ");
+ ADD_STRING(target, sep2);
+ INDENT(style);
+ if (yaml) {
+ ADD_STRING(target, "LLQ-LEASE: ");
+ } else {
+ ADD_STRING(target, "Lifetime: ");
+ }
snprintf(buf, sizeof(buf), "%u", u);
ADD_STRING(target, buf);
+
cleanup:
+ msg->indent.count = count;
return result;
}
switch (optcode) {
case DNS_OPT_LLQ:
if (optlen == 18U) {
- result = render_llq(&optbuf, target);
+ result = render_llq(&optbuf, msg, style,
+ target);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
switch (optcode) {
case DNS_OPT_LLQ:
if (optlen == 18U) {
- result = render_llq(&optbuf, target);
+ result = render_llq(&optbuf, msg, style,
+ target);
if (result != ISC_R_SUCCESS) {
return result;
}