Hi, I'm too young to ever know there were other types of networks still supported by dig(1), but it seems it's a thing. Found while reading [0].
Realistically speaking do we want to keep supporting these kind of ancient networks on our version? Is there still someone out there using them? [0] https://shkspr.mobi/blog/2022/07/dns-esoterica-why-you-cant-dig-switzerland/ Index: dig.1 =================================================================== RCS file: /cvs/src/usr.bin/dig/dig.1,v retrieving revision 1.6 diff -u -p -u -r1.6 dig.1 --- dig.1 17 Feb 2022 14:08:11 -0000 1.6 +++ dig.1 18 Jul 2022 13:39:12 -0000 @@ -108,12 +108,7 @@ An optional port may be specified by app .It Fl c Ar class Set the query class. The default is -.Cm IN ; -other classes are -.Cm HS -for Hesiod records and -.Cm CH -for Chaosnet records. +.Cm IN . .It Fl f Ar file Batch mode: .Nm @@ -264,17 +259,14 @@ or in a history file maintained by the u .Pp The .Cm IN -and -.Cm CH -class names overlap with the IN and CH top level domain names. +class name overlaps with the IN top level domain name. Either use the .Fl t and .Fl c options to specify the type and class, use the .Fl q -to specify the domain name, or use "IN." and "CH." when looking up these top -level domains. +to specify the domain name, or use "IN." when looking up this top level domain. .Sh QUERY OPTIONS .Nm provides a number of query options which affect the way in which lookups are Index: host.1 =================================================================== RCS file: /cvs/src/usr.bin/dig/host.1,v retrieving revision 1.4 diff -u -p -u -r1.4 host.1 --- host.1 31 Mar 2022 17:27:24 -0000 1.4 +++ host.1 18 Jul 2022 13:39:12 -0000 @@ -75,13 +75,7 @@ from all the listed authoritative name s The list of name servers is defined by the NS records that are found for the zone. .It Fl c Ar class -Query class: This can be used to lookup -.Cm HS -(Hesiod) -or -.Cm CH -(Chaosnet) class resource records. -The default class is +Query class: The default class is .Cm IN (Internet). .It Fl d Index: nslookup.1 =================================================================== RCS file: /cvs/src/usr.bin/dig/nslookup.1,v retrieving revision 1.1 diff -u -p -u -r1.1 nslookup.1 --- nslookup.1 7 Feb 2020 09:58:52 -0000 1.1 +++ nslookup.1 18 Jul 2022 13:39:12 -0000 @@ -107,10 +107,6 @@ Change the query class to one of: .Bl -tag -width Ds -compact .It Cm ANY wildcard -.It Cm CH -the Chaos class -.It Cm HS -the Hesiod class .It Cm IN the Internet class .El Index: lib/dns/gen.c =================================================================== RCS file: /cvs/src/usr.bin/dig/lib/dns/gen.c,v retrieving revision 1.16 diff -u -p -u -r1.16 gen.c --- lib/dns/gen.c 25 Jun 2022 12:14:18 -0000 1.16 +++ lib/dns/gen.c 18 Jul 2022 13:39:13 -0000 @@ -537,9 +537,7 @@ main(int argc, char **argv) { } while (0) for (cc = classes; cc != NULL; cc = cc->next) { - if (cc->rdclass == 3) - PRINTCLASS("chaos", 3); - else if (cc->rdclass == 255) + if (cc->rdclass == 255) PRINTCLASS("none", 254); PRINTCLASS(cc->classname, cc->rdclass); } Index: lib/dns/rcode.c =================================================================== RCS file: /cvs/src/usr.bin/dig/lib/dns/rcode.c,v retrieving revision 1.9 diff -u -p -u -r1.9 rcode.c --- lib/dns/rcode.c 26 Feb 2020 18:47:58 -0000 1.9 +++ lib/dns/rcode.c 18 Jul 2022 13:39:13 -0000 @@ -180,39 +180,6 @@ dns_rdataclass_fromtext(dns_rdataclass_t case 'a': COMPARE("any", dns_rdataclass_any); break; - case 'c': - /* - * RFC1035 says the mnemonic for the CHAOS class is CH, - * but historical BIND practice is to call it CHAOS. - * We will accept both forms, but only generate CH. - */ - COMPARE("ch", dns_rdataclass_chaos); - COMPARE("chaos", dns_rdataclass_chaos); - - if (source->length > 5 && - source->length < (5 + sizeof("65000")) && - strncasecmp("class", source->base, 5) == 0) { - char buf[sizeof("65000")]; - char *endp; - unsigned int val; - - /* - * source->base is not required to be NUL terminated. - * Copy up to remaining bytes and NUL terminate. - */ - snprintf(buf, sizeof(buf), "%.*s", - (int)(source->length - 5), source->base + 5); - val = strtoul(buf, &endp, 10); - if (*endp == '\0' && val <= 0xffff) { - *classp = (dns_rdataclass_t)val; - return (ISC_R_SUCCESS); - } - } - break; - case 'h': - COMPARE("hs", dns_rdataclass_hs); - COMPARE("hesiod", dns_rdataclass_hs); - break; case 'i': COMPARE("in", dns_rdataclass_in); break; @@ -236,10 +203,6 @@ dns_rdataclass_totext(dns_rdataclass_t r switch (rdclass) { case dns_rdataclass_any: return (isc_str_tobuffer("ANY", target)); - case dns_rdataclass_chaos: - return (isc_str_tobuffer("CH", target)); - case dns_rdataclass_hs: - return (isc_str_tobuffer("HS", target)); case dns_rdataclass_in: return (isc_str_tobuffer("IN", target)); case dns_rdataclass_none: Index: lib/dns/include/dns/types.h =================================================================== RCS file: /cvs/src/usr.bin/dig/lib/dns/include/dns/types.h,v retrieving revision 1.9 diff -u -p -u -r1.9 types.h --- lib/dns/include/dns/types.h 3 Jul 2022 12:07:52 -0000 1.9 +++ lib/dns/include/dns/types.h 18 Jul 2022 13:39:13 -0000 @@ -70,9 +70,6 @@ typedef enum { enum { dns_rdataclass_reserved0 = 0, dns_rdataclass_in = 1, - dns_rdataclass_chaos = 3, - dns_rdataclass_ch = 3, - dns_rdataclass_hs = 4, dns_rdataclass_none = 254, dns_rdataclass_any = 255 }; Index: lib/dns/rdata/ch_3/a_1.c =================================================================== RCS file: lib/dns/rdata/ch_3/a_1.c diff -N lib/dns/rdata/ch_3/a_1.c --- lib/dns/rdata/ch_3/a_1.c 14 Sep 2020 08:40:43 -0000 1.13 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,116 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: a_1.c,v 1.13 2020/09/14 08:40:43 florian Exp $ */ - -/* by [email protected], 2005-05-07 */ -/* Based on generic/soa_6.c and generic/mx_15.c */ - -#ifndef RDATA_CH_3_A_1_C -#define RDATA_CH_3_A_1_C - -static inline isc_result_t -totext_ch_a(ARGS_TOTEXT) { - isc_region_t region; - dns_name_t name; - dns_name_t prefix; - int sub; - char buf[sizeof("0177777")]; - uint16_t addr; - - REQUIRE(rdata->type == dns_rdatatype_a); - REQUIRE(rdata->rdclass == dns_rdataclass_ch); /* 3 */ - REQUIRE(rdata->length != 0); - - dns_name_init(&name, NULL); - dns_name_init(&prefix, NULL); - - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - isc_region_consume(®ion, name_length(&name)); - addr = uint16_fromregion(®ion); - - sub = name_prefix(&name, tctx->origin, &prefix); - RETERR(dns_name_totext(&prefix, sub, target)); - - snprintf(buf, sizeof(buf), "%o", addr); /* note octal */ - RETERR(isc_str_tobuffer(" ", target)); - return (isc_str_tobuffer(buf, target)); -} - -static inline isc_result_t -fromwire_ch_a(ARGS_FROMWIRE) { - isc_region_t sregion; - isc_region_t tregion; - dns_name_t name; - - REQUIRE(type == dns_rdatatype_a); - REQUIRE(rdclass == dns_rdataclass_ch); - - UNUSED(type); - UNUSED(rdclass); - - dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); - - dns_name_init(&name, NULL); - - RETERR(dns_name_fromwire(&name, source, dctx, options, target)); - - isc_buffer_activeregion(source, &sregion); - isc_buffer_availableregion(target, &tregion); - if (sregion.length < 2) - return (ISC_R_UNEXPECTEDEND); - if (tregion.length < 2) - return (ISC_R_NOSPACE); - - memmove(tregion.base, sregion.base, 2); - isc_buffer_forward(source, 2); - isc_buffer_add(target, 2); - - return (ISC_R_SUCCESS); -} - -static inline isc_result_t -towire_ch_a(ARGS_TOWIRE) { - dns_name_t name; - dns_offsets_t offsets; - isc_region_t sregion; - isc_region_t tregion; - - REQUIRE(rdata->type == dns_rdatatype_a); - REQUIRE(rdata->rdclass == dns_rdataclass_ch); - REQUIRE(rdata->length != 0); - - dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14); - - dns_name_init(&name, offsets); - - dns_rdata_toregion(rdata, &sregion); - - dns_name_fromregion(&name, &sregion); - isc_region_consume(&sregion, name_length(&name)); - RETERR(dns_name_towire(&name, cctx, target)); - - isc_buffer_availableregion(target, &tregion); - if (tregion.length < 2) - return (ISC_R_NOSPACE); - - memmove(tregion.base, sregion.base, 2); - isc_buffer_add(target, 2); - return (ISC_R_SUCCESS); -} - -#endif /* RDATA_CH_3_A_1_C */ Index: lib/dns/rdata/hs_4/a_1.c =================================================================== RCS file: lib/dns/rdata/hs_4/a_1.c diff -N lib/dns/rdata/hs_4/a_1.c --- lib/dns/rdata/hs_4/a_1.c 14 Sep 2020 08:39:12 -0000 1.11 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,82 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: a_1.c,v 1.11 2020/09/14 08:39:12 florian Exp $ */ - -/* reviewed: Thu Mar 16 15:58:36 PST 2000 by brister */ - -#ifndef RDATA_HS_4_A_1_C -#define RDATA_HS_4_A_1_C - -static inline isc_result_t -totext_hs_a(ARGS_TOTEXT) { - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_a); - REQUIRE(rdata->rdclass == dns_rdataclass_hs); - REQUIRE(rdata->length == 4); - - UNUSED(tctx); - - dns_rdata_toregion(rdata, ®ion); - return (inet_totext(AF_INET, ®ion, target)); -} - -static inline isc_result_t -fromwire_hs_a(ARGS_FROMWIRE) { - isc_region_t sregion; - isc_region_t tregion; - - REQUIRE(type == dns_rdatatype_a); - REQUIRE(rdclass == dns_rdataclass_hs); - - UNUSED(type); - UNUSED(dctx); - UNUSED(options); - UNUSED(rdclass); - - isc_buffer_activeregion(source, &sregion); - isc_buffer_availableregion(target, &tregion); - if (sregion.length < 4) - return (ISC_R_UNEXPECTEDEND); - if (tregion.length < 4) - return (ISC_R_NOSPACE); - - memmove(tregion.base, sregion.base, 4); - isc_buffer_forward(source, 4); - isc_buffer_add(target, 4); - return (ISC_R_SUCCESS); -} - -static inline isc_result_t -towire_hs_a(ARGS_TOWIRE) { - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_a); - REQUIRE(rdata->rdclass == dns_rdataclass_hs); - REQUIRE(rdata->length == 4); - - UNUSED(cctx); - - isc_buffer_availableregion(target, ®ion); - if (region.length < rdata->length) - return (ISC_R_NOSPACE); - memmove(region.base, rdata->data, rdata->length); - isc_buffer_add(target, 4); - return (ISC_R_SUCCESS); -} - -#endif /* RDATA_HS_4_A_1_C */
