Le 2009-03-10 02:48, Yutaka Sato a écrit : > Hi Guillaume, Hi Yutaka, > In message<_A4391@delegate-en.ML_> on 03/10/09(08:01:49) > you Guillaume de Rorthais<pe4iqbdyi.ml@delegate.org> wrote: > |I am trying to set up Delegate as a DNS server with domain wildcard support. > > It is interesting how did you find the tentative feature :) Well, I did my best considering the time I had :) > |I read many time the Manual, trying many different solutions (with HOSTS > |as instance), but I couldn't make it works. > > Oh, you should have asked after a glance at it. > DeleGate tries to pick up all of multiple IP-addresses of a host in > a hosts-file, and it could be bad with wildcard host names. Yeah I figured that :) But I didn't want to bother you before being sure Delegate wasn't actually supporting this feature. > |As the Manual says that current DNS server doesn't support CNAME in the > |serv_DNS part, I wonder if there's a way to simulate it. > | > |It seems to me, the best way to support it would be to add alias names > |from a hosts file as CNAME entries. This way, a line like: > |a.a.a.a domain.com *.domain.com > | > |would means: > |domain.com IN A a.a.a.a > |*.domain.com IN CNAME a.a.a.a > > It could be. > > |I hadn't many time to investigate further, but I tried the following > |patch to handle my issue: > ... > |I understand it is highly touchy and probably break or make Delegate act > |uncorreclty, but at least, it stop parsing the entries at the first match. > | > |Your expertise and feedback on this issue would be greatly appreciated. > > Your requirement seems very reasonable but since the DeleGate ver.9 is > in its final stage to be stable and finished, I can't dare to modify it > in the way affecting the current behavior. So I'll add a directive to > control it in a hosts-file as a comment to be ignored by existing > versions, which might be useful for extensions in future :) > It is "#!max=N" to restrict the number of records to be found. > You can insert it in a hosts-file as this: > > #!max=1 > a.a.a.a domain.com *.domain.com > a.a.a.b test1.domain.com > a.a.a.c test2.domain.com That's fine enough ! Thank you for this patch, it gonna make the trick of our needs. Let me know if you need further tests or if I can help in any way in the future. > Cheers, Cheers, > Yutaka > -- > 9 9 Yutaka Sato<y.sato@delegate.org> http://delegate.org/y.sato/ > ( ~ ) National Institute of Advanced Industrial Science and Technology > _< >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan > Do the more with the less -- B. Fuller > > > *** dist/src/delegate9.9.2-pre5/resolvy/reshost.c Tue Jan 27 12:53:55 2009 > --- ./resolvy/reshost.c Tue Mar 10 15:09:42 2009 > *************** > *** 861,866 **** > --- 861,868 ---- > datap = (char*)&hp->h_buff[peak+2]; > if( fgets(datap,1024,fp) == NULL ) > break; > + if( strneq(datap,"#!",2) ){ > + }else > if( cp = strpbrk(datap,"#\r\n") ){ > truncVStr(cp); cp--; > while( datap<= cp&& (*cp == ' ' || *cp == '\t') ){ > *************** > *** 886,891 **** > --- 888,894 ---- > const char *lp; > int leng; > int hi; > + int opt_addr_max = -1; > > hp =&Hosts[0]; > for( hi = 0; hi< elnumof(Hosts)-1; hi++ ){ > *************** > *** 922,927 **** > --- 925,940 ---- > > ac = 0; > for( lp = hp->h_buff; leng = (lp[0]<<8|lp[1]&0xFF); lp += leng+3 ){ > + if( lp[2] == '#' ){ > + if( strneq(lp+2,"#!",2) ){ > + if( strneq(lp+2+2,"max=",4) ){ > + opt_addr_max = atoi(lp+2+2+4); > + } > + } > + } > + if( 0<= opt_addr_max&& opt_addr_max<= ac ){ > + break; > + } > ac += RES_matchLine(path,byname,name,lp+2,rrc-ac,&rv[ac],AVStr(rb),AVStr(cname)); > rb = rv[ac]; > } >