This may not be the best way to handle this, but it was the first fix to come to mind. Not sure where to put this in the manual or if its even worth documenting. Thoughts?

Thanks,

Edgar

Index: dig.c
===================================================================
RCS file: /cvs/src/usr.sbin/bind/bin/dig/dig.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 dig.c
--- dig.c	5 Jun 2016 15:09:17 -0000	1.17
+++ dig.c	21 May 2017 19:48:09 -0000
@@ -1053,7 +1053,7 @@ plus_option(char *option, isc_boolean_t 
 /*%
  * #ISC_TRUE returned if value was used
  */
-static const char *single_dash_opts = "46dhimnv";
+static const char *single_dash_opts = "46dhimnrv";
 static const char *dash_opts = "46bcdfhikmnptvyx";
 static isc_boolean_t
 dash_option(char *option, char *next, dig_lookup_t **lookup,
@@ -1121,6 +1121,9 @@ dash_option(char *option, char *next, di
 			break;
 		case 'n':
 			/* deprecated */
+			break;
+		case 'r':
+			rebound = ISC_TRUE;
 			break;
 		case 'v':
 			version();
Index: include/dig/dig.h
===================================================================
RCS file: /cvs/src/usr.sbin/bind/bin/dig/include/dig/dig.h,v
retrieving revision 1.8
diff -u -p -u -r1.8 dig.h
--- include/dig/dig.h	16 Aug 2009 13:17:44 -0000	1.8
+++ include/dig/dig.h	21 May 2017 19:47:52 -0000
@@ -274,7 +274,7 @@ extern isc_boolean_t validated;
 extern isc_taskmgr_t *taskmgr;
 extern isc_task_t *global_task;
 extern isc_boolean_t free_now;
-extern isc_boolean_t debugging, memdebugging;
+extern isc_boolean_t debugging, memdebugging, rebound;
 
 extern char *progname;
 extern int tries;
Index: dighost.c
===================================================================
RCS file: /cvs/src/usr.sbin/bind/bin/dig/dighost.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 dighost.c
--- dighost.c	28 Sep 2015 15:55:54 -0000	1.15
+++ dighost.c	21 May 2017 19:47:27 -0000
@@ -118,6 +118,7 @@ isc_boolean_t
 	showsearch = ISC_FALSE,
 	qr = ISC_FALSE,
 	is_dst_up = ISC_FALSE;
+isc_boolean_t rebound;
 in_port_t port = 0;
 unsigned int timeout = 0;
 unsigned int extrabytes;
@@ -2854,17 +2855,19 @@ recv_done(isc_task_t *task, isc_event_t 
 		* sent to 0.0.0.0, :: or to a multicast addresses.
 		* XXXMPA broadcast needs to be handled here as well.
 		*/
-		if ((!isc_sockaddr_eqaddr(&query->sockaddr, &any) &&
-		     !isc_sockaddr_ismulticast(&query->sockaddr)) ||
-		    isc_sockaddr_getport(&query->sockaddr) !=
-		    isc_sockaddr_getport(&sevent->address)) {
-			isc_sockaddr_format(&sevent->address, buf1,
-			sizeof(buf1));
-			isc_sockaddr_format(&query->sockaddr, buf2,
-			sizeof(buf2));
-			printf(";; reply from unexpected source: %s,"
-			" expected %s\n", buf1, buf2);
-			match = ISC_FALSE;
+		if (!rebound) {
+			if ((!isc_sockaddr_eqaddr(&query->sockaddr, &any) &&
+		     		!isc_sockaddr_ismulticast(&query->sockaddr)) ||
+		    		isc_sockaddr_getport(&query->sockaddr) !=
+		    		isc_sockaddr_getport(&sevent->address)) {
+					isc_sockaddr_format(&sevent->address, buf1,
+					sizeof(buf1));
+					isc_sockaddr_format(&query->sockaddr, buf2,
+					sizeof(buf2));
+					printf(";; reply from unexpected source: %s,"
+					" expected %s\n", buf1, buf2);
+					match = ISC_FALSE;
+			}
 		}
 	}
 

Reply via email to