Message ID | 534043D6.9090500@reverze.net |
---|---|
State | Superseded |
Headers | show |
Bernard, I have not seen my email appearing in the mailinglist, i just noticed. Did you receive this? Cheers, Michel On 04/05/2014 07:56 PM, Michel Stam wrote: > Hello Bernard, > > Sorry for my late response. I was not able to test the patch sooner. > > I tested it now, but it does not work in my specific situation, as the > SERVFAIL returned by tmdns (which is a temporary failure) makes the > whole lookup fail. The next nameserver in the list is not tried in > that case. If i change the following if statement around line 1464 in > libc/inet/resolv.c, > > if (h.rcode==REFUSED) { > should become: > > if ((h.rcode ==REFUSED)||(h.rcode==SERVFAIL)) { > > then things seem to work. See also my attached patch, which should be > applied on top of yours. > > Again, sorry for my tardiness. > > Cheers, > > Michel > > On 03/27/2014 08:06 AM, Bernhard Reutner-Fischer wrote: >> On 17 March 2014 20:23, Michel Stam <michel@reverze.net> wrote: >>> Thanks Bernhard. >>> >>> Cheers >>> >>> Michel Stam >>> >>> >>>> On 17 mrt. 2014, at 20:19, "Bernhard Reutner-Fischer" >>>> <rep.dot.nop@gmail.com> wrote: >>>> >>>>> On 13 March 2014 11:43:05 Michel Stam <michel.uclibc@reverze.net> >>>>> wrote: >>>>> >>>>> Dear mailing list, >>>>> >>>>> I have seen very little response on this topic; Would it be >>>>> possible to apply this patch to trunk? >>>> I'm verifying the patch right now, will apply it afterwards. Will >>>> followup in the push. >>>> >>>> Thanks! >>>>> I would like to add that without this patch, the behaviour in >>>>> uClibc differs from glibc. >>>>> >>>>> Best regads, >>>>> >>>>> Michel Stam >>>>> On 03/03/2014 11:46 AM, Michel Stam wrote: >>>>>> Commit e1420eca7374cd8f583e9d774c890645a205aaee fixed a bug where a >>>>>> response code should mean the next server is tried. However, it >>>>>> tries >>>>>> only the next search domain, and never skips to the next server. >>>>>> >>>>>> In my specific situation, I was using tmdns as a DNS -> mDNS >>>>>> bridge to resolve mDNS names. tmdns returns SERVFAIL on any >>>>>> domain that does not end in .local. >>>>>> >>>>>> uClibc then tries all the search domains in /etc/resolv.conf and >>>>>> gives up, not jumping to the next nameserver in the list (in my >>>>>> case the real nameserver). Thus, any non-.local domain never got >>>>>> resolved. >>>>>> >>>>>> My resolv.conf; >>>>>> domain bla.net >>>>>> search bla.net >>>>>> nameserver 127.0.0.1 >>>>>> nameserver 172.16.1.1 >>>>>> >>>>>> The patch I have attached basically allows SERVFAIL to go back to >>>>>> the case as it was before 0.9.32, except that search domains are >>>>>> still tried. >>>>>> >> Not entirely happy with that. >> How about the attached instead, without looking at the size(1) >> implications yet? >> >> Revert e1420eca7374cd8f583e9d774c890645a205aaee >> Rephrase __dns_lookup rcode handling to fix bug 660 and fix ???? as >> reported by Michel Stam. >> >> Details: >> # Dynamic resolv.conf(5) file for glibc resolver(3) generated by >> resolvconf(8) >> # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN >> nameserver 193.170.61.4 >> nameserver 193.170.61.5 >> #nameserver 131.130.250.130 >> nameserver 192.168.100.42 >> search loc lane wifi wien berlin ac.at at >> >> $ for i in nxdomain univie nic;do echo "# $i";./ghbn $i;echo >> "#############################################";done >> # nxdomain >> argc=2 argv=0x7fffd5941508 envp=0x7fffd5941520 >> ELF header=0x7f3dd946f000 >> First Dynamic section entry=0x7f3dd9678ea0 >> Scanning DYNAMIC section >> Done scanning DYNAMIC section >> About to do library loader relocations >> Done relocating ldso; we can now use globals and make function calls! >> _dl_get_ready_to_run:450: Cool, ldso survived making function calls >> _dl_malloc:240: mmapping more memory >> _dl_ldsopath_init:156: Lib Loader: (0xd946f000) >> /scratch/src/uClibc.push7/lib/ld64-uClibc.so.0: using path: >> /scratch/src/uClibc.push7/lib >> _dl_load_elf_shared_library:772: Found TLS header for >> /scratch/src/uClibc.push7/lib/libc.so.0 >> _dl_load_elf_shared_library:799: Relocated TLS initial image from >> 0x2ca968 to 0x7f3dd9466968 (size = 0x8) >> _dl_get_ready_to_run:1053: Loading: (0x7f3dd919c000) >> /scratch/src/uClibc.push7/lib/libc.so.0 >> _dl_get_ready_to_run:1053: Loading: (0x7f3dd946f000) >> /scratch/src/uClibc.push7/lib/ld64-uClibc.so.0 >> _dl_get_ready_to_run:1194: Calling init_tls()! >> _dl_malloc:240: mmapping more memory >> _dl_malloc:240: mmapping more memory >> _dl_get_ready_to_run:1296: Beginning relocation fixups >> _dl_get_ready_to_run:1326: Calling _dl_allocate_tls_init()! >> transfering control to application @ 0x400550 >> Nothing found in /etc/hosts >> Looking up type 1 answer for 'nxdomain' >> adding search loc >> adding search lane >> adding search wifi >> adding search wien >> adding search berlin >> adding search ac.at >> adding search at >> nameservers = 3 >> encoding header >> lookup name: nxdomain >> On try 8, sending query to 193.170.61.4, port 53 >> Xmit packet len:26 id:2 qr:0 >> len:26 id:2 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=0,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=0,rcode=5 >> encoding header >> lookup name: nxdomain >> On try 7, sending query to 193.170.61.5, port 53 >> Xmit packet len:26 id:3 qr:0 >> len:26 id:3 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=0,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=0,rcode=5 >> encoding header >> lookup name: nxdomain >> On try 6, sending query to 192.168.100.42, port 53 >> Xmit packet len:26 id:4 qr:0 >> len:101 id:4 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=3 >> variant:-1 sdomains:7 >> encoding header >> lookup name: nxdomain.loc >> On try 5, sending query to 192.168.100.42, port 53 >> Xmit packet len:30 id:5 qr:0 >> len:81 id:5 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:0 sdomains:7 >> encoding header >> lookup name: nxdomain.lane >> On try 4, sending query to 192.168.100.42, port 53 >> Xmit packet len:31 id:6 qr:0 >> len:85 id:6 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:1 sdomains:7 >> encoding header >> lookup name: nxdomain.wifi >> On try 3, sending query to 192.168.100.42, port 53 >> Xmit packet len:31 id:7 qr:0 >> len:85 id:7 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:2 sdomains:7 >> encoding header >> lookup name: nxdomain.wien >> On try 2, sending query to 192.168.100.42, port 53 >> Xmit packet len:31 id:8 qr:0 >> len:98 id:8 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=3 >> variant:3 sdomains:7 >> encoding header >> lookup name: nxdomain.berlin >> On try 1, sending query to 192.168.100.42, port 53 >> Xmit packet len:33 id:9 qr:0 >> len:100 id:9 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=3 >> variant:4 sdomains:7 >> encoding header >> lookup name: nxdomain.ac.at >> On try 0, sending query to 192.168.100.42, port 53 >> Xmit packet len:32 id:10 qr:0 >> len:96 id:10 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=3 >> variant:5 sdomains:7 >> __dns_lookup returned < 0 >> ERROR: : Resolver error >> ############################################# >> # univie >> argc=2 argv=0x7ffff9da32a8 envp=0x7ffff9da32c0 >> ELF header=0x7f517874d000 >> First Dynamic section entry=0x7f5178956ea0 >> Scanning DYNAMIC section >> Done scanning DYNAMIC section >> About to do library loader relocations >> Done relocating ldso; we can now use globals and make function calls! >> _dl_get_ready_to_run:450: Cool, ldso survived making function calls >> _dl_malloc:240: mmapping more memory >> _dl_ldsopath_init:156: Lib Loader: (0x7874d000) >> /scratch/src/uClibc.push7/lib/ld64-uClibc.so.0: using path: >> /scratch/src/uClibc.push7/lib >> _dl_load_elf_shared_library:772: Found TLS header for >> /scratch/src/uClibc.push7/lib/libc.so.0 >> _dl_load_elf_shared_library:799: Relocated TLS initial image from >> 0x2ca968 to 0x7f5178744968 (size = 0x8) >> _dl_get_ready_to_run:1053: Loading: (0x7f517847a000) >> /scratch/src/uClibc.push7/lib/libc.so.0 >> _dl_get_ready_to_run:1053: Loading: (0x7f517874d000) >> /scratch/src/uClibc.push7/lib/ld64-uClibc.so.0 >> _dl_get_ready_to_run:1194: Calling init_tls()! >> _dl_malloc:240: mmapping more memory >> _dl_malloc:240: mmapping more memory >> _dl_get_ready_to_run:1296: Beginning relocation fixups >> _dl_get_ready_to_run:1326: Calling _dl_allocate_tls_init()! >> transfering control to application @ 0x400550 >> Nothing found in /etc/hosts >> Looking up type 1 answer for 'univie' >> adding search loc >> adding search lane >> adding search wifi >> adding search wien >> adding search berlin >> adding search ac.at >> adding search at >> nameservers = 3 >> encoding header >> lookup name: univie >> On try 8, sending query to 193.170.61.4, port 53 >> Xmit packet len:24 id:2 qr:0 >> len:24 id:2 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=0,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=0,rcode=5 >> encoding header >> lookup name: univie >> On try 7, sending query to 193.170.61.5, port 53 >> Xmit packet len:24 id:3 qr:0 >> len:24 id:3 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=0,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=0,rcode=5 >> encoding header >> lookup name: univie >> On try 6, sending query to 192.168.100.42, port 53 >> Xmit packet len:24 id:4 qr:0 >> len:99 id:4 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=3 >> variant:-1 sdomains:7 >> encoding header >> lookup name: univie.loc >> On try 5, sending query to 192.168.100.42, port 53 >> Xmit packet len:28 id:5 qr:0 >> len:79 id:5 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:0 sdomains:7 >> encoding header >> lookup name: univie.lane >> On try 4, sending query to 192.168.100.42, port 53 >> Xmit packet len:29 id:6 qr:0 >> len:83 id:6 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:1 sdomains:7 >> encoding header >> lookup name: univie.wifi >> On try 3, sending query to 192.168.100.42, port 53 >> Xmit packet len:29 id:7 qr:0 >> len:83 id:7 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:2 sdomains:7 >> encoding header >> lookup name: univie.wien >> On try 2, sending query to 192.168.100.42, port 53 >> Xmit packet len:29 id:8 qr:0 >> len:96 id:8 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=3 >> variant:3 sdomains:7 >> encoding header >> lookup name: univie.berlin >> On try 1, sending query to 192.168.100.42, port 53 >> Xmit packet len:31 id:9 qr:0 >> len:98 id:9 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=3 >> variant:4 sdomains:7 >> encoding header >> lookup name: univie.ac.at >> On try 0, sending query to 192.168.100.42, port 53 >> Xmit packet len:30 id:10 qr:0 >> len:257 id:10 qr:1 >> Got response (i think)! >> qrcount=1,ancount=1,nscount=13,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=0 >> Skipping question 0 at 12 >> Length of question 0 is 18 >> Decoding answer at pos 30 >> decode_answer(start): off 30, len 257 >> Total decode len = 2 >> i=2,rdlength=4 >> Answer name = |univie.ac.at| >> Answer type = |1| >> a.add_count:0 a.rdlength:4 a.rdata:0x63f03a >> name : univie.ac.at >> fam : 2 >> addrlen: 4 >> addr : 131.130.70.17 >> total 1 addresses >> aliases: univie >> ############################################# >> # nic >> argc=2 argv=0x7fff5356d078 envp=0x7fff5356d090 >> ELF header=0x7f2c1397f000 >> First Dynamic section entry=0x7f2c13b88ea0 >> Scanning DYNAMIC section >> Done scanning DYNAMIC section >> About to do library loader relocations >> Done relocating ldso; we can now use globals and make function calls! >> _dl_get_ready_to_run:450: Cool, ldso survived making function calls >> _dl_malloc:240: mmapping more memory >> _dl_ldsopath_init:156: Lib Loader: (0x1397f000) >> /scratch/src/uClibc.push7/lib/ld64-uClibc.so.0: using path: >> /scratch/src/uClibc.push7/lib >> _dl_load_elf_shared_library:772: Found TLS header for >> /scratch/src/uClibc.push7/lib/libc.so.0 >> _dl_load_elf_shared_library:799: Relocated TLS initial image from >> 0x2ca968 to 0x7f2c13976968 (size = 0x8) >> _dl_get_ready_to_run:1053: Loading: (0x7f2c136ac000) >> /scratch/src/uClibc.push7/lib/libc.so.0 >> _dl_get_ready_to_run:1053: Loading: (0x7f2c1397f000) >> /scratch/src/uClibc.push7/lib/ld64-uClibc.so.0 >> _dl_get_ready_to_run:1194: Calling init_tls()! >> _dl_malloc:240: mmapping more memory >> _dl_malloc:240: mmapping more memory >> _dl_get_ready_to_run:1296: Beginning relocation fixups >> _dl_get_ready_to_run:1326: Calling _dl_allocate_tls_init()! >> transfering control to application @ 0x400550 >> Nothing found in /etc/hosts >> Looking up type 1 answer for 'nic' >> adding search loc >> adding search lane >> adding search wifi >> adding search wien >> adding search berlin >> adding search ac.at >> adding search at >> nameservers = 3 >> encoding header >> lookup name: nic >> On try 8, sending query to 193.170.61.4, port 53 >> Xmit packet len:21 id:2 qr:0 >> len:21 id:2 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=0,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=0,rcode=5 >> encoding header >> lookup name: nic >> On try 7, sending query to 193.170.61.5, port 53 >> Xmit packet len:21 id:3 qr:0 >> len:21 id:3 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=0,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=0,rcode=5 >> encoding header >> lookup name: nic >> On try 6, sending query to 192.168.100.42, port 53 >> Xmit packet len:21 id:4 qr:0 >> len:96 id:4 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=3 >> variant:-1 sdomains:7 >> encoding header >> lookup name: nic.loc >> On try 5, sending query to 192.168.100.42, port 53 >> Xmit packet len:25 id:5 qr:0 >> len:76 id:5 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:0 sdomains:7 >> encoding header >> lookup name: nic.lane >> On try 4, sending query to 192.168.100.42, port 53 >> Xmit packet len:26 id:6 qr:0 >> len:80 id:6 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:1 sdomains:7 >> encoding header >> lookup name: nic.wifi >> On try 3, sending query to 192.168.100.42, port 53 >> Xmit packet len:26 id:7 qr:0 >> len:80 id:7 qr:1 >> Got response (i think)! >> qrcount=1,ancount=0,nscount=1,arcount=0 >> opcode=0,aa=1,tc=0,rd=1,ra=1,rcode=3 >> variant:2 sdomains:7 >> encoding header >> lookup name: nic.wien >> On try 2, sending query to 192.168.100.42, port 53 >> Xmit packet len:26 id:8 qr:0 >> len:198 id:8 qr:1 >> Got response (i think)! >> qrcount=1,ancount=1,nscount=3,arcount=5 >> opcode=0,aa=0,tc=0,rd=1,ra=1,rcode=0 >> Skipping question 0 at 12 >> Length of question 0 is 14 >> Decoding answer at pos 26 >> decode_answer(start): off 26, len 198 >> Total decode len = 2 >> i=2,rdlength=4 >> Answer name = |nic.wien| >> Answer type = |1| >> a.add_count:0 a.rdlength:4 a.rdata:0x1d76036 >> name : nic.wien >> fam : 2 >> addrlen: 4 >> addr : 188.40.87.61 >> total 1 addresses >> aliases: nic >> ############################################# >> >> vs. >> >> $ for i in nxdomain univie nic;do echo "# $i";./ghbn_glibc $i;echo >> "#############################################";done >> # nxdomain >> ERROR: : Resolver Error 0 (no error) >> ############################################# >> # univie >> name : univie.ac.at >> fam : 2 >> addrlen: 4 >> addr : 131.130.70.17 >> total 1 addresses >> aliases: >> ############################################# >> # nic >> name : nic.wien >> fam : 2 >> addrlen: 4 >> addr : 188.40.87.61 >> total 1 addresses >> aliases: >> ############################################# >> >> which leaves us with a diff for 'nxdomain' which you might want to >> rectify in an incremental update? >> >> TIA && cheers, > >
--- libc/inet/resolv.c 2014-04-05 16:17:06.850156346 +0200 +++ libc/inet/resolv.c 2014-04-05 16:15:00.560454001 +0200 @@ -1461,7 +1461,7 @@ * and retry, which is, eh, an error. :) */ /* Try to keep latency and traffic low here, please! */ - if (h.rcode == REFUSED) { + if ((h.rcode == REFUSED)||(h.rcode==SERVFAIL)) { /* type not supported, try the next server, with fresh variants */ goto try_next_server;