[bug] Router does not resolve local hostnames - r24461

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Goto page 1, 2  Next
Author Message
tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Tue Jul 29, 2014 11:57    Post subject: [bug] Router does not resolve local hostnames - r24461 Reply with quote
Hi,

After upgrading to build 24461 my router no longer able to resolve short hostnames of local DHCP clients. It can not even resolve its own name:

Code:
root@tplink:~# hostname
tplink
root@tplink:~# nslookup tplink
Server:    (null)
Address 1: 127.0.0.1 localhost
Address 2: ::1 localhost

root@tplink:~# ping tplink
root@tplink:~#
root@tplink:~# nslookup tplink.domain.lan
Server:    (null)
Address 1: 127.0.0.1 localhost
Address 2: ::1 localhost

Name:      tplink.domain.lan
Address 1: 192.168.0.1 tplink.domain.lan


I tried to follow this wiki and added additional DNSmasq params:

Code:
local=/domain.lan/
expand-hosts

But that didn't help Sad
Is it build's bug or some misconfiguration?
Previously it used to work fine

Code:
Router Model: TP-Link TL-WR1043ND
Firmware Version: DD-WRT v24-sp2 (06/23/14) std - build 24461
Kernel Version: Linux 3.10.44 #11005 Mon Jun 23 08:30:54 CEST 2014 mips


Any suggestions?
Thanks


Last edited by tosiara on Fri Aug 08, 2014 11:34; edited 4 times in total
Sponsor
Mile-Lile
DD-WRT Guru


Joined: 24 Feb 2013
Posts: 1634
Location: Belgrade

PostPosted: Tue Jul 29, 2014 18:47    Post subject: Reply with quote
Maybe it is related to this http://svn.dd-wrt.com/ticket/3553
write about your problem on TRAC and reopen this ticket above. Provide as much info as you can...
with some pictures too...
rich_a
DD-WRT Novice


Joined: 18 Nov 2012
Posts: 18

PostPosted: Tue Jul 29, 2014 20:01    Post subject: Reply with quote
Add "domain-needed" into the additional dnsmasq options. Worked for me.
tatsuya46
DD-WRT Guru


Joined: 03 Jan 2010
Posts: 7568
Location: YWG, Canada

PostPosted: Tue Jul 29, 2014 23:20    Post subject: Reply with quote
-make sure Use DNSMasq for DHCP, Use DNSMasq for DNS, DHCP-Authoritative are all checked

-on services page make sure used domain is set to LAN & WLAN

-just below that a LAN domain must be entered, eg homenet.lan, ".lan" or ".local" is recommended to be used, as to why just look on google

apply settings then have all clients disconnect & reconnect or just reboot the router. if you apply settings on the management page dnsmasq will not restart, manually force a static ip to get connectivity to restart it manually, or reboot router


Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Shane>nslookup ps4
Server:  TL-WDR4900.swag-fi.lan
Address:  10.150.10.1

Name:    ps4.swag-fi.lan
Address:  10.150.10.13

_________________
LATEST FIRMWARE(S)

BrainSlayer wrote:
we just do it since we do not like any restrictions enforced by stupid cocaine snorting managers

[x86_64] Haswell i3-4150/QCA9984/QCA9882 ------> r55797 std
[QUALCOMM] DIR-862L --------------------------------> r55797 std
▲ ACTIVE / INACTIVE ▼
[QUALCOMM] WNDR4300 v1 --------------------------> r50485 std
[BROADCOM] DIR-860L A1 ----------------------------> r50485 std


Sigh.. why do i exist anyway.. | I love you Anthony.. never forget that.. my other 99% that ill never see again..

tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Wed Jul 30, 2014 7:19    Post subject: Reply with quote
Mile-Lile wrote:
Maybe it is related to this http://svn.dd-wrt.com/ticket/3553

No, it is not. dnsmasq process is running, dhcp addresses issued correctly and fqdn names can be resolved. Only short hostnames does not resolve

rich_a wrote:
Add "domain-needed" into the additional dnsmasq options. Worked for me.

Tried adding "domain-needed" - did not help

tatsuya46 wrote:

Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Shane>nslookup ps4
Server:  TL-WDR4900.swag-fi.lan
Address:  10.150.10.1

Name:    ps4.swag-fi.lan
Address:  10.150.10.13

Windows automatically appends default dns suffix when you query nslookup. That's why you could get correct address. Try enabling debug to see that default suffix is automatically appended before the query

So far I found out that if I reboot the client and let it ask for DHCP address again - this address will resolvable. So the workaround is to reboot all the clients if the router has been restarted. Which is quite weird

Can someone with 24461 build try to reproduce following way (it is important to perform naslookup on the router, not in windows machine):
1. reboot router
2. connect over ssh to the router
3. #nslookup router_short_hostname
4. #nslookup any_client_short_hostname
5. reboot the client, wait until is up
6. #nslookup the_same_client_short_hostname

I appreciate your results posted here
Thank you
tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Wed Jul 30, 2014 7:40    Post subject: Reply with quote
I suspect dnsmasq only resolves names that are currently in /tmp/dnsmasq.leases, and this file is populated only after a client asks for DHCP address.
tatsuya46
DD-WRT Guru


Joined: 03 Jan 2010
Posts: 7568
Location: YWG, Canada

PostPosted: Wed Jul 30, 2014 8:31    Post subject: Reply with quote
Code:
root@TL-WDR4900:~# nslookup tl-wdr4900
Server:    10.150.10.1
Address 1: 10.150.10.1 TL-WDR4900.swag-fi.lan

root@TL-WDR4900:~# nslookup calvin-laptop
Server:    10.150.10.1
Address 1: 10.150.10.1 TL-WDR4900.swag-fi.lan

Name:      calvin-laptop
Address 1: 10.150.10.227 Calvin-Laptop

root@TL-WDR4900:~# nslookup calvin-laptop
Server:    10.150.10.1
Address 1: 10.150.10.1 TL-WDR4900.swag-fi.lan

Name:      calvin-laptop
Address 1: 10.150.10.227 Calvin-Laptop
root@TL-WDR4900:~#


this is with a private build r24752 but i did what you said, still working with static clients and dynamic clients. if you really want me to try it again with r24461 i could

i have no additional dnsmasq options entered

_________________
LATEST FIRMWARE(S)

BrainSlayer wrote:
we just do it since we do not like any restrictions enforced by stupid cocaine snorting managers

[x86_64] Haswell i3-4150/QCA9984/QCA9882 ------> r55797 std
[QUALCOMM] DIR-862L --------------------------------> r55797 std
▲ ACTIVE / INACTIVE ▼
[QUALCOMM] WNDR4300 v1 --------------------------> r50485 std
[BROADCOM] DIR-860L A1 ----------------------------> r50485 std


Sigh.. why do i exist anyway.. | I love you Anthony.. never forget that.. my other 99% that ill never see again..

tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Wed Jul 30, 2014 8:36    Post subject: Reply with quote
tatsuya46, thanks, would be great if you could test also build 24461
tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Wed Jul 30, 2014 9:15    Post subject: Reply with quote
I have checked another 24461 build, running on following:

Code:
Router Model: Dlink-DIR300 rev b
Firmware Version: DD-WRT v24-sp2 (06/23/14) std - build 24461
Kernel Version: Linux 3.2.60-svn24360 #7008 Mon Jun 23 10:41:07 CEST 2014 mips


There it works fine. Short names are resolved. And router's own name also fine.

Settings are similar. The only difference is in nslookup output:

Code:
root@dlink1:~# nslookup dlink1
Server:    192.168.0.1
Address 1: 192.168.0.1 dlink1.local.lan

Name:      dlink1
Address 1: 192.168.0.1 dlink1.local.lan


While on not working device it is:

Code:
root@tplink:~# nslookup tplink
Server:    (null)
Address 1: 127.0.0.1 localhost
Address 2: ::1 localhost
tatsuya46
DD-WRT Guru


Joined: 03 Jan 2010
Posts: 7568
Location: YWG, Canada

PostPosted: Wed Jul 30, 2014 9:27    Post subject: Reply with quote
is ipv6 enabled on the tplink? it looks like it with the "::1 localhost"
_________________
LATEST FIRMWARE(S)

BrainSlayer wrote:
we just do it since we do not like any restrictions enforced by stupid cocaine snorting managers

[x86_64] Haswell i3-4150/QCA9984/QCA9882 ------> r55797 std
[QUALCOMM] DIR-862L --------------------------------> r55797 std
▲ ACTIVE / INACTIVE ▼
[QUALCOMM] WNDR4300 v1 --------------------------> r50485 std
[BROADCOM] DIR-860L A1 ----------------------------> r50485 std


Sigh.. why do i exist anyway.. | I love you Anthony.. never forget that.. my other 99% that ill never see again..

tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Wed Jul 30, 2014 9:31    Post subject: Reply with quote
I don't use ipv6 and it is disabled at web admin page "Administration -> Management"
rich_a
DD-WRT Novice


Joined: 18 Nov 2012
Posts: 18

PostPosted: Wed Jul 30, 2014 10:22    Post subject: Reply with quote
OK, here's a full list of my settings on the latest build. I couldn't resolve local addresses consistently with the latest build, and most "no domain" queries were getting routed upstream, but after all my tweaking I've got it working perfectly. Just one caveat - I'm not using my box as a router, just a WAP, DNS/DHCP for LAN and OpenVPN server:


DHCP Server
Code:
Used Domain: WAN & LAN
LAN Domain: my.domain


DNSMasq Additional options
Code:
no-resolv
interface=tun2 (note - for openvpn)
expand-hosts
server=194.168.4.100 (note - upstream servers for my ISP)
server=194.168.8.100
domain-needed
tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Wed Jul 30, 2014 11:33    Post subject: Reply with quote
rich_a wrote:
DNSMasq Additional options
Code:
no-resolv
interface=tun2 (note - for openvpn)
expand-hosts
server=194.168.4.100 (note - upstream servers for my ISP)
server=194.168.8.100
domain-needed


Tried to paste exactly those params - did not help. Router keeps responding NXDOMAIN to short hostnames
tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Thu Jul 31, 2014 13:33    Post subject: Reply with quote
After some investigation I suspect this is a bug.
Since nslookup gives different output on the same build 24461 it is pretty strange, especially having in mind that nslookup simply relies on C function "getaddrinfo".

And then I found out that my TPlink router has been build using new musl library, while Dlink was still build using uClibc. So same build number 24461 is being build using different toolchains.

Would be great to verify if this is musl issue by simply recompiling more verbose busybox, but I found no documentation how to use musl with DDRWT. Anyone has a doc how to compile hello_world.c for MIPS against musl library?
tosiara
DD-WRT User


Joined: 20 Dec 2011
Posts: 100

PostPosted: Mon Aug 04, 2014 7:01    Post subject: Reply with quote
Hi all,

I have prepared a small application to test "getaddrinfo" function on musl library based routers. The C source (based on nslookup implementation of busybox):

Code:
#include <stdlib.h>
#include <stdio.h>
#include <resolv.h>
#include <netdb.h>
#include <string.h>

int main(int argc, char *argv[])
{
        struct addrinfo *result = NULL;
        int rc;
        struct addrinfo hint;

         if (argc < 2)
        {
                printf ("Usage: %s hostname\n", argv[0]);
                exit(1);
        }
        printf ("Resolving \"%s\"... ", argv[1]);

        memset(&hint, 0 , sizeof (hint));
        hint.ai_socktype = SOCK_STREAM;
        rc = getaddrinfo (argv[1], NULL, &hint, &result);
        printf ("result: %d\n", rc);
}



To compile:

Code:
./toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.2/bin/mips-openwrt-linux-gcc getaddr.c -DNEED_PRINTF -o getaddr_tplink


To execute:

Code:
./getaddr_tplink `hostname`


Results on my musl-based TP-Link TL-WR1043ND build 24461:

Code:
root@tplink:~# ./getaddr_tplink `hostname`
Resolving "tplink"... result: -2



Results on uClibc-based Dlink-DIR300 rev b build 24461:

Code:
root@dlink1:~# ./getaddr_dlink `hostname`
Resolving "dlink1"... result: 0



I would like someone who is running a router with musl-based firmware to try to compile this sample and post here results. I'm also attaching pre-compiled binaries to this post if you would like to use them without compilation

Thank you
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum