From ad53010cd2efcfb2b27fe305c1f359a6a9cb09c3 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Tue, 2 May 2017 14:50:39 +0200 Subject: [PATCH] NSAP-PTR --- src/const-info.c | 1 + src/getdns/getdns.h.in | 1 + src/gldns/rrdef.c | 2 +- src/rr-dict.c | 8 +++++--- src/tools/getdns_query.c | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/const-info.c b/src/const-info.c index c78f4816..6f87eb62 100644 --- a/src/const-info.c +++ b/src/const-info.c @@ -283,6 +283,7 @@ static struct const_name_info consts_name_info[] = { { "GETDNS_RRTYPE_NINFO", 56 }, { "GETDNS_RRTYPE_NS", 2 }, { "GETDNS_RRTYPE_NSAP", 22 }, + { "GETDNS_RRTYPE_NSAP_PTR", 23 }, { "GETDNS_RRTYPE_NSEC", 47 }, { "GETDNS_RRTYPE_NULL", 10 }, { "GETDNS_RRTYPE_NXT", 30 }, diff --git a/src/getdns/getdns.h.in b/src/getdns/getdns.h.in index 0e85266e..f22e91da 100644 --- a/src/getdns/getdns.h.in +++ b/src/getdns/getdns.h.in @@ -377,6 +377,7 @@ typedef enum getdns_callback_type_t { #define GETDNS_RRTYPE_ISDN 20 #define GETDNS_RRTYPE_RT 21 #define GETDNS_RRTYPE_NSAP 22 +#define GETDNS_RRTYPE_NSAP_PTR 23 #define GETDNS_RRTYPE_SIG 24 #define GETDNS_RRTYPE_KEY 25 #define GETDNS_RRTYPE_PX 26 diff --git a/src/gldns/rrdef.c b/src/gldns/rrdef.c index 3d5a5961..6e6995a7 100644 --- a/src/gldns/rrdef.c +++ b/src/gldns/rrdef.c @@ -72,7 +72,7 @@ static const gldns_rdf_type type_nsap_wireformat[] = { GLDNS_RDF_TYPE_NSAP }; static const gldns_rdf_type type_nsap_ptr_wireformat[] = { - GLDNS_RDF_TYPE_STR + GLDNS_RDF_TYPE_DNAME }; static const gldns_rdf_type type_sig_wireformat[] = { GLDNS_RDF_TYPE_TYPE, GLDNS_RDF_TYPE_ALG, GLDNS_RDF_TYPE_INT8, GLDNS_RDF_TYPE_INT32, diff --git a/src/rr-dict.c b/src/rr-dict.c index 5fa46c43..129f28de 100644 --- a/src/rr-dict.c +++ b/src/rr-dict.c @@ -487,6 +487,8 @@ static _getdns_rdata_def rt_rdata[] = { { "intermediate_host" , GETDNS_RDF_N , NULL }}; static _getdns_rdata_def nsap_rdata[] = { { "nsap" , GETDNS_RDF_X , NULL }}; +static _getdns_rdata_def nsap_ptr_rdata[] = { + { "ptrdname" , GETDNS_RDF_N , NULL }}; static _getdns_rdata_def sig_rdata[] = { { "sig_obsolete" , GETDNS_RDF_X , NULL }}; static _getdns_rdata_def key_rdata[] = { @@ -675,9 +677,9 @@ static _getdns_rr_def _getdns_rr_defs[] = { { "X25", x25_rdata, ALEN( x25_rdata) }, { "ISDN", isdn_rdata, ALEN( isdn_rdata) }, { "RT", rt_rdata, ALEN( rt_rdata) }, - { "NSAP", nsap_rdata, ALEN( nsap_rdata) }, /* - 22 */ - { NULL, NULL, 0 }, - { "SIG", sig_rdata, ALEN( sig_rdata) }, /* 24 - */ + { "NSAP", nsap_rdata, ALEN( nsap_rdata) }, + { "NSAP_PTR", nsap_ptr_rdata, ALEN( nsap_ptr_rdata) }, + { "SIG", sig_rdata, ALEN( sig_rdata) }, { "KEY", key_rdata, ALEN( key_rdata) }, { "PX", px_rdata, ALEN( px_rdata) }, { "GPOS", gpos_rdata, ALEN( gpos_rdata) }, diff --git a/src/tools/getdns_query.c b/src/tools/getdns_query.c index 72eb19b2..ef7bd1b5 100644 --- a/src/tools/getdns_query.c +++ b/src/tools/getdns_query.c @@ -92,7 +92,7 @@ static int get_rrtype(const char *t) if (strlen(t) > sizeof(buf) - 15) return -1; for (i = 14; *t && i < sizeof(buf) - 1; i++, t++) - buf[i] = toupper(*t); + buf[i] = *t == '-' ? '_' : toupper(*t); buf[i] = '\0'; if (!getdns_str2int(buf, &rrtype))