8.2.1 multiple-cnames broken

Mark_Andrews at isc.org Mark_Andrews at isc.org
Sat Jun 26 03:14:26 UTC 1999


> Version 8.2.1 seems to have broken multiple-cnames support.  I'm
> currently running 8.1.2, and have multiple-cnames enabled.  This allows
> me to set up a name that has several CNAMEs attached to it, each of
> those is a round robin with a couple dozen IP addresses.  I can't put
> them all in one record, because many resolvers can't handle more than
> about 30 records returned.  But I want to round robin among them all (for
> load balancing student logins to our workstations)  When I do repeated
> lookups of these records under 8.2.1 I keep getting the same one
> returned over and over again, so only 1/3 of my machines would get all
> the remote user load.
> 
> Any chance of a patch for this without having to wait for the next
> release?  I don't have any really compelling reason to go to 8.2.1, but
> I like to stay current when possible.  I didn't go to 8.2 because of
> compilation errors due to uninitialized variables that had me a bit
> worried.  I reported that back in March and was told the fixes would be
> in 8.2.1.  They were, but now I can't use it either :)
> 
> (I am mailing this to bind-bugs as well)
> 
> -- 
> Douglas Siebert                Director of Computing Facilities
> douglas-siebert at uiowa.edu      Division of Mathematical Sciences, U of Iowa
> 
> I plan to live forever, or die trying.
> 
> 

Index: src/bin/named/ns_resp.c
===================================================================
RCS file: /proj/cvs/isc/bind/src/bin/named/ns_resp.c,v
retrieving revision 8.109
diff -c -r8.109 ns_resp.c
*** ns_resp.c	1999/06/21 02:21:25	8.109
--- ns_resp.c	1999/06/26 03:00:59
***************
*** 2929,2934 ****
--- 2938,2944 ----
   	int defer = 0, found_count = 0, choice, i;
   	struct databuf *found[MAX_FOUND];
  	struct databuf *tmpfound[MAX_FOUND];
+ 	int foundcname;
  #endif
  
  	n = delete_stale(np);
***************
*** 3113,3122 ****
--- 3123,3134 ----
  			    (type != T_NXT) &&
  			    (type != T_ANY)) {	/* or T_NS? */
  				new_dnamep = (char *)dp->d_data;
+ #if defined(NO_RRSET_ORDER)
  				/*
  				 * Only return first CNAME found.
  				 */
  				break;
+ #endif
  			}
  		}
  	}
***************
*** 3209,3218 ****
--- 3221,3235 ----
  			}
  		}
  
+ 		foundcname = 0;
  		switch (order) {
  		case fixed_order:
  			for (i = 0; i < found_count; i++) {
  				dp = found[i];
+ 				if (foundcname != 0 && dp->d_type == T_CNAME)
+ 					continue;
+ 				if (dp->d_type == T_CNAME)
+ 					foundcname = 1;
  				if ((n = make_rr(*dnamep, dp, (u_char *)cp,
  						 buflen, 1,
  						 dnptrs, dnptrs_end, 0)) < 0) {
***************
*** 3236,3241 ****
--- 3253,3262 ----
  				non_sig_count--;
  				dp = found[choice];
  				found[choice] = found[non_sig_count];
+ 				if (foundcname != 0 && dp->d_type == T_CNAME)
+ 					continue;
+ 				if (dp->d_type == T_CNAME)
+ 					foundcname = 1;
  				if ((n = make_rr(*dnamep, dp, (u_char *)cp,
  						 buflen, 1,
  						 dnptrs, dnptrs_end, 0)) < 0) {
***************
*** 3276,3304 ****
  
  		case cyclic_order:
  			/* first we do the non-SIG records */
! 			if (non_sig_count > 0) {
! 				choice = ((u_int)rand()) % non_sig_count;
! 				i = choice;
! 				do {
! 					dp = found[i];
! 					if ((n = make_rr(*dnamep, dp,
! 							 (u_char *)cp,
! 							 buflen, 1,
! 							 dnptrs,
! 							 dnptrs_end, 0)) < 0) {
! 						hp->tc = 1;
! 						*countp = count;
! 						return (*lenp - buflen);
! 					}
! 					if (dp->d_secure != DB_S_SECURE)
! 						hp->ad = 0;
! 					cp += n;
! 					buflen -= n;
! 					count++;
! 					i++;
! 					if (i >= non_sig_count)
! 						i = 0;
! 				} while (i != choice);
  			}
  
  			/* now do the SIG record rotation. */
--- 3297,3321 ----
  
  		case cyclic_order:
  			/* first we do the non-SIG records */
! 			choice = ((u_int)rand()) % non_sig_count;
! 			for (i = 0; i < non_sig_count ; i++) {
! 				dp = found[(i + choice) % non_sig_count];
! 				if (foundcname != 0 && dp->d_type == T_CNAME)
! 					continue;
! 				if (dp->d_type == T_CNAME)
! 					foundcname = 1;
! 				if ((n = make_rr(*dnamep, dp, (u_char *)cp,
! 						 buflen, 1,
! 						 dnptrs, dnptrs_end, 0)) < 0) {
! 					hp->tc = 1;
! 					*countp = count;
! 					return (*lenp - buflen);
! 				}
! 				if (dp->d_secure != DB_S_SECURE)
! 					hp->ad = 0;
! 				cp += n;
! 				buflen -= n;
! 				count++;
  			}
  
  			/* now do the SIG record rotation. */
***************
*** 3327,3333 ****
  						i = first_sig;
  				} while (i != choice);
  			}
- 
  			
  			break;
  
--- 3344,3349 ----
--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: marka at isc.org


More information about the bind-users mailing list