diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2020-02-24 17:44:46 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2020-02-24 17:44:46 +0000 |
commit | eabaa59838ffe0eb651c0f95336c23068c9b3e74 (patch) | |
tree | f6612ddd9128af33426138276827bdac242ef27e /usr.bin/dig | |
parent | b1a99024f5d5599fb958f56e3f88c01618140317 (diff) |
We only need to fill a wire format buffer from soa and tsig structs.
OK jsg
Diffstat (limited to 'usr.bin/dig')
81 files changed, 131 insertions, 1548 deletions
diff --git a/usr.bin/dig/dighost.c b/usr.bin/dig/dighost.c index 9ad9d15316f..a9677551334 100644 --- a/usr.bin/dig/dighost.c +++ b/usr.bin/dig/dighost.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.19 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: dighost.c,v 1.20 2020/02/24 17:44:44 florian Exp $ */ /*! \file * \note @@ -1894,10 +1894,10 @@ insert_soa(dig_lookup_t *lookup) { result = dns_message_gettemprdata(lookup->sendmsg, &rdata); check_result(result, "dns_message_gettemprdata"); - result = dns_rdata_fromstruct(rdata, lookup->rdclass, + result = dns_rdata_fromstruct_soa(rdata, lookup->rdclass, dns_rdatatype_soa, &soa, &lookup->rdatabuf); - check_result(result, "isc_rdata_fromstruct"); + check_result(result, "isc_rdata_fromstruct_soa"); result = dns_message_gettemprdatalist(lookup->sendmsg, &rdatalist); check_result(result, "dns_message_gettemprdatalist"); diff --git a/usr.bin/dig/lib/dns/gen.c b/usr.bin/dig/lib/dns/gen.c index 8b0f757a035..1409cfc5246 100644 --- a/usr.bin/dig/lib/dns/gen.c +++ b/usr.bin/dig/lib/dns/gen.c @@ -621,8 +621,6 @@ main(int argc, char **argv) { FROMWIRETYPE, FROMWIRECLASS, FROMWIREDEF); doswitch("TOWIRESWITCH", "towire", TOWIREARGS, TOWIRETYPE, TOWIRECLASS, TOWIREDEF); - doswitch("FROMSTRUCTSWITCH", "fromstruct", FROMSTRUCTARGS, - FROMSTRUCTTYPE, FROMSTRUCTCLASS, FROMSTRUCTDEF); doswitch("TOSTRUCTSWITCH", "tostruct", TOSTRUCTARGS, TOSTRUCTTYPE, TOSTRUCTCLASS, TOSTRUCTDEF); diff --git a/usr.bin/dig/lib/dns/include/dns/rdata.h b/usr.bin/dig/lib/dns/include/dns/rdata.h index e0124c7ed47..92a057c1561 100644 --- a/usr.bin/dig/lib/dns/include/dns/rdata.h +++ b/usr.bin/dig/lib/dns/include/dns/rdata.h @@ -359,8 +359,42 @@ dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin, unsigned int flags, */ isc_result_t -dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass, - dns_rdatatype_t type, void *source, isc_buffer_t *target); +dns_rdata_fromstruct_soa(dns_rdata_t *rdata, dns_rdataclass_t rdclass, + dns_rdatatype_t type, dns_rdata_soa_t *soa, + isc_buffer_t *target); +/*%< + * Convert the C structure representation of an rdata into uncompressed wire + * format in 'target'. + * + * XXX Should we have a 'size' parameter as a sanity check on target? + * + * Requires: + * + *\li 'rdclass' and 'type' are valid. + * + *\li 'source' points to a valid C struct for the class and type. + * + *\li 'target' is a valid buffer. + * + *\li All structure pointers to memory blocks should be NULL if their + * corresponding length values are zero. + * + * Ensures, + * if result is success: + * \li If 'rdata' is not NULL, it is attached to the target. + * + * \li The used space in 'target' is updated. + * + * Result: + *\li Success + *\li Various 'Bad Form' class failures depending on class and type + *\li Resource Limit: Not enough space + */ + +isc_result_t +dns_rdata_fromstruct_tsig(dns_rdata_t *rdata, dns_rdataclass_t rdclass, + dns_rdatatype_t type, dns_rdata_any_tsig_t *tsig, + isc_buffer_t *target); /*%< * Convert the C structure representation of an rdata into uncompressed wire * format in 'target'. diff --git a/usr.bin/dig/lib/dns/rdata.c b/usr.bin/dig/lib/dns/rdata.c index 848b21d34c7..9677ecba6d2 100644 --- a/usr.bin/dig/lib/dns/rdata.c +++ b/usr.bin/dig/lib/dns/rdata.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdata.c,v 1.19 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: rdata.c,v 1.20 2020/02/24 17:44:44 florian Exp $ */ /*! \file */ @@ -635,28 +635,56 @@ dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin, } isc_result_t -dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass, - dns_rdatatype_t type, void *source, +dns_rdata_fromstruct_soa(dns_rdata_t *rdata, dns_rdataclass_t rdclass, + dns_rdatatype_t type, dns_rdata_soa_t *soa, isc_buffer_t *target) { isc_result_t result = ISC_R_NOTIMPLEMENTED; isc_buffer_t st; isc_region_t region; - isc_boolean_t use_default = ISC_FALSE; unsigned int length; - REQUIRE(source != NULL); + REQUIRE(soa != NULL); if (rdata != NULL) { REQUIRE(DNS_RDATA_INITIALIZED(rdata)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); } st = *target; + result = fromstruct_soa(rdclass, type, soa, target); - FROMSTRUCTSWITCH + length = isc_buffer_usedlength(target) - isc_buffer_usedlength(&st); + if (result == ISC_R_SUCCESS && length > DNS_RDATA_MAXLENGTH) + result = ISC_R_NOSPACE; - if (use_default) - (void)NULL; + if (rdata != NULL && result == ISC_R_SUCCESS) { + region.base = isc_buffer_used(&st); + region.length = length; + dns_rdata_fromregion(rdata, rdclass, type, ®ion); + } + if (result != ISC_R_SUCCESS) + *target = st; + return (result); +} + +isc_result_t +dns_rdata_fromstruct_tsig(dns_rdata_t *rdata, dns_rdataclass_t rdclass, + dns_rdatatype_t type, dns_rdata_any_tsig_t *tsig, + isc_buffer_t *target) +{ + isc_result_t result = ISC_R_NOTIMPLEMENTED; + isc_buffer_t st; + isc_region_t region; + unsigned int length; + + REQUIRE(tsig != NULL); + if (rdata != NULL) { + REQUIRE(DNS_RDATA_INITIALIZED(rdata)); + REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); + } + + st = *target; + result = fromstruct_any_tsig(rdclass, type, tsig, target); length = isc_buffer_usedlength(target) - isc_buffer_usedlength(&st); if (result == ISC_R_SUCCESS && length > DNS_RDATA_MAXLENGTH) diff --git a/usr.bin/dig/lib/dns/rdata/ch_3/a_1.c b/usr.bin/dig/lib/dns/rdata/ch_3/a_1.c index d76c5c5edb5..0b252176af4 100644 --- a/usr.bin/dig/lib/dns/rdata/ch_3/a_1.c +++ b/usr.bin/dig/lib/dns/rdata/ch_3/a_1.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: a_1.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: a_1.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* by Bjorn.Victor@it.uu.se, 2005-05-07 */ /* Based on generic/soa_6.c and generic/mx_15.c */ @@ -118,24 +118,6 @@ towire_ch_a(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_ch_a(ARGS_FROMSTRUCT) { - dns_rdata_ch_a_t *a = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_a); - REQUIRE(source != NULL); - REQUIRE(a->common.rdtype == type); - REQUIRE(a->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&a->ch_addr_dom, ®ion); - RETERR(isc_buffer_copyregion(target, ®ion)); - - return (uint16_tobuffer(ntohs(a->ch_addr), target)); -} static inline isc_result_t tostruct_ch_a(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/afsdb_18.c b/usr.bin/dig/lib/dns/rdata/generic/afsdb_18.c index 5b0fb2d4de8..43468f01b1c 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/afsdb_18.c +++ b/usr.bin/dig/lib/dns/rdata/generic/afsdb_18.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: afsdb_18.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: afsdb_18.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* Reviewed: Wed Mar 15 14:59:00 PST 2000 by explorer */ @@ -103,23 +103,6 @@ towire_afsdb(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_afsdb(ARGS_FROMSTRUCT) { - dns_rdata_afsdb_t *afsdb = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_afsdb); - REQUIRE(source != NULL); - REQUIRE(afsdb->common.rdclass == rdclass); - REQUIRE(afsdb->common.rdtype == type); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(afsdb->subtype, target)); - dns_name_toregion(&afsdb->server, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_afsdb(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/avc_258.c b/usr.bin/dig/lib/dns/rdata/generic/avc_258.c index c9ca4bbbe9d..cca4607f473 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/avc_258.c +++ b/usr.bin/dig/lib/dns/rdata/generic/avc_258.c @@ -54,13 +54,6 @@ towire_avc(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_avc(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_avc); - - return (generic_fromstruct_txt(rdclass, type, source, target)); -} static inline isc_result_t tostruct_avc(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/caa_257.c b/usr.bin/dig/lib/dns/rdata/generic/caa_257.c index ab4c71eaec6..273ab9658e4 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/caa_257.c +++ b/usr.bin/dig/lib/dns/rdata/generic/caa_257.c @@ -131,49 +131,6 @@ towire_caa(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_caa(ARGS_FROMSTRUCT) { - dns_rdata_caa_t *caa = source; - isc_region_t region; - unsigned int i; - - REQUIRE(type == dns_rdatatype_caa); - REQUIRE(source != NULL); - REQUIRE(caa->common.rdtype == type); - REQUIRE(caa->common.rdclass == rdclass); - REQUIRE(caa->tag != NULL && caa->tag_len != 0); - REQUIRE(caa->value != NULL); - - UNUSED(type); - UNUSED(rdclass); - - /* - * Flags - */ - RETERR(uint8_tobuffer(caa->flags, target)); - - /* - * Tag length - */ - RETERR(uint8_tobuffer(caa->tag_len, target)); - - /* - * Tag - */ - region.base = caa->tag; - region.length = caa->tag_len; - for (i = 0; i < region.length; i++) - if (!alphanumeric[region.base[i]]) - RETERR(DNS_R_SYNTAX); - RETERR(isc_buffer_copyregion(target, ®ion)); - - /* - * Value - */ - region.base = caa->value; - region.length = caa->value_len; - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_caa(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/cdnskey_60.c b/usr.bin/dig/lib/dns/rdata/generic/cdnskey_60.c index de28e1d4265..4b14a09f52c 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/cdnskey_60.c +++ b/usr.bin/dig/lib/dns/rdata/generic/cdnskey_60.c @@ -55,13 +55,6 @@ towire_cdnskey(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_cdnskey(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_cdnskey); - - return (generic_fromstruct_key(rdclass, type, source, target)); -} static inline isc_result_t tostruct_cdnskey(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/cds_59.c b/usr.bin/dig/lib/dns/rdata/generic/cds_59.c index 5a70d8b59b4..e51746385a2 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/cds_59.c +++ b/usr.bin/dig/lib/dns/rdata/generic/cds_59.c @@ -57,13 +57,6 @@ towire_cds(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_cds(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_cds); - - return (generic_fromstruct_ds(rdclass, type, source, target)); -} static inline isc_result_t tostruct_cds(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/cert_37.c b/usr.bin/dig/lib/dns/rdata/generic/cert_37.c index 0ee8048df3e..320c7d32c16 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/cert_37.c +++ b/usr.bin/dig/lib/dns/rdata/generic/cert_37.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cert_37.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: cert_37.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* Reviewed: Wed Mar 15 21:14:32 EST 2000 by tale */ @@ -109,24 +109,6 @@ towire_cert(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_cert(ARGS_FROMSTRUCT) { - dns_rdata_cert_t *cert = source; - - REQUIRE(type == dns_rdatatype_cert); - REQUIRE(source != NULL); - REQUIRE(cert->common.rdtype == type); - REQUIRE(cert->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(cert->type, target)); - RETERR(uint16_tobuffer(cert->key_tag, target)); - RETERR(uint8_tobuffer(cert->algorithm, target)); - - return (mem_tobuffer(target, cert->certificate, cert->length)); -} static inline isc_result_t tostruct_cert(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/cname_5.c b/usr.bin/dig/lib/dns/rdata/generic/cname_5.c index 0a7e6d28c90..aebca83d465 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/cname_5.c +++ b/usr.bin/dig/lib/dns/rdata/generic/cname_5.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cname_5.c,v 1.5 2020/02/24 12:06:51 florian Exp $ */ +/* $Id: cname_5.c,v 1.6 2020/02/24 17:44:44 florian Exp $ */ /* reviewed: Wed Mar 15 16:48:45 PST 2000 by brister */ @@ -79,22 +79,6 @@ towire_cname(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_cname(ARGS_FROMSTRUCT) { - dns_rdata_cname_t *cname = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_cname); - REQUIRE(source != NULL); - REQUIRE(cname->common.rdtype == type); - REQUIRE(cname->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&cname->cname, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_cname(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/csync_62.c b/usr.bin/dig/lib/dns/rdata/generic/csync_62.c index 5c14895e2de..7712d65652f 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/csync_62.c +++ b/usr.bin/dig/lib/dns/rdata/generic/csync_62.c @@ -96,28 +96,6 @@ towire_csync(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_csync(ARGS_FROMSTRUCT) { - dns_rdata_csync_t *csync = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_csync); - REQUIRE(source != NULL); - REQUIRE(csync->common.rdtype == type); - REQUIRE(csync->common.rdclass == rdclass); - REQUIRE(csync->typebits != NULL || csync->len == 0); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint32_tobuffer(csync->serial, target)); - RETERR(uint16_tobuffer(csync->flags, target)); - - region.base = csync->typebits; - region.length = csync->len; - RETERR(typemap_test(®ion, ISC_TRUE)); - return (mem_tobuffer(target, csync->typebits, csync->len)); -} static inline isc_result_t tostruct_csync(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/dlv_32769.c b/usr.bin/dig/lib/dns/rdata/generic/dlv_32769.c index 914fa0cb508..cb8a205831d 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/dlv_32769.c +++ b/usr.bin/dig/lib/dns/rdata/generic/dlv_32769.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dlv_32769.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: dlv_32769.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* RFC3658 */ @@ -59,13 +59,6 @@ towire_dlv(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_dlv(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_dlv); - - return (generic_fromstruct_ds(rdclass, type, source, target)); -} static inline isc_result_t tostruct_dlv(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/dname_39.c b/usr.bin/dig/lib/dns/rdata/generic/dname_39.c index b19fc34dc88..b8e79510712 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/dname_39.c +++ b/usr.bin/dig/lib/dns/rdata/generic/dname_39.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dname_39.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: dname_39.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* Reviewed: Wed Mar 15 16:52:38 PST 2000 by explorer */ @@ -79,22 +79,6 @@ towire_dname(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_dname(ARGS_FROMSTRUCT) { - dns_rdata_dname_t *dname = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_dname); - REQUIRE(source != NULL); - REQUIRE(dname->common.rdtype == type); - REQUIRE(dname->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&dname->dname, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_dname(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/dnskey_48.c b/usr.bin/dig/lib/dns/rdata/generic/dnskey_48.c index 93bf67df5bb..216dced5c3b 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/dnskey_48.c +++ b/usr.bin/dig/lib/dns/rdata/generic/dnskey_48.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnskey_48.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: dnskey_48.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley. @@ -62,13 +62,6 @@ towire_dnskey(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_dnskey(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_dnskey); - - return (generic_fromstruct_key(rdclass, type, source, target)); -} static inline isc_result_t tostruct_dnskey(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/doa_259.c b/usr.bin/dig/lib/dns/rdata/generic/doa_259.c index 1743c954511..b453017e7eb 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/doa_259.c +++ b/usr.bin/dig/lib/dns/rdata/generic/doa_259.c @@ -119,22 +119,6 @@ towire_doa(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_doa(ARGS_FROMSTRUCT) { - dns_rdata_doa_t *doa = source; - - REQUIRE(type == dns_rdatatype_doa); - REQUIRE(source != NULL); - REQUIRE(doa->common.rdtype == dns_rdatatype_doa); - REQUIRE(doa->common.rdclass == rdclass); - - RETERR(uint32_tobuffer(doa->enterprise, target)); - RETERR(uint32_tobuffer(doa->type, target)); - RETERR(uint8_tobuffer(doa->location, target)); - RETERR(uint8_tobuffer(doa->mediatype_len, target)); - RETERR(mem_tobuffer(target, doa->mediatype, doa->mediatype_len)); - return (mem_tobuffer(target, doa->data, doa->data_len)); -} static inline isc_result_t tostruct_doa(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/ds_43.c b/usr.bin/dig/lib/dns/rdata/generic/ds_43.c index f28590c5dcc..3d88551baa1 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ds_43.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ds_43.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ds_43.c,v 1.7 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: ds_43.c,v 1.8 2020/02/24 17:44:44 florian Exp $ */ /* RFC3658 */ @@ -184,13 +184,6 @@ generic_fromstruct_ds(ARGS_FROMSTRUCT) { return (mem_tobuffer(target, ds->digest, ds->length)); } -static inline isc_result_t -fromstruct_ds(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_ds); - - return (generic_fromstruct_ds(rdclass, type, source, target)); -} static inline isc_result_t generic_tostruct_ds(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/eui48_108.c b/usr.bin/dig/lib/dns/rdata/generic/eui48_108.c index 752b475207c..d2aa2f90a2a 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/eui48_108.c +++ b/usr.bin/dig/lib/dns/rdata/generic/eui48_108.c @@ -66,20 +66,6 @@ towire_eui48(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_eui48(ARGS_FROMSTRUCT) { - dns_rdata_eui48_t *eui48 = source; - - REQUIRE(type == dns_rdatatype_eui48); - REQUIRE(source != NULL); - REQUIRE(eui48->common.rdtype == type); - REQUIRE(eui48->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - return (mem_tobuffer(target, eui48->eui48, sizeof(eui48->eui48))); -} static inline isc_result_t tostruct_eui48(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/eui64_109.c b/usr.bin/dig/lib/dns/rdata/generic/eui64_109.c index a56aa3d3c69..ca275a905f2 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/eui64_109.c +++ b/usr.bin/dig/lib/dns/rdata/generic/eui64_109.c @@ -69,20 +69,6 @@ towire_eui64(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_eui64(ARGS_FROMSTRUCT) { - dns_rdata_eui64_t *eui64 = source; - - REQUIRE(type == dns_rdatatype_eui64); - REQUIRE(source != NULL); - REQUIRE(eui64->common.rdtype == type); - REQUIRE(eui64->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - return (mem_tobuffer(target, eui64->eui64, sizeof(eui64->eui64))); -} static inline isc_result_t tostruct_eui64(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/gpos_27.c b/usr.bin/dig/lib/dns/rdata/generic/gpos_27.c index 0c906608867..f0d6c1f321f 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/gpos_27.c +++ b/usr.bin/dig/lib/dns/rdata/generic/gpos_27.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: gpos_27.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: gpos_27.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* reviewed: Wed Mar 15 16:48:45 PST 2000 by brister */ @@ -74,25 +74,6 @@ towire_gpos(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_gpos(ARGS_FROMSTRUCT) { - dns_rdata_gpos_t *gpos = source; - - REQUIRE(type == dns_rdatatype_gpos); - REQUIRE(source != NULL); - REQUIRE(gpos->common.rdtype == type); - REQUIRE(gpos->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint8_tobuffer(gpos->long_len, target)); - RETERR(mem_tobuffer(target, gpos->longitude, gpos->long_len)); - RETERR(uint8_tobuffer(gpos->lat_len, target)); - RETERR(mem_tobuffer(target, gpos->latitude, gpos->lat_len)); - RETERR(uint8_tobuffer(gpos->alt_len, target)); - return (mem_tobuffer(target, gpos->altitude, gpos->alt_len)); -} static inline isc_result_t tostruct_gpos(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/hinfo_13.c b/usr.bin/dig/lib/dns/rdata/generic/hinfo_13.c index 74dec947fe8..07825cae16b 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/hinfo_13.c +++ b/usr.bin/dig/lib/dns/rdata/generic/hinfo_13.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hinfo_13.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: hinfo_13.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley. @@ -66,23 +66,6 @@ towire_hinfo(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_hinfo(ARGS_FROMSTRUCT) { - dns_rdata_hinfo_t *hinfo = source; - - REQUIRE(type == dns_rdatatype_hinfo); - REQUIRE(source != NULL); - REQUIRE(hinfo->common.rdtype == type); - REQUIRE(hinfo->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint8_tobuffer(hinfo->cpu_len, target)); - RETERR(mem_tobuffer(target, hinfo->cpu, hinfo->cpu_len)); - RETERR(uint8_tobuffer(hinfo->os_len, target)); - return (mem_tobuffer(target, hinfo->os, hinfo->os_len)); -} static inline isc_result_t tostruct_hinfo(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/hip_55.c b/usr.bin/dig/lib/dns/rdata/generic/hip_55.c index 53802294989..fd79364cf16 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/hip_55.c +++ b/usr.bin/dig/lib/dns/rdata/generic/hip_55.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hip_55.c,v 1.7 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: hip_55.c,v 1.8 2020/02/24 17:44:44 florian Exp $ */ /* reviewed: TBC */ @@ -146,38 +146,6 @@ towire_hip(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_hip(ARGS_FROMSTRUCT) { - dns_rdata_hip_t *hip = source; - dns_rdata_hip_t myhip; - isc_result_t result; - - REQUIRE(type == dns_rdatatype_hip); - REQUIRE(source != NULL); - REQUIRE(hip->common.rdtype == type); - REQUIRE(hip->common.rdclass == rdclass); - REQUIRE(hip->hit_len > 0 && hip->hit != NULL); - REQUIRE(hip->key_len > 0 && hip->key != NULL); - REQUIRE((hip->servers == NULL && hip->servers_len == 0) || - (hip->servers != NULL && hip->servers_len != 0)); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint8_tobuffer(hip->hit_len, target)); - RETERR(uint8_tobuffer(hip->algorithm, target)); - RETERR(uint16_tobuffer(hip->key_len, target)); - RETERR(mem_tobuffer(target, hip->hit, hip->hit_len)); - RETERR(mem_tobuffer(target, hip->key, hip->key_len)); - - myhip = *hip; - for (result = dns_rdata_hip_first(&myhip); - result == ISC_R_SUCCESS; - result = dns_rdata_hip_next(&myhip)) - /* empty */; - - return(mem_tobuffer(target, hip->servers, hip->servers_len)); -} static inline isc_result_t tostruct_hip(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/ipseckey_45.c b/usr.bin/dig/lib/dns/rdata/generic/ipseckey_45.c index 14f08d04782..4bb9dfb54aa 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ipseckey_45.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ipseckey_45.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ipseckey_45.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: ipseckey_45.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ #ifndef RDATA_GENERIC_IPSECKEY_45_C #define RDATA_GENERIC_IPSECKEY_45_C @@ -173,48 +173,6 @@ towire_ipseckey(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_ipseckey(ARGS_FROMSTRUCT) { - dns_rdata_ipseckey_t *ipseckey = source; - isc_region_t region; - uint32_t n; - - REQUIRE(type == dns_rdatatype_ipseckey); - REQUIRE(source != NULL); - REQUIRE(ipseckey->common.rdtype == type); - REQUIRE(ipseckey->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - if (ipseckey->gateway_type > 3U) - return (ISC_R_NOTIMPLEMENTED); - - RETERR(uint8_tobuffer(ipseckey->precedence, target)); - RETERR(uint8_tobuffer(ipseckey->gateway_type, target)); - RETERR(uint8_tobuffer(ipseckey->algorithm, target)); - - switch (ipseckey->gateway_type) { - case 0: - break; - - case 1: - n = ntohl(ipseckey->in_addr.s_addr); - RETERR(uint32_tobuffer(n, target)); - break; - - case 2: - RETERR(mem_tobuffer(target, ipseckey->in6_addr.s6_addr, 16)); - break; - - case 3: - dns_name_toregion(&ipseckey->gateway, ®ion); - RETERR(isc_buffer_copyregion(target, ®ion)); - break; - } - - return (mem_tobuffer(target, ipseckey->key, ipseckey->keylength)); -} static inline isc_result_t tostruct_ipseckey(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/isdn_20.c b/usr.bin/dig/lib/dns/rdata/generic/isdn_20.c index b2a5b515d5d..ca7ce730e10 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/isdn_20.c +++ b/usr.bin/dig/lib/dns/rdata/generic/isdn_20.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: isdn_20.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: isdn_20.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* Reviewed: Wed Mar 15 16:53:11 PST 2000 by bwelling */ @@ -68,25 +68,6 @@ towire_isdn(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_isdn(ARGS_FROMSTRUCT) { - dns_rdata_isdn_t *isdn = source; - - REQUIRE(type == dns_rdatatype_isdn); - REQUIRE(source != NULL); - REQUIRE(isdn->common.rdtype == type); - REQUIRE(isdn->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint8_tobuffer(isdn->isdn_len, target)); - RETERR(mem_tobuffer(target, isdn->isdn, isdn->isdn_len)); - if (isdn->subaddress == NULL) - return (ISC_R_SUCCESS); - RETERR(uint8_tobuffer(isdn->subaddress_len, target)); - return (mem_tobuffer(target, isdn->subaddress, isdn->subaddress_len)); -} static inline isc_result_t tostruct_isdn(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/key_25.c b/usr.bin/dig/lib/dns/rdata/generic/key_25.c index 5dcd2adaea6..1fb9c463efb 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/key_25.c +++ b/usr.bin/dig/lib/dns/rdata/generic/key_25.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: key_25.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: key_25.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley. @@ -276,13 +276,6 @@ generic_freestruct_key(ARGS_FREESTRUCT) { free(key->data); } -static inline isc_result_t -fromstruct_key(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_key); - - return (generic_fromstruct_key(rdclass, type, source, target)); -} static inline isc_result_t tostruct_key(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c b/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c index 1c5aa4cf0a5..e45e42f0839 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c +++ b/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c @@ -222,39 +222,6 @@ towire_keydata(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_keydata(ARGS_FROMSTRUCT) { - dns_rdata_keydata_t *keydata = source; - - REQUIRE(type == dns_rdatatype_keydata); - REQUIRE(source != NULL); - REQUIRE(keydata->common.rdtype == type); - REQUIRE(keydata->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - /* Refresh timer */ - RETERR(uint32_tobuffer(keydata->refresh, target)); - - /* Add hold-down */ - RETERR(uint32_tobuffer(keydata->addhd, target)); - - /* Remove hold-down */ - RETERR(uint32_tobuffer(keydata->removehd, target)); - - /* Flags */ - RETERR(uint16_tobuffer(keydata->flags, target)); - - /* Protocol */ - RETERR(uint8_tobuffer(keydata->protocol, target)); - - /* Algorithm */ - RETERR(uint8_tobuffer(keydata->algorithm, target)); - - /* Data */ - return (mem_tobuffer(target, keydata->data, keydata->datalen)); -} static inline isc_result_t tostruct_keydata(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/l32_105.c b/usr.bin/dig/lib/dns/rdata/generic/l32_105.c index b453ffdc2ff..9f69b3964b8 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/l32_105.c +++ b/usr.bin/dig/lib/dns/rdata/generic/l32_105.c @@ -75,23 +75,6 @@ towire_l32(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_l32(ARGS_FROMSTRUCT) { - dns_rdata_l32_t *l32 = source; - uint32_t n; - - REQUIRE(type == dns_rdatatype_l32); - REQUIRE(source != NULL); - REQUIRE(l32->common.rdtype == type); - REQUIRE(l32->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(l32->pref, target)); - n = ntohl(l32->l32.s_addr); - return (uint32_tobuffer(n, target)); -} static inline isc_result_t tostruct_l32(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/l64_106.c b/usr.bin/dig/lib/dns/rdata/generic/l64_106.c index db75bd992fc..eb39aa7a9fb 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/l64_106.c +++ b/usr.bin/dig/lib/dns/rdata/generic/l64_106.c @@ -80,21 +80,6 @@ towire_l64(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_l64(ARGS_FROMSTRUCT) { - dns_rdata_l64_t *l64 = source; - - REQUIRE(type == dns_rdatatype_l64); - REQUIRE(source != NULL); - REQUIRE(l64->common.rdtype == type); - REQUIRE(l64->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(l64->pref, target)); - return (mem_tobuffer(target, l64->l64, sizeof(l64->l64))); -} static inline isc_result_t tostruct_l64(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/loc_29.c b/usr.bin/dig/lib/dns/rdata/generic/loc_29.c index 10e810afc63..8c55a875baa 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/loc_29.c +++ b/usr.bin/dig/lib/dns/rdata/generic/loc_29.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: loc_29.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: loc_29.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ /* Reviewed: Wed Mar 15 18:13:09 PST 2000 by explorer */ @@ -230,49 +230,6 @@ towire_loc(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_loc(ARGS_FROMSTRUCT) { - dns_rdata_loc_t *loc = source; - uint8_t c; - - REQUIRE(type == dns_rdatatype_loc); - REQUIRE(source != NULL); - REQUIRE(loc->common.rdtype == type); - REQUIRE(loc->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - if (loc->v.v0.version != 0) - return (ISC_R_NOTIMPLEMENTED); - RETERR(uint8_tobuffer(loc->v.v0.version, target)); - - c = loc->v.v0.size; - if ((c&0xf) > 9 || ((c>>4)&0xf) > 9 || ((c>>4)&0xf) == 0) - return (ISC_R_RANGE); - RETERR(uint8_tobuffer(loc->v.v0.size, target)); - - c = loc->v.v0.horizontal; - if ((c&0xf) > 9 || ((c>>4)&0xf) > 9 || ((c>>4)&0xf) == 0) - return (ISC_R_RANGE); - RETERR(uint8_tobuffer(loc->v.v0.horizontal, target)); - - c = loc->v.v0.vertical; - if ((c&0xf) > 9 || ((c>>4)&0xf) > 9 || ((c>>4)&0xf) == 0) - return (ISC_R_RANGE); - RETERR(uint8_tobuffer(loc->v.v0.vertical, target)); - - if (loc->v.v0.latitude < (0x80000000UL - 90 * 3600000) || - loc->v.v0.latitude > (0x80000000UL + 90 * 3600000)) - return (ISC_R_RANGE); - RETERR(uint32_tobuffer(loc->v.v0.latitude, target)); - - if (loc->v.v0.longitude < (0x80000000UL - 180 * 3600000) || - loc->v.v0.longitude > (0x80000000UL + 180 * 3600000)) - return (ISC_R_RANGE); - RETERR(uint32_tobuffer(loc->v.v0.longitude, target)); - return (uint32_tobuffer(loc->v.v0.altitude, target)); -} static inline isc_result_t tostruct_loc(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/lp_107.c b/usr.bin/dig/lib/dns/rdata/generic/lp_107.c index e5faa635329..6e4b8e67dc9 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/lp_107.c +++ b/usr.bin/dig/lib/dns/rdata/generic/lp_107.c @@ -85,23 +85,6 @@ towire_lp(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_lp(ARGS_FROMSTRUCT) { - dns_rdata_lp_t *lp = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_lp); - REQUIRE(source != NULL); - REQUIRE(lp->common.rdtype == type); - REQUIRE(lp->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(lp->pref, target)); - dns_name_toregion(&lp->lp, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_lp(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/mb_7.c b/usr.bin/dig/lib/dns/rdata/generic/mb_7.c index 378ff53adcf..ef1a0b1d765 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mb_7.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mb_7.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mb_7.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: mb_7.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Wed Mar 15 17:31:26 PST 2000 by bwelling */ @@ -78,22 +78,6 @@ towire_mb(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_mb(ARGS_FROMSTRUCT) { - dns_rdata_mb_t *mb = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_mb); - REQUIRE(source != NULL); - REQUIRE(mb->common.rdtype == type); - REQUIRE(mb->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&mb->mb, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_mb(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/md_3.c b/usr.bin/dig/lib/dns/rdata/generic/md_3.c index 14e6acf149b..cdfd7020d2c 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/md_3.c +++ b/usr.bin/dig/lib/dns/rdata/generic/md_3.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: md_3.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: md_3.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Wed Mar 15 17:48:20 PST 2000 by bwelling */ @@ -78,22 +78,6 @@ towire_md(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_md(ARGS_FROMSTRUCT) { - dns_rdata_md_t *md = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_md); - REQUIRE(source != NULL); - REQUIRE(md->common.rdtype == type); - REQUIRE(md->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&md->md, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_md(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/mf_4.c b/usr.bin/dig/lib/dns/rdata/generic/mf_4.c index f06d1d2b1db..3fd8a7196a9 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mf_4.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mf_4.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mf_4.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: mf_4.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* reviewed: Wed Mar 15 17:47:33 PST 2000 by brister */ @@ -78,22 +78,6 @@ towire_mf(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_mf(ARGS_FROMSTRUCT) { - dns_rdata_mf_t *mf = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_mf); - REQUIRE(source != NULL); - REQUIRE(mf->common.rdtype == type); - REQUIRE(mf->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&mf->mf, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_mf(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/mg_8.c b/usr.bin/dig/lib/dns/rdata/generic/mg_8.c index c937db204dd..8c27a8b0673 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mg_8.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mg_8.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mg_8.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: mg_8.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* reviewed: Wed Mar 15 17:49:21 PST 2000 by brister */ @@ -78,22 +78,6 @@ towire_mg(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_mg(ARGS_FROMSTRUCT) { - dns_rdata_mg_t *mg = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_mg); - REQUIRE(source != NULL); - REQUIRE(mg->common.rdtype == type); - REQUIRE(mg->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&mg->mg, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_mg(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/minfo_14.c b/usr.bin/dig/lib/dns/rdata/generic/minfo_14.c index 9074cbc62ce..43eb43179b5 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/minfo_14.c +++ b/usr.bin/dig/lib/dns/rdata/generic/minfo_14.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: minfo_14.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: minfo_14.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* reviewed: Wed Mar 15 17:45:32 PST 2000 by brister */ @@ -105,24 +105,6 @@ towire_minfo(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_minfo(ARGS_FROMSTRUCT) { - dns_rdata_minfo_t *minfo = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_minfo); - REQUIRE(source != NULL); - REQUIRE(minfo->common.rdtype == type); - REQUIRE(minfo->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&minfo->rmailbox, ®ion); - RETERR(isc_buffer_copyregion(target, ®ion)); - dns_name_toregion(&minfo->emailbox, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_minfo(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/mr_9.c b/usr.bin/dig/lib/dns/rdata/generic/mr_9.c index 659d75ca557..c302f71727f 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mr_9.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mr_9.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mr_9.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: mr_9.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Wed Mar 15 21:30:35 EST 2000 by tale */ @@ -78,22 +78,6 @@ towire_mr(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_mr(ARGS_FROMSTRUCT) { - dns_rdata_mr_t *mr = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_mr); - REQUIRE(source != NULL); - REQUIRE(mr->common.rdtype == type); - REQUIRE(mr->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&mr->mr, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_mr(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/mx_15.c b/usr.bin/dig/lib/dns/rdata/generic/mx_15.c index fde047fd0e1..5cd72d74ddf 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mx_15.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mx_15.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mx_15.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: mx_15.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* reviewed: Wed Mar 15 18:05:46 PST 2000 by brister */ @@ -99,23 +99,6 @@ towire_mx(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_mx(ARGS_FROMSTRUCT) { - dns_rdata_mx_t *mx = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_mx); - REQUIRE(source != NULL); - REQUIRE(mx->common.rdtype == type); - REQUIRE(mx->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(mx->pref, target)); - dns_name_toregion(&mx->mx, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_mx(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/naptr_35.c b/usr.bin/dig/lib/dns/rdata/generic/naptr_35.c index b6652544a03..e32df26ac2b 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/naptr_35.c +++ b/usr.bin/dig/lib/dns/rdata/generic/naptr_35.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: naptr_35.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: naptr_35.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */ @@ -271,33 +271,6 @@ towire_naptr(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_naptr(ARGS_FROMSTRUCT) { - dns_rdata_naptr_t *naptr = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_naptr); - REQUIRE(source != NULL); - REQUIRE(naptr->common.rdtype == type); - REQUIRE(naptr->common.rdclass == rdclass); - REQUIRE(naptr->flags != NULL || naptr->flags_len == 0); - REQUIRE(naptr->service != NULL || naptr->service_len == 0); - REQUIRE(naptr->regexp != NULL || naptr->regexp_len == 0); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(naptr->order, target)); - RETERR(uint16_tobuffer(naptr->preference, target)); - RETERR(uint8_tobuffer(naptr->flags_len, target)); - RETERR(mem_tobuffer(target, naptr->flags, naptr->flags_len)); - RETERR(uint8_tobuffer(naptr->service_len, target)); - RETERR(mem_tobuffer(target, naptr->service, naptr->service_len)); - RETERR(uint8_tobuffer(naptr->regexp_len, target)); - RETERR(mem_tobuffer(target, naptr->regexp, naptr->regexp_len)); - dns_name_toregion(&naptr->replacement, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_naptr(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/nid_104.c b/usr.bin/dig/lib/dns/rdata/generic/nid_104.c index 0e4528d20e8..5894fa02ea3 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nid_104.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nid_104.c @@ -80,21 +80,6 @@ towire_nid(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_nid(ARGS_FROMSTRUCT) { - dns_rdata_nid_t *nid = source; - - REQUIRE(type == dns_rdatatype_nid); - REQUIRE(source != NULL); - REQUIRE(nid->common.rdtype == type); - REQUIRE(nid->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(nid->pref, target)); - return (mem_tobuffer(target, nid->nid, sizeof(nid->nid))); -} static inline isc_result_t tostruct_nid(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/ninfo_56.c b/usr.bin/dig/lib/dns/rdata/generic/ninfo_56.c index 4c541d44db4..6b6d6593833 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ninfo_56.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ninfo_56.c @@ -54,13 +54,6 @@ towire_ninfo(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_ninfo(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_ninfo); - - return (generic_fromstruct_txt(rdclass, type, source, target)); -} static inline isc_result_t tostruct_ninfo(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/ns_2.c b/usr.bin/dig/lib/dns/rdata/generic/ns_2.c index fe6f206b1bb..25f6f9c739b 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ns_2.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ns_2.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ns_2.c,v 1.5 2020/02/24 12:06:51 florian Exp $ */ +/* $Id: ns_2.c,v 1.6 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Wed Mar 15 18:15:00 PST 2000 by bwelling */ @@ -78,22 +78,6 @@ towire_ns(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_ns(ARGS_FROMSTRUCT) { - dns_rdata_ns_t *ns = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_ns); - REQUIRE(source != NULL); - REQUIRE(ns->common.rdtype == type); - REQUIRE(ns->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&ns->name, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_ns(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/nsec3_50.c b/usr.bin/dig/lib/dns/rdata/generic/nsec3_50.c index f86609a382b..ca76bb9c8c7 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nsec3_50.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nsec3_50.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec3_50.c,v 1.5 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: nsec3_50.c,v 1.6 2020/02/24 17:44:45 florian Exp $ */ /* * Copyright (C) 2004 Nominet, Ltd. @@ -169,34 +169,6 @@ towire_nsec3(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_nsec3(ARGS_FROMSTRUCT) { - dns_rdata_nsec3_t *nsec3 = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_nsec3); - REQUIRE(source != NULL); - REQUIRE(nsec3->common.rdtype == type); - REQUIRE(nsec3->common.rdclass == rdclass); - REQUIRE(nsec3->typebits != NULL || nsec3->len == 0); - REQUIRE(nsec3->hash == dns_hash_sha1); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint8_tobuffer(nsec3->hash, target)); - RETERR(uint8_tobuffer(nsec3->flags, target)); - RETERR(uint16_tobuffer(nsec3->iterations, target)); - RETERR(uint8_tobuffer(nsec3->salt_length, target)); - RETERR(mem_tobuffer(target, nsec3->salt, nsec3->salt_length)); - RETERR(uint8_tobuffer(nsec3->next_length, target)); - RETERR(mem_tobuffer(target, nsec3->next, nsec3->next_length)); - - region.base = nsec3->typebits; - region.length = nsec3->len; - RETERR(typemap_test(®ion, ISC_TRUE)); - return (mem_tobuffer(target, nsec3->typebits, nsec3->len)); -} static inline isc_result_t tostruct_nsec3(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/nsec3param_51.c b/usr.bin/dig/lib/dns/rdata/generic/nsec3param_51.c index 45d8ad320f9..3ef040b5768 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nsec3param_51.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nsec3param_51.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec3param_51.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: nsec3param_51.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* * Copyright (C) 2004 Nominet, Ltd. @@ -133,26 +133,6 @@ towire_nsec3param(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_nsec3param(ARGS_FROMSTRUCT) { - dns_rdata_nsec3param_t *nsec3param = source; - - REQUIRE(type == dns_rdatatype_nsec3param); - REQUIRE(source != NULL); - REQUIRE(nsec3param->common.rdtype == type); - REQUIRE(nsec3param->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint8_tobuffer(nsec3param->hash, target)); - RETERR(uint8_tobuffer(nsec3param->flags, target)); - RETERR(uint16_tobuffer(nsec3param->iterations, target)); - RETERR(uint8_tobuffer(nsec3param->salt_length, target)); - RETERR(mem_tobuffer(target, nsec3param->salt, - nsec3param->salt_length)); - return (ISC_R_SUCCESS); -} static inline isc_result_t tostruct_nsec3param(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/nsec_47.c b/usr.bin/dig/lib/dns/rdata/generic/nsec_47.c index d832998564e..657efea71da 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nsec_47.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nsec_47.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec_47.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: nsec_47.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */ @@ -95,28 +95,6 @@ towire_nsec(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_nsec(ARGS_FROMSTRUCT) { - dns_rdata_nsec_t *nsec = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_nsec); - REQUIRE(source != NULL); - REQUIRE(nsec->common.rdtype == type); - REQUIRE(nsec->common.rdclass == rdclass); - REQUIRE(nsec->typebits != NULL || nsec->len == 0); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&nsec->next, ®ion); - RETERR(isc_buffer_copyregion(target, ®ion)); - - region.base = nsec->typebits; - region.length = nsec->len; - RETERR(typemap_test(®ion, ISC_FALSE)); - return (mem_tobuffer(target, nsec->typebits, nsec->len)); -} static inline isc_result_t tostruct_nsec(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/null_10.c b/usr.bin/dig/lib/dns/rdata/generic/null_10.c index 57d9a45da4d..7b5e92e58d0 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/null_10.c +++ b/usr.bin/dig/lib/dns/rdata/generic/null_10.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: null_10.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: null_10.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */ @@ -56,21 +56,6 @@ towire_null(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_null(ARGS_FROMSTRUCT) { - dns_rdata_null_t *null = source; - - REQUIRE(type == dns_rdatatype_null); - REQUIRE(source != NULL); - REQUIRE(null->common.rdtype == type); - REQUIRE(null->common.rdclass == rdclass); - REQUIRE(null->data != NULL || null->length == 0); - - UNUSED(type); - UNUSED(rdclass); - - return (mem_tobuffer(target, null->data, null->length)); -} static inline isc_result_t tostruct_null(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/nxt_30.c b/usr.bin/dig/lib/dns/rdata/generic/nxt_30.c index 1bc00eadc65..b8cb016923f 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nxt_30.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nxt_30.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nxt_30.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: nxt_30.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */ @@ -113,29 +113,6 @@ towire_nxt(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_nxt(ARGS_FROMSTRUCT) { - dns_rdata_nxt_t *nxt = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_nxt); - REQUIRE(source != NULL); - REQUIRE(nxt->common.rdtype == type); - REQUIRE(nxt->common.rdclass == rdclass); - REQUIRE(nxt->typebits != NULL || nxt->len == 0); - if (nxt->typebits != NULL && (nxt->typebits[0] & 0x80) == 0) { - REQUIRE(nxt->len <= 16); - REQUIRE(nxt->typebits[nxt->len - 1] != 0); - } - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&nxt->next, ®ion); - RETERR(isc_buffer_copyregion(target, ®ion)); - - return (mem_tobuffer(target, nxt->typebits, nxt->len)); -} static inline isc_result_t tostruct_nxt(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/openpgpkey_61.c b/usr.bin/dig/lib/dns/rdata/generic/openpgpkey_61.c index 253ea20f4ae..d7d3c3d134e 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/openpgpkey_61.c +++ b/usr.bin/dig/lib/dns/rdata/generic/openpgpkey_61.c @@ -84,24 +84,6 @@ towire_openpgpkey(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_openpgpkey(ARGS_FROMSTRUCT) { - dns_rdata_openpgpkey_t *sig = source; - - REQUIRE(type == dns_rdatatype_openpgpkey); - REQUIRE(source != NULL); - REQUIRE(sig->common.rdtype == type); - REQUIRE(sig->common.rdclass == rdclass); - REQUIRE(sig->keyring != NULL && sig->length != 0); - - UNUSED(type); - UNUSED(rdclass); - - /* - * Keyring. - */ - return (mem_tobuffer(target, sig->keyring, sig->length)); -} static inline isc_result_t tostruct_openpgpkey(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/opt_41.c b/usr.bin/dig/lib/dns/rdata/generic/opt_41.c index aae00b9fe99..b4f170a2385 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/opt_41.c +++ b/usr.bin/dig/lib/dns/rdata/generic/opt_41.c @@ -201,36 +201,6 @@ towire_opt(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_opt(ARGS_FROMSTRUCT) { - dns_rdata_opt_t *opt = source; - isc_region_t region; - uint16_t length; - - REQUIRE(type == dns_rdatatype_opt); - REQUIRE(source != NULL); - REQUIRE(opt->common.rdtype == type); - REQUIRE(opt->common.rdclass == rdclass); - REQUIRE(opt->options != NULL || opt->length == 0); - - UNUSED(type); - UNUSED(rdclass); - - region.base = opt->options; - region.length = opt->length; - while (region.length >= 4) { - isc_region_consume(®ion, 2); /* opt */ - length = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - if (region.length < length) - return (ISC_R_UNEXPECTEDEND); - isc_region_consume(®ion, length); - } - if (region.length != 0) - return (ISC_R_UNEXPECTEDEND); - - return (mem_tobuffer(target, opt->options, opt->length)); -} static inline isc_result_t tostruct_opt(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/proforma.c b/usr.bin/dig/lib/dns/rdata/generic/proforma.c index 584e0c517cb..4cf5ae6c1f2 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/proforma.c +++ b/usr.bin/dig/lib/dns/rdata/generic/proforma.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: proforma.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: proforma.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ #ifndef RDATA_GENERIC_#_#_C #define RDATA_GENERIC_#_#_C @@ -57,18 +57,6 @@ towire_#(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_#(ARGS_FROMSTRUCT) { - dns_rdata_#_t *# = source; - - REQUIRE(type == dns_rdatatype_proforma.c#); - REQUIRE(rdclass == #); - REQUIRE(source != NULL); - REQUIRE(#->common.rdtype == dns_rdatatype_proforma.ctype); - REQUIRE(#->common.rdclass == rdclass); - - return (ISC_R_NOTIMPLEMENTED); -} static inline isc_result_t tostruct_#(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/ptr_12.c b/usr.bin/dig/lib/dns/rdata/generic/ptr_12.c index 22f79115331..6bfb8a46214 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ptr_12.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ptr_12.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ptr_12.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: ptr_12.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Thu Mar 16 14:05:12 PST 2000 by explorer */ @@ -78,22 +78,6 @@ towire_ptr(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_ptr(ARGS_FROMSTRUCT) { - dns_rdata_ptr_t *ptr = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_ptr); - REQUIRE(source != NULL); - REQUIRE(ptr->common.rdtype == type); - REQUIRE(ptr->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&ptr->ptr, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_ptr(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/rkey_57.c b/usr.bin/dig/lib/dns/rdata/generic/rkey_57.c index adf9503e8ee..420b48fa3f9 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/rkey_57.c +++ b/usr.bin/dig/lib/dns/rdata/generic/rkey_57.c @@ -52,13 +52,6 @@ towire_rkey(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_rkey(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_rkey); - - return (generic_fromstruct_key(rdclass, type, source, target)); -} static inline isc_result_t tostruct_rkey(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/rp_17.c b/usr.bin/dig/lib/dns/rdata/generic/rp_17.c index 878e88d23c5..923727578b4 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/rp_17.c +++ b/usr.bin/dig/lib/dns/rdata/generic/rp_17.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rp_17.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: rp_17.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* RFC1183 */ @@ -103,24 +103,6 @@ towire_rp(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_rp(ARGS_FROMSTRUCT) { - dns_rdata_rp_t *rp = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_rp); - REQUIRE(source != NULL); - REQUIRE(rp->common.rdtype == type); - REQUIRE(rp->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&rp->mail, ®ion); - RETERR(isc_buffer_copyregion(target, ®ion)); - dns_name_toregion(&rp->text, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_rp(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/rrsig_46.c b/usr.bin/dig/lib/dns/rdata/generic/rrsig_46.c index 50db69319c3..84c25c07cb2 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/rrsig_46.c +++ b/usr.bin/dig/lib/dns/rdata/generic/rrsig_46.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rrsig_46.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: rrsig_46.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */ @@ -218,64 +218,6 @@ towire_rrsig(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_rrsig(ARGS_FROMSTRUCT) { - dns_rdata_rrsig_t *sig = source; - - REQUIRE(type == dns_rdatatype_rrsig); - REQUIRE(source != NULL); - REQUIRE(sig->common.rdtype == type); - REQUIRE(sig->common.rdclass == rdclass); - REQUIRE(sig->signature != NULL || sig->siglen == 0); - - UNUSED(type); - UNUSED(rdclass); - - /* - * Type covered. - */ - RETERR(uint16_tobuffer(sig->covered, target)); - - /* - * Algorithm. - */ - RETERR(uint8_tobuffer(sig->algorithm, target)); - - /* - * Labels. - */ - RETERR(uint8_tobuffer(sig->labels, target)); - - /* - * Original TTL. - */ - RETERR(uint32_tobuffer(sig->originalttl, target)); - - /* - * Expire time. - */ - RETERR(uint32_tobuffer(sig->timeexpire, target)); - - /* - * Time signed. - */ - RETERR(uint32_tobuffer(sig->timesigned, target)); - - /* - * Key ID. - */ - RETERR(uint16_tobuffer(sig->keyid, target)); - - /* - * Signer name. - */ - RETERR(name_tobuffer(&sig->signer, target)); - - /* - * Signature. - */ - return (mem_tobuffer(target, sig->signature, sig->siglen)); -} static inline isc_result_t tostruct_rrsig(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/rt_21.c b/usr.bin/dig/lib/dns/rdata/generic/rt_21.c index a5e155e8373..bb50358397b 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/rt_21.c +++ b/usr.bin/dig/lib/dns/rdata/generic/rt_21.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rt_21.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: rt_21.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* reviewed: Thu Mar 16 15:02:31 PST 2000 by brister */ @@ -104,23 +104,6 @@ towire_rt(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_rt(ARGS_FROMSTRUCT) { - dns_rdata_rt_t *rt = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_rt); - REQUIRE(source != NULL); - REQUIRE(rt->common.rdtype == type); - REQUIRE(rt->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(rt->preference, target)); - dns_name_toregion(&rt->host, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_rt(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/sig_24.c b/usr.bin/dig/lib/dns/rdata/generic/sig_24.c index f2317d5e675..904388e9101 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/sig_24.c +++ b/usr.bin/dig/lib/dns/rdata/generic/sig_24.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sig_24.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: sig_24.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */ @@ -218,64 +218,6 @@ towire_sig(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_sig(ARGS_FROMSTRUCT) { - dns_rdata_sig_t *sig = source; - - REQUIRE(type == dns_rdatatype_sig); - REQUIRE(source != NULL); - REQUIRE(sig->common.rdtype == type); - REQUIRE(sig->common.rdclass == rdclass); - REQUIRE(sig->signature != NULL || sig->siglen == 0); - - UNUSED(type); - UNUSED(rdclass); - - /* - * Type covered. - */ - RETERR(uint16_tobuffer(sig->covered, target)); - - /* - * Algorithm. - */ - RETERR(uint8_tobuffer(sig->algorithm, target)); - - /* - * Labels. - */ - RETERR(uint8_tobuffer(sig->labels, target)); - - /* - * Original TTL. - */ - RETERR(uint32_tobuffer(sig->originalttl, target)); - - /* - * Expire time. - */ - RETERR(uint32_tobuffer(sig->timeexpire, target)); - - /* - * Time signed. - */ - RETERR(uint32_tobuffer(sig->timesigned, target)); - - /* - * Key ID. - */ - RETERR(uint16_tobuffer(sig->keyid, target)); - - /* - * Signer name. - */ - RETERR(name_tobuffer(&sig->signer, target)); - - /* - * Signature. - */ - return (mem_tobuffer(target, sig->signature, sig->siglen)); -} static inline isc_result_t tostruct_sig(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/sink_40.c b/usr.bin/dig/lib/dns/rdata/generic/sink_40.c index d60dcf52b91..74bdcc842e4 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/sink_40.c +++ b/usr.bin/dig/lib/dns/rdata/generic/sink_40.c @@ -95,30 +95,6 @@ towire_sink(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_sink(ARGS_FROMSTRUCT) { - dns_rdata_sink_t *sink = source; - - REQUIRE(type == dns_rdatatype_sink); - REQUIRE(source != NULL); - REQUIRE(sink->common.rdtype == type); - REQUIRE(sink->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - /* Meaning */ - RETERR(uint8_tobuffer(sink->meaning, target)); - - /* Coding */ - RETERR(uint8_tobuffer(sink->coding, target)); - - /* Subcoding */ - RETERR(uint8_tobuffer(sink->subcoding, target)); - - /* Data */ - return (mem_tobuffer(target, sink->data, sink->datalen)); -} static inline isc_result_t tostruct_sink(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/smimea_53.c b/usr.bin/dig/lib/dns/rdata/generic/smimea_53.c index e1523682e34..d25574479f9 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/smimea_53.c +++ b/usr.bin/dig/lib/dns/rdata/generic/smimea_53.c @@ -50,13 +50,6 @@ towire_smimea(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_smimea(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_smimea); - - return (generic_fromstruct_tlsa(rdclass, type, source, target)); -} static inline isc_result_t tostruct_smimea(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/spf_99.c b/usr.bin/dig/lib/dns/rdata/generic/spf_99.c index 5a9bf331a26..1ae4e0d0339 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/spf_99.c +++ b/usr.bin/dig/lib/dns/rdata/generic/spf_99.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: spf_99.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: spf_99.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Thu Mar 16 15:40:00 PST 2000 by bwelling */ @@ -58,13 +58,6 @@ towire_spf(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_spf(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_spf); - - return (generic_fromstruct_txt(rdclass, type, source, target)); -} static inline isc_result_t tostruct_spf(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/sshfp_44.c b/usr.bin/dig/lib/dns/rdata/generic/sshfp_44.c index d38ae9cff50..069155c8ff6 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/sshfp_44.c +++ b/usr.bin/dig/lib/dns/rdata/generic/sshfp_44.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sshfp_44.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: sshfp_44.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* RFC 4255 */ @@ -101,23 +101,6 @@ towire_sshfp(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_sshfp(ARGS_FROMSTRUCT) { - dns_rdata_sshfp_t *sshfp = source; - - REQUIRE(type == dns_rdatatype_sshfp); - REQUIRE(source != NULL); - REQUIRE(sshfp->common.rdtype == type); - REQUIRE(sshfp->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint8_tobuffer(sshfp->algorithm, target)); - RETERR(uint8_tobuffer(sshfp->digest_type, target)); - - return (mem_tobuffer(target, sshfp->digest, sshfp->length)); -} static inline isc_result_t tostruct_sshfp(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/ta_32768.c b/usr.bin/dig/lib/dns/rdata/generic/ta_32768.c index e448899835a..740541ca029 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ta_32768.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ta_32768.c @@ -52,13 +52,6 @@ towire_ta(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_ta(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_ta); - - return (generic_fromstruct_ds(rdclass, type, source, target)); -} static inline isc_result_t tostruct_ta(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/talink_58.c b/usr.bin/dig/lib/dns/rdata/generic/talink_58.c index 40bccdee2ba..50bc95ae483 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/talink_58.c +++ b/usr.bin/dig/lib/dns/rdata/generic/talink_58.c @@ -98,24 +98,6 @@ towire_talink(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_talink(ARGS_FROMSTRUCT) { - dns_rdata_talink_t *talink = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_talink); - REQUIRE(source != NULL); - REQUIRE(talink->common.rdtype == type); - REQUIRE(talink->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&talink->prev, ®ion); - RETERR(isc_buffer_copyregion(target, ®ion)); - dns_name_toregion(&talink->next, ®ion); - return(isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_talink(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/tkey_249.c b/usr.bin/dig/lib/dns/rdata/generic/tkey_249.c index a56929e4056..95494ab29bb 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/tkey_249.c +++ b/usr.bin/dig/lib/dns/rdata/generic/tkey_249.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: tkey_249.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: tkey_249.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* * Reviewed: Thu Mar 16 17:35:30 PST 2000 by halley. @@ -224,63 +224,6 @@ towire_tkey(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_tkey(ARGS_FROMSTRUCT) { - dns_rdata_tkey_t *tkey = source; - - REQUIRE(type == dns_rdatatype_tkey); - REQUIRE(source != NULL); - REQUIRE(tkey->common.rdtype == type); - REQUIRE(tkey->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - /* - * Algorithm Name. - */ - RETERR(name_tobuffer(&tkey->algorithm, target)); - - /* - * Inception: 32 bits. - */ - RETERR(uint32_tobuffer(tkey->inception, target)); - - /* - * Expire: 32 bits. - */ - RETERR(uint32_tobuffer(tkey->expire, target)); - - /* - * Mode: 16 bits. - */ - RETERR(uint16_tobuffer(tkey->mode, target)); - - /* - * Error: 16 bits. - */ - RETERR(uint16_tobuffer(tkey->error, target)); - - /* - * Key size: 16 bits. - */ - RETERR(uint16_tobuffer(tkey->keylen, target)); - - /* - * Key. - */ - RETERR(mem_tobuffer(target, tkey->key, tkey->keylen)); - - /* - * Other size: 16 bits. - */ - RETERR(uint16_tobuffer(tkey->otherlen, target)); - - /* - * Other data. - */ - return (mem_tobuffer(target, tkey->other, tkey->otherlen)); -} static inline isc_result_t tostruct_tkey(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/tlsa_52.c b/usr.bin/dig/lib/dns/rdata/generic/tlsa_52.c index ebc94c60956..03fdabe51fe 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/tlsa_52.c +++ b/usr.bin/dig/lib/dns/rdata/generic/tlsa_52.c @@ -179,13 +179,6 @@ generic_freestruct_tlsa(ARGS_FREESTRUCT) { free(tlsa->data); } -static inline isc_result_t -fromstruct_tlsa(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_tlsa); - - return (generic_fromstruct_tlsa(rdclass, type, source, target)); -} static inline isc_result_t tostruct_tlsa(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/txt_16.c b/usr.bin/dig/lib/dns/rdata/generic/txt_16.c index 5e89e2729c5..4c80af029ef 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/txt_16.c +++ b/usr.bin/dig/lib/dns/rdata/generic/txt_16.c @@ -140,13 +140,6 @@ generic_freestruct_txt(ARGS_FREESTRUCT) { free(txt->txt); } -static inline isc_result_t -fromstruct_txt(ARGS_FROMSTRUCT) { - - REQUIRE(type == dns_rdatatype_txt); - - return (generic_fromstruct_txt(rdclass, type, source, target)); -} static inline isc_result_t tostruct_txt(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c b/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c index dde4ba9125a..9dcd51a4644 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c +++ b/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: unspec_103.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: unspec_103.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ #ifndef RDATA_GENERIC_UNSPEC_103_C #define RDATA_GENERIC_UNSPEC_103_C @@ -58,21 +58,6 @@ towire_unspec(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_unspec(ARGS_FROMSTRUCT) { - dns_rdata_unspec_t *unspec = source; - - REQUIRE(type == dns_rdatatype_unspec); - REQUIRE(source != NULL); - REQUIRE(unspec->common.rdtype == type); - REQUIRE(unspec->common.rdclass == rdclass); - REQUIRE(unspec->data != NULL || unspec->datalen == 0); - - UNUSED(type); - UNUSED(rdclass); - - return (mem_tobuffer(target, unspec->data, unspec->datalen)); -} static inline isc_result_t tostruct_unspec(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/uri_256.c b/usr.bin/dig/lib/dns/rdata/generic/uri_256.c index e62b70904f0..8d6d2fdcad3 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/uri_256.c +++ b/usr.bin/dig/lib/dns/rdata/generic/uri_256.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: uri_256.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: uri_256.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ #ifndef GENERIC_URI_256_C #define GENERIC_URI_256_C 1 @@ -96,34 +96,6 @@ towire_uri(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_uri(ARGS_FROMSTRUCT) { - dns_rdata_uri_t *uri = source; - - REQUIRE(type == dns_rdatatype_uri); - REQUIRE(source != NULL); - REQUIRE(uri->common.rdtype == type); - REQUIRE(uri->common.rdclass == rdclass); - REQUIRE(uri->target != NULL && uri->tgt_len != 0); - - UNUSED(type); - UNUSED(rdclass); - - /* - * Priority - */ - RETERR(uint16_tobuffer(uri->priority, target)); - - /* - * Weight - */ - RETERR(uint16_tobuffer(uri->weight, target)); - - /* - * Target URI - */ - return (mem_tobuffer(target, uri->target, uri->tgt_len)); -} static inline isc_result_t tostruct_uri(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/generic/x25_19.c b/usr.bin/dig/lib/dns/rdata/generic/x25_19.c index 65e4b167f0d..a92f919f345 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/x25_19.c +++ b/usr.bin/dig/lib/dns/rdata/generic/x25_19.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: x25_19.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: x25_19.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Thu Mar 16 16:15:57 PST 2000 by bwelling */ @@ -66,30 +66,6 @@ towire_x25(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_x25(ARGS_FROMSTRUCT) { - dns_rdata_x25_t *x25 = source; - uint8_t i; - - REQUIRE(type == dns_rdatatype_x25); - REQUIRE(source != NULL); - REQUIRE(x25->common.rdtype == type); - REQUIRE(x25->common.rdclass == rdclass); - REQUIRE(x25->x25 != NULL && x25->x25_len != 0); - - UNUSED(type); - UNUSED(rdclass); - - if (x25->x25_len < 4) - return (ISC_R_RANGE); - - for (i = 0; i < x25->x25_len; i++) - if (!isdigit(x25->x25[i] & 0xff)) - return (ISC_R_RANGE); - - RETERR(uint8_tobuffer(x25->x25_len, target)); - return (mem_tobuffer(target, x25->x25, x25->x25_len)); -} static inline isc_result_t tostruct_x25(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/hs_4/a_1.c b/usr.bin/dig/lib/dns/rdata/hs_4/a_1.c index d64a00aa668..e6c5a8fe820 100644 --- a/usr.bin/dig/lib/dns/rdata/hs_4/a_1.c +++ b/usr.bin/dig/lib/dns/rdata/hs_4/a_1.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: a_1.c,v 1.6 2020/02/24 17:43:52 florian Exp $ */ +/* $Id: a_1.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* reviewed: Thu Mar 16 15:58:36 PST 2000 by brister */ @@ -84,24 +84,6 @@ towire_hs_a(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_hs_a(ARGS_FROMSTRUCT) { - dns_rdata_hs_a_t *a = source; - uint32_t n; - - REQUIRE(type == dns_rdatatype_a); - REQUIRE(rdclass == dns_rdataclass_hs); - REQUIRE(source != NULL); - REQUIRE(a->common.rdtype == type); - REQUIRE(a->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - n = ntohl(a->in_addr.s_addr); - - return (uint32_tobuffer(n, target)); -} static inline isc_result_t tostruct_hs_a(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/a6_38.c b/usr.bin/dig/lib/dns/rdata/in_1/a6_38.c index 788dc406115..6656d8c1e67 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/a6_38.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/a6_38.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: a6_38.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: a6_38.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* RFC2874 */ @@ -151,50 +151,6 @@ towire_in_a6(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_a6(ARGS_FROMSTRUCT) { - dns_rdata_in_a6_t *a6 = source; - isc_region_t region; - int octets; - uint8_t bits; - uint8_t first; - uint8_t mask; - - REQUIRE(type == dns_rdatatype_a6); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(a6->common.rdtype == type); - REQUIRE(a6->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - if (a6->prefixlen > 128) - return (ISC_R_RANGE); - - RETERR(uint8_tobuffer(a6->prefixlen, target)); - - /* Suffix */ - if (a6->prefixlen != 128) { - octets = 16 - a6->prefixlen / 8; - bits = a6->prefixlen % 8; - if (bits != 0) { - mask = 0xffU >> bits; - first = a6->in6_addr.s6_addr[16 - octets] & mask; - RETERR(uint8_tobuffer(first, target)); - octets--; - } - if (octets > 0) - RETERR(mem_tobuffer(target, - a6->in6_addr.s6_addr + 16 - octets, - octets)); - } - - if (a6->prefixlen == 0) - return (ISC_R_SUCCESS); - dns_name_toregion(&a6->prefix, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_in_a6(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/a_1.c b/usr.bin/dig/lib/dns/rdata/in_1/a_1.c index eb41c889625..a653e32a64f 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/a_1.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/a_1.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: a_1.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: a_1.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */ @@ -86,24 +86,6 @@ towire_in_a(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_a(ARGS_FROMSTRUCT) { - dns_rdata_in_a_t *a = source; - uint32_t n; - - REQUIRE(type == dns_rdatatype_a); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(a->common.rdtype == type); - REQUIRE(a->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - n = ntohl(a->in_addr.s_addr); - - return (uint32_tobuffer(n, target)); -} static inline isc_result_t diff --git a/usr.bin/dig/lib/dns/rdata/in_1/aaaa_28.c b/usr.bin/dig/lib/dns/rdata/in_1/aaaa_28.c index b0357393556..8a5975f1eca 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/aaaa_28.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/aaaa_28.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: aaaa_28.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: aaaa_28.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */ @@ -86,21 +86,6 @@ towire_in_aaaa(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_aaaa(ARGS_FROMSTRUCT) { - dns_rdata_in_aaaa_t *aaaa = source; - - REQUIRE(type == dns_rdatatype_aaaa); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(aaaa->common.rdtype == type); - REQUIRE(aaaa->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - return (mem_tobuffer(target, aaaa->in6_addr.s6_addr, 16)); -} static inline isc_result_t tostruct_in_aaaa(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/apl_42.c b/usr.bin/dig/lib/dns/rdata/in_1/apl_42.c index da296fe33e1..7bfece356ef 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/apl_42.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/apl_42.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: apl_42.c,v 1.7 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: apl_42.c,v 1.8 2020/02/24 17:44:45 florian Exp $ */ /* RFC3123 */ @@ -150,23 +150,6 @@ towire_in_apl(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_apl(ARGS_FROMSTRUCT) { - dns_rdata_in_apl_t *apl = source; - isc_buffer_t b; - - REQUIRE(type == dns_rdatatype_apl); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(apl->common.rdtype == type); - REQUIRE(apl->common.rdclass == rdclass); - REQUIRE(apl->apl != NULL || apl->apl_len == 0); - - isc_buffer_init(&b, apl->apl, apl->apl_len); - isc_buffer_add(&b, apl->apl_len); - isc_buffer_setactive(&b, apl->apl_len); - return(fromwire_in_apl(rdclass, type, &b, NULL, ISC_FALSE, target)); -} static inline isc_result_t tostruct_in_apl(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/dhcid_49.c b/usr.bin/dig/lib/dns/rdata/in_1/dhcid_49.c index 8abaa1a2bdf..2e47a308249 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/dhcid_49.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/dhcid_49.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dhcid_49.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: dhcid_49.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* RFC 4701 */ @@ -91,22 +91,6 @@ towire_in_dhcid(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_dhcid(ARGS_FROMSTRUCT) { - dns_rdata_in_dhcid_t *dhcid = source; - - REQUIRE(type == dns_rdatatype_dhcid); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(dhcid->common.rdtype == type); - REQUIRE(dhcid->common.rdclass == rdclass); - REQUIRE(dhcid->length != 0); - - UNUSED(type); - UNUSED(rdclass); - - return (mem_tobuffer(target, dhcid->dhcid, dhcid->length)); -} static inline isc_result_t tostruct_in_dhcid(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/kx_36.c b/usr.bin/dig/lib/dns/rdata/in_1/kx_36.c index 417db6104e5..5c114fae466 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/kx_36.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/kx_36.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: kx_36.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: kx_36.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Thu Mar 16 17:24:54 PST 2000 by explorer */ @@ -99,24 +99,6 @@ towire_in_kx(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_kx(ARGS_FROMSTRUCT) { - dns_rdata_in_kx_t *kx = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_kx); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(kx->common.rdtype == type); - REQUIRE(kx->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(kx->preference, target)); - dns_name_toregion(&kx->exchange, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_in_kx(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/nsap-ptr_23.c b/usr.bin/dig/lib/dns/rdata/in_1/nsap-ptr_23.c index 15620f8eae3..88f4a63e198 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/nsap-ptr_23.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/nsap-ptr_23.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsap-ptr_23.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: nsap-ptr_23.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Fri Mar 17 10:16:02 PST 2000 by gson */ @@ -82,23 +82,6 @@ towire_in_nsap_ptr(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_nsap_ptr(ARGS_FROMSTRUCT) { - dns_rdata_in_nsap_ptr_t *nsap_ptr = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_nsap_ptr); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(nsap_ptr->common.rdtype == type); - REQUIRE(nsap_ptr->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - dns_name_toregion(&nsap_ptr->owner, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_in_nsap_ptr(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/nsap_22.c b/usr.bin/dig/lib/dns/rdata/in_1/nsap_22.c index ad764a578f5..a2887131bf5 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/nsap_22.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/nsap_22.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsap_22.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: nsap_22.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Fri Mar 17 10:41:07 PST 2000 by gson */ @@ -79,22 +79,6 @@ towire_in_nsap(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_nsap(ARGS_FROMSTRUCT) { - dns_rdata_in_nsap_t *nsap = source; - - REQUIRE(type == dns_rdatatype_nsap); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(nsap->common.rdtype == type); - REQUIRE(nsap->common.rdclass == rdclass); - REQUIRE(nsap->nsap != NULL || nsap->nsap_len == 0); - - UNUSED(type); - UNUSED(rdclass); - - return (mem_tobuffer(target, nsap->nsap, nsap->nsap_len)); -} static inline isc_result_t tostruct_in_nsap(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/px_26.c b/usr.bin/dig/lib/dns/rdata/in_1/px_26.c index 4ed08f36a7b..233c95796f8 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/px_26.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/px_26.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: px_26.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: px_26.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Mon Mar 20 10:44:27 PST 2000 */ @@ -138,26 +138,6 @@ towire_in_px(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_px(ARGS_FROMSTRUCT) { - dns_rdata_in_px_t *px = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_px); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(px->common.rdtype == type); - REQUIRE(px->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(px->preference, target)); - dns_name_toregion(&px->map822, ®ion); - RETERR(isc_buffer_copyregion(target, ®ion)); - dns_name_toregion(&px->mapx400, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_in_px(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/srv_33.c b/usr.bin/dig/lib/dns/rdata/in_1/srv_33.c index be0b9dc93f0..3afb64b10e8 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/srv_33.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/srv_33.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: srv_33.c,v 1.6 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: srv_33.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Fri Mar 17 13:01:00 PST 2000 by bwelling */ @@ -133,26 +133,6 @@ towire_in_srv(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_srv(ARGS_FROMSTRUCT) { - dns_rdata_in_srv_t *srv = source; - isc_region_t region; - - REQUIRE(type == dns_rdatatype_srv); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(srv->common.rdtype == type); - REQUIRE(srv->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(srv->priority, target)); - RETERR(uint16_tobuffer(srv->weight, target)); - RETERR(uint16_tobuffer(srv->port, target)); - dns_name_toregion(&srv->target, ®ion); - return (isc_buffer_copyregion(target, ®ion)); -} static inline isc_result_t tostruct_in_srv(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/rdata/in_1/wks_11.c b/usr.bin/dig/lib/dns/rdata/in_1/wks_11.c index 2c64003c4e0..fbd4fd03c97 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/wks_11.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/wks_11.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: wks_11.c,v 1.7 2020/02/24 17:43:53 florian Exp $ */ +/* $Id: wks_11.c,v 1.8 2020/02/24 17:44:45 florian Exp $ */ /* Reviewed: Fri Mar 17 15:01:49 PST 2000 by explorer */ @@ -112,27 +112,6 @@ towire_in_wks(ARGS_TOWIRE) { } -static inline isc_result_t -fromstruct_in_wks(ARGS_FROMSTRUCT) { - dns_rdata_in_wks_t *wks = source; - uint32_t a; - - REQUIRE(type == dns_rdatatype_wks); - REQUIRE(rdclass == dns_rdataclass_in); - REQUIRE(source != NULL); - REQUIRE(wks->common.rdtype == type); - REQUIRE(wks->common.rdclass == rdclass); - REQUIRE((wks->map != NULL && wks->map_len <= 8*1024) || - wks->map_len == 0); - - UNUSED(type); - UNUSED(rdclass); - - a = ntohl(wks->in_addr.s_addr); - RETERR(uint32_tobuffer(a, target)); - RETERR(uint8_tobuffer(wks->protocol, target)); - return (mem_tobuffer(target, wks->map, wks->map_len)); -} static inline isc_result_t tostruct_in_wks(ARGS_TOSTRUCT) { diff --git a/usr.bin/dig/lib/dns/tsig.c b/usr.bin/dig/lib/dns/tsig.c index 6e31954509b..e3a42620cc4 100644 --- a/usr.bin/dig/lib/dns/tsig.c +++ b/usr.bin/dig/lib/dns/tsig.c @@ -15,7 +15,7 @@ */ /* - * $Id: tsig.c,v 1.10 2020/02/24 17:43:52 florian Exp $ + * $Id: tsig.c,v 1.11 2020/02/24 17:44:44 florian Exp $ */ /*! \file */ @@ -639,8 +639,8 @@ dns_tsig_sign(dns_message_t *msg) { ret = isc_buffer_allocate(&dynbuf, 512); if (ret != ISC_R_SUCCESS) goto cleanup_rdata; - ret = dns_rdata_fromstruct(rdata, dns_rdataclass_any, - dns_rdatatype_tsig, &tsig, dynbuf); + ret = dns_rdata_fromstruct_tsig(rdata, dns_rdataclass_any, + dns_rdatatype_tsig, &tsig, dynbuf); if (ret != ISC_R_SUCCESS) goto cleanup_dynbuf; |