Commit Diff
Diff:
6d6e8a4eafe96f39266e6d0c1c446cc9ffbb81c8
37ff8ff878468bbff55ff911be0b2d64ce7eb7f9
Commit:
37ff8ff878468bbff55ff911be0b2d64ce7eb7f9
Tree:
41c29a9ea5a2713feac3b2c6f9fa9325585ff544
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Thu Apr 23 06:28:28 2020 UTC
Message:
Add the tcp-on-any-only flag to options. This replies with a TC (truncate) on any non-tcp request, causing determined clients to retry in TCP mode. It is long overdue to have this option, and the fix was very simple to do.
blob - 304050772b4f7a541763a27e031b8fcc963d6bfc
blob + f7e1e60f7c40de5a1c99e17c5f2ee2186dbd118b
--- CHANGES
+++ CHANGES
@@ -7,6 +7,8 @@ Changes in RELEASE_1_5 from RELEASE_1_4
- multiple RRSIG's are now working without bugs
- fixed the random time restart algorithm to restart at only 1 desired time
which increases the odds that replicants won't do it at the same time.
+- ANY replies have the option now to be forced to TCP only with the
+ tcp-on-any-only option.
Changes in RELEASE_1_4 from RELEASE_1_3
blob - 27b00333fe7b0f6d8d208a507b7c077edffcedb0
blob + 148b3c13c4a10cbf21f1b3f024aeddca9ff3f6a5
--- delphinusdns.conf.5
+++ delphinusdns.conf.5
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2014-2019 Peter J. Philipp
+.\" Copyright (c) 2014-2020 Peter J. Philipp
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -60,6 +60,7 @@ options "cool stuff" {
;fork 2;
log;
;dnssec;
+ ;tcp-on-any-only;
}
axfrport "10053";
@@ -215,13 +216,14 @@ comment = ( ; | pound ) line
options = "options" ("string") [ "{" optionlist "}" ]
optionlist = ( optrecurse | optinterface | optfork | optport |
- optratelimit | optbind | optdnssec )
+ optratelimit | optbind | optdnssec | opttcponanyonly)
optrecurse = "recurse" ;
optinterface = "interface" ("string") ;
optfork = "fork" number ;
optratelimit = "ratelimit-pps" number ;
optbind = "bind" cidr-address ;
optdnssec = "dnssec" ;
+opttcponanyonly = "tcp-on-any-only" ;
.Ed
.Sh FILES
blob - ed870637772d11a89f7d0e94e73c3b2010cd34b6
blob + 53f3ac90a42558a461a974e1fa018bd3b2fd7cf5
--- parse.y
+++ parse.y
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2019 Peter J. Philipp. All rights reserved.
+ * Copyright (c) 2014-2020 Peter J. Philipp. All rights reserved.
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -21,7 +21,7 @@
*/
/*
- * $Id: parse.y,v 1.95 2020/04/11 07:15:22 pjp Exp $
+ * $Id: parse.y,v 1.96 2020/04/23 06:28:28 pjp Exp $
*/
%{
@@ -197,6 +197,7 @@ int axfrport = 0;
time_t time_changed;
int dnssec = 0;
int raxfrflag = 0;
+int tcpanyonly = 0;
char *check_rr(char *, char *, int, int *);
int fill_a(char *, char *, int, char *);
@@ -1216,6 +1217,9 @@ optionsstatement:
} else if (strcasecmp($1, "log") == 0) {
dolog(LOG_DEBUG, "logging on\n");
lflag = 1;
+ } else if (strcasecmp($1, "tcp-on-any-only") == 0) {
+ dolog(LOG_DEBUG, "TCP on ANY only\n");
+ tcpanyonly = 1;
}
}
}
blob - e0fdfa6788d82724d048e2289f98b396f1a84857
blob + 4380e4b54906b68046091b5ba37d21b4933b1883
--- reply.c
+++ reply.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2019 Peter J. Philipp
+ * Copyright (c) 2005-2020 Peter J. Philipp
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
*/
/*
- * $Id: reply.c,v 1.99 2020/04/01 11:42:01 pjp Exp $
+ * $Id: reply.c,v 1.100 2020/04/23 06:28:28 pjp Exp $
*/
#include <sys/types.h>
@@ -147,7 +147,7 @@ char * convert_name(char *name, int namelen);
int count_dots(char *name);
char * base32hex_encode(u_char *input, int len);
-extern int debug, verbose, dnssec;
+extern int debug, verbose, dnssec, tcpanyonly;
extern char *versionstring;
extern uint8_t vslen;
@@ -5436,6 +5436,21 @@ reply_any(struct sreply *sreply, ddDB *db)
odh->nsrr = 0;
odh->additional = 0;
+
+ /*
+ * Check if we're UDP and have the tcp-on-any-only option set
+ */
+ if (!istcp && tcpanyonly == 1) {
+ NTOHS(odh->query);
+ SET_DNS_TRUNCATION(odh);
+ HTONS(odh->query);
+ odh->answer = 0;
+ odh->nsrr = 0;
+ odh->additional = 0;
+ outlen = rollback;
+ goto skip;
+ }
+
outlen = create_anyreply(sreply, (char *)reply, replysize, outlen, 1);
if (outlen == 0) {
return (retlen);
@@ -5446,6 +5461,7 @@ reply_any(struct sreply *sreply, ddDB *db)
outlen = rollback;
}
+skip:
if (q->edns0len) {
/* tag on edns0 opt record */
repomaster@centroid.eu