diff options
Diffstat (limited to 'lib/dns/rdata/generic/loc_29.c')
-rw-r--r-- | lib/dns/rdata/generic/loc_29.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/lib/dns/rdata/generic/loc_29.c b/lib/dns/rdata/generic/loc_29.c index 904dbb402a97..641daca25d68 100644 --- a/lib/dns/rdata/generic/loc_29.c +++ b/lib/dns/rdata/generic/loc_29.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -50,7 +50,7 @@ fromtext_loc(ARGS_FROMTEXT) { unsigned long longitude; unsigned long altitude; - REQUIRE(type == 29); + REQUIRE(type == dns_rdatatype_loc); UNUSED(type); UNUSED(rdclass); @@ -475,12 +475,16 @@ totext_loc(ARGS_TOTEXT) { UNUSED(tctx); - REQUIRE(rdata->type == 29); + REQUIRE(rdata->type == dns_rdatatype_loc); REQUIRE(rdata->length != 0); dns_rdata_toregion(rdata, &sr); - /* version = sr.base[0]; */ + if (sr.base[0] != 0) + return (ISC_R_NOTIMPLEMENTED); + + REQUIRE(rdata->length == 16); + size = sr.base[1]; INSIST((size&0x0f) < 10 && (size>>4) < 10); if ((size&0x0f)> 1) @@ -563,7 +567,7 @@ fromwire_loc(ARGS_FROMWIRE) { unsigned long latitude; unsigned long longitude; - REQUIRE(type == 29); + REQUIRE(type == dns_rdatatype_loc); UNUSED(type); UNUSED(rdclass); @@ -573,8 +577,11 @@ fromwire_loc(ARGS_FROMWIRE) { isc_buffer_activeregion(source, &sr); if (sr.length < 1) return (ISC_R_UNEXPECTEDEND); - if (sr.base[0] != 0) - return (ISC_R_NOTIMPLEMENTED); + if (sr.base[0] != 0) { + /* Treat as unknown. */ + isc_buffer_forward(source, sr.length); + return (mem_tobuffer(target, sr.base, sr.length)); + } if (sr.length < 16) return (ISC_R_UNEXPECTEDEND); @@ -634,7 +641,7 @@ static inline isc_result_t towire_loc(ARGS_TOWIRE) { UNUSED(cctx); - REQUIRE(rdata->type == 29); + REQUIRE(rdata->type == dns_rdatatype_loc); REQUIRE(rdata->length != 0); return (mem_tobuffer(target, rdata->data, rdata->length)); @@ -647,7 +654,7 @@ compare_loc(ARGS_COMPARE) { REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->rdclass == rdata2->rdclass); - REQUIRE(rdata1->type == 29); + REQUIRE(rdata1->type == dns_rdatatype_loc); REQUIRE(rdata1->length != 0); REQUIRE(rdata2->length != 0); @@ -661,7 +668,7 @@ fromstruct_loc(ARGS_FROMSTRUCT) { dns_rdata_loc_t *loc = source; isc_uint8_t c; - REQUIRE(type == 29); + REQUIRE(type == dns_rdatatype_loc); REQUIRE(source != NULL); REQUIRE(loc->common.rdtype == type); REQUIRE(loc->common.rdclass == rdclass); @@ -706,7 +713,7 @@ tostruct_loc(ARGS_TOSTRUCT) { isc_region_t r; isc_uint8_t version; - REQUIRE(rdata->type == 29); + REQUIRE(rdata->type == dns_rdatatype_loc); REQUIRE(target != NULL); REQUIRE(rdata->length != 0); @@ -743,7 +750,7 @@ freestruct_loc(ARGS_FREESTRUCT) { dns_rdata_loc_t *loc = source; REQUIRE(source != NULL); - REQUIRE(loc->common.rdtype == 29); + REQUIRE(loc->common.rdtype == dns_rdatatype_loc); UNUSED(source); UNUSED(loc); @@ -751,7 +758,7 @@ freestruct_loc(ARGS_FREESTRUCT) { static inline isc_result_t additionaldata_loc(ARGS_ADDLDATA) { - REQUIRE(rdata->type == 29); + REQUIRE(rdata->type == dns_rdatatype_loc); UNUSED(rdata); UNUSED(add); @@ -764,7 +771,7 @@ static inline isc_result_t digest_loc(ARGS_DIGEST) { isc_region_t r; - REQUIRE(rdata->type == 29); + REQUIRE(rdata->type == dns_rdatatype_loc); dns_rdata_toregion(rdata, &r); @@ -774,7 +781,7 @@ digest_loc(ARGS_DIGEST) { static inline isc_boolean_t checkowner_loc(ARGS_CHECKOWNER) { - REQUIRE(type == 29); + REQUIRE(type == dns_rdatatype_loc); UNUSED(name); UNUSED(type); @@ -787,7 +794,7 @@ checkowner_loc(ARGS_CHECKOWNER) { static inline isc_boolean_t checknames_loc(ARGS_CHECKNAMES) { - REQUIRE(rdata->type == 29); + REQUIRE(rdata->type == dns_rdatatype_loc); UNUSED(rdata); UNUSED(owner); |