tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: T_DNAME handling in getaddrinfo() and gethostname()
- Subject: Re: T_DNAME handling in getaddrinfo() and gethostname()
- From: Ignatios Souvatzis <is%netbsd.org@localhost>
- Date: Mon, 16 Nov 2020 09:51:01 +0100
Hi,
a correction of the obfuscated example:
On Fri, Nov 13, 2020 at 09:04:14PM +0100, Ignatios Souvatzis wrote:
>
> I connect to machines below foo.example.de, which is a convenience domain
> otherwise identical to the german-language and much slower to type
> fumfiefoebarbaz.example.de, and foo happens to be the two letter acronym
> for the english translation of fumfiefoebarbaz.
>
> In the new world order, the admins have replaced the include file
> mess with a DNAME record, redirecting
foo.example.de to fumfiefoebarbaz.example.de
> This works fine, but the programs on my netbsd machines connecting there
> spam the console log with syslog messages about getting DNAME answers
> when they expected AAAA and A (which are send as additional info by the
> recursive resolver daemon).
>
> I investigated in the sources, and found that getaddrinfo() and
> gethnamaddr() - the latter being the core of the implementation
> for gethostbyname() and gethostbyaddr() - special-case T_CNAME,
> T_SIG and T_KEY answers in the result returned, but not T_DNAME.
>
> While a full handling of T_DNAME seems to complicated - we'd need to
> splice in the new domain instead of the old in the query - it also
> isn't necessary, as the resolver daemon already does all the work - see
>
>
> ;; QUESTION SECTION:
> ;qq.foo.example.de. IN A
>
> ;; ANSWER SECTION:
> foo.example.de. 1772 IN DNAME fumfiefoebarbaz.example.de.
> qq.foo.example.de. 1772 IN CNAME qq.fumfiefoebarbaz.example.de.
> qq.fumfiefoebarbaz.example.de. 3200 IN A 192.0.2.63
>
>
> So all that remains to do is to suppress the syslog call also in this
> case. Patch below; I'll commit unless technical serious objections are
> raised (Tested on -9.0_ish machine, compiles on -current, no code
> differences).
>
> Regards
> -is
>
>
> Index: include/arpa/nameser_compat.h
> ===================================================================
> RCS file: /cvsroot/src/include/arpa/nameser_compat.h,v
> retrieving revision 1.7
> diff -u -r1.7 nameser_compat.h
> --- include/arpa/nameser_compat.h 28 Jun 2020 02:16:19 -0000 1.7
> +++ include/arpa/nameser_compat.h 13 Nov 2020 19:17:44 -0000
> @@ -210,6 +210,7 @@
> #define T_ATMA ns_t_atma
> #define T_NAPTR ns_t_naptr
> #define T_A6 ns_t_a6
> +#define T_DNAME ns_t_dname
> #define T_TSIG ns_t_tsig
> #define T_IXFR ns_t_ixfr
> #define T_AXFR ns_t_axfr
> Index: lib/libc/net/getaddrinfo.c
> ===================================================================
> RCS file: /cvsroot/src/lib/libc/net/getaddrinfo.c,v
> retrieving revision 1.119
> diff -u -r1.119 getaddrinfo.c
> --- lib/libc/net/getaddrinfo.c 13 Dec 2018 04:41:41 -0000 1.119
> +++ lib/libc/net/getaddrinfo.c 13 Nov 2020 19:17:45 -0000
> @@ -1821,7 +1821,7 @@
> continue;
> }
> } else if (type != qtype) {
> - if (type != T_KEY && type != T_SIG) {
> + if (type != T_KEY && type != T_SIG && type != T_DNAME) {
> struct syslog_data sd = SYSLOG_DATA_INIT;
> syslog_r(LOG_NOTICE|LOG_AUTH, &sd,
> "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
> Index: lib/libc/net/gethnamaddr.c
> ===================================================================
> RCS file: /cvsroot/src/lib/libc/net/gethnamaddr.c,v
> retrieving revision 1.92
> diff -u -r1.92 gethnamaddr.c
> --- lib/libc/net/gethnamaddr.c 22 Sep 2015 16:16:02 -0000 1.92
> +++ lib/libc/net/gethnamaddr.c 13 Nov 2020 19:17:45 -0000
> @@ -358,7 +358,7 @@
> continue;
> }
> if (type != qtype) {
> - if (type != T_KEY && type != T_SIG)
> + if (type != T_KEY && type != T_SIG && type != T_DNAME)
> syslog(LOG_NOTICE|LOG_AUTH,
> "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
> qname, p_class(C_IN), p_type(qtype),
Home |
Main Index |
Thread Index |
Old Index