why doesn't generate support a records?

Steinar Haug sthaug at nethelp.no
Fri Jun 25 19:17:46 UTC 1999


[Joe Pruett]

|   i often setup dhcp pools like this:
|   
|   dhcp-100	IN	A	192.168.1.100
|   dhcp-101	IN	A	192.168.1.101
|   etc.
|   
|   using $GENERATE would be nice, but it doesn't do a records.  i've looked
|   at the code a little bit and it seems like it should be able to be added
|   in.  am i missing something?

The original GENERATE patch that I sent to ISC would generate A records.
But I'm sure there was something I overlooked, since this was changed in
the version that was included in 8.2.1.

Excerpt from the patch below.

Steinar Haug, Nethelp consulting, sthaug at nethelp.no
----------------------------------------------------------------------
From: sthaug at nethelp.no
To: bind-workers at vix.com
Subject: Re: Has Mark Andrews' CIDR patch been considered for 8.1.2?
Date: Tue, 07 Apr 1998 14:49:38 +0200

...
I believe I now have a suitable patch for 8.1.2-T3A which implements
Mark Andrews' suggested syntax. Note that in this implementation the
iterator is allowed to appear *within* a string, not just at the
beginning. So you can do

$ORIGIN 10.36.158.in-addr.arpa.
$GENERATE 1-31 * CNAME *.0.10.36.158.in-addr.arpa.

to generate

1.10.36.158.in-addr.arpa.	CNAME	1.0.10.36.158.in-addr.arpa.
..
31.10.36.158.in-addr.arpa.	CNAME	31.0.10.36.158.in-addr.arpa.

and for instance

$ORIGIN uninett.no.
$GENERATE 1-255 pc*.uninett.no. A 158.38.60.*

to generate a bunch of anonymous names for PCs.
...
+ 				/* We only handle CNAME, PTR and A so far */
+ 				sprintf(data, gen_buf, i);
+ 				switch (type) {
+ 				case ns_t_cname:
+ 					context = domain_ctx;
+ 					break;
+ 				case ns_t_ptr:
+ 					context = ns_ptrcontext(domain);
+ 					break;
+ 				case ns_t_a:
+ 					context = domain_ctx;
+ 					if (!inet_aton(data, &ina))
+ 						ERRTO("$GENERATE IP address");
+ 					(void) ina_put(ina, data);
+ 					n = NS_INT32SZ;
+ 					break;


More information about the bind-users mailing list