Re: Fwd: New Version Notification for draft-wouters-edns-tcp-keepalive-00.txt (fwd)

Mark Andrews <[email protected]>
Newsgroups gmane.ietf.dnsext
Message-ID <[email protected]>
In message <[email protected]>, Mark Andrews writes:
> 
> In message <[email protected]>, Paul Wouters
>  w
> rites:
> > On Sat, 19 Oct 2013, Mark Andrews wrote:
> > 
> > >>> An RFC 5966 server supports persistent TCP but does not advertise this
> > >>> fact.
> > >>
> > >> I hope to have some measurements done in time for Vancouver to see what
> > >> the percentage of queries/servers is where this is a problem. That could
> > >> help assess whether or not we still need a special indication via edns
> > >> or not.
> > >
> > > Why?  Clients should be able to handle the connection being closed
> > > unexpectedly and retry any uncompleted queries.
> > 
> > I'm trying to reduce dns(sec) latency, not adding more repeating tcp
> > failures. If it turns out that most obtained DNS resolvers are useless
> > for TCP than there is a need to give a clear indication to a client
> > that a resolver does work well.
> > 
> > The question is how pervasive are rfc 5966 compliant resolvers out
> > there, and whether there is a need to advertise those who are.
> > 
> > Paul
> 
> All DNS servers should already handle multiple questions over a TCP
> socket.  This is *basic* RFC 1035.  Just send the queries and deal
> with the fact that you may have broken servers. 
> 
> Adding a new option often the worst thing you can do to fix a failure
> to follow specification.  It is definitely not needed to fix this
> problem.
> 
> Just write a RFC with a title like "Common DNS server errors in
> handling queries over TCP" which points out that DNS servers are
> expected to handle multiple queries over TCP.  Then a user has a
> second clue bat to go beat the vendor over the head with.
> 
> Mark
> -- 
> Mark Andrews, ISC
> 1 Seymour St., Dundas Valley, NSW 2117, Australia
> PHONE: +61 2 9871 4742                 INTERNET: [email protected]
> _______________________________________________
> dnsext mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/dnsext

Just so you can have a something to test with I hacked dig to keep
the tcp socket open.  It needs more work to be production quality.

	dig @server +tcp -f querylist

Now I know named handles multiple queries over a socket.
Perhaps others can report what works for them.

Mark

diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
index 79b11d0..a10742a 100644
--- a/bin/dig/dighost.c
+++ b/bin/dig/dighost.c
@@ -120,7 +120,8 @@ isc_boolean_t
 	usesearch = ISC_FALSE,
 	showsearch = ISC_FALSE,
 	qr = ISC_FALSE,
-	is_dst_up = ISC_FALSE;
+	is_dst_up = ISC_FALSE,
+	keep_open = ISC_TRUE;
 in_port_t port = 53;
 unsigned int timeout = 0;
 unsigned int extrabytes;
@@ -151,6 +152,8 @@ static void		idn_check_result(idn_result_t r, const char *msg);
 int  idnoptions	= 0;
 #endif
 
+isc_socket_t *keep = NULL;
+
 /*%
  * Exit Codes:
  *
@@ -2339,6 +2342,16 @@ send_tcp_connect(dig_query_t *query) {
 	}
 
 	INSIST(query->sock == NULL);
+
+	if (keep != NULL) {
+fprintf(stderr, "REUSING socket\n");
+		sockcount++;
+		isc_socket_attach(keep, &query->sock);
+		query->waiting_connect = ISC_FALSE;
+		launch_next_query(query, ISC_TRUE);
+		goto search;
+	}
+	
 	result = isc_socket_create(socketmgr,
 				   isc_sockaddr_pf(&query->sockaddr),
 				   isc_sockettype_tcp, &query->sock);
@@ -2361,6 +2374,7 @@ send_tcp_connect(dig_query_t *query) {
 	result = isc_socket_connect(query->sock, &query->sockaddr,
 				    global_task, connect_done, query);
 	check_result(result, "isc_socket_connect");
+ search:
 	/*
 	 * If we're at the endgame of a nameserver search, we need to
 	 * immediately bring up all the queries.  Do it here.
@@ -2725,6 +2739,12 @@ connect_done(isc_task_t *task, isc_event_t *event) {
 		UNLOCK_LOOKUP;
 		return;
 	}
+	if (keep_open) {
+fprintf(stderr, "SAVING socket\n");
+		if (keep != NULL)
+			isc_socket_detach(&keep);
+		isc_socket_attach(query->sock, &keep);
+	}
 	launch_next_query(query, ISC_TRUE);
 	isc_event_free(&event);
 	UNLOCK_LOOKUP;
@@ -3541,6 +3561,9 @@ destroy_libs(void) {
 	isc_result_t result;
 #endif
 
+	fprintf(stderr, "CLOSING socket\n");
+	if (keep != 0)
+		isc_socket_detach(&keep);
 	debug("destroy_libs()");
 	if (global_task != NULL) {
 		debug("freeing task");
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: [email protected]
_______________________________________________
dnsext mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/dnsext
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.