Age | Commit message (Collapse) | Author |
|
Follow documented behaviour:
http://man7.org/linux/man-pages/man3/getnameinfo.3.html
Sync with GNU libc behaviour.
|
|
|
|
When resolving an unqualified host name, the resolver tries the original
name first before appending the domains from the search list. If a TLD
with the same name exists, the query will succeed (but yield no A record)
and the resolver will return HOST_NOT_FOUND without trying the search
domains.
This patch changes the lookup order for unqualified host names (without
dots) to try the search domains first and the original name last.
Signed-off-by: Ingo van Lil <inguin@gmx.de>
|
|
|
|
This lessens the load on upstream DNS servers (and it was just nonsensical).
Signed-off-by: Tim Hockin <thockin@google.com>
|
|
Currently a miss on a search-path entry is counted as a retry. This means that
users with more than (num_nameservers * retries) entries in their search path
list fail before trying all search paths. Concretely, a single nameserver with
4 search paths will never try the 4th search because the default retry is 3.
The code doesn't currently retry a given nameserver in case of an error, so
retries is sort of meaningless (though there are some comments indicating it
might come). This change only treats total failure of a nameserver (try next
server) as a retry.
Signed-off-by: Tim Hockin <thockin@google.com>
|
|
on system where resolv.conf is not in /etc .
Signed-off-by: Ubaldo Porcheddu <ubaldo@eja.it>
|
|
Write a terminating '\0' to dest when the first byte of the encoded data
is 0. This corner case was previously missed.
Signed-off-by: Daniel Fahlgren <daniel@fahlgren.se>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
It is possible to get stuck in an infinite loop when receiving a
specially crafted DNS reply. Exit the loop after a number of iteration
and consider the packet invalid.
Signed-off-by: Daniel Fahlgren <daniel@fahlgren.se>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
Although gethostent() is obsoleted, there is no reason to keep it broken.
Fix two problems:
* commit f65e66078b "resolver: switch to config parser" leave an extra break
statement in case of GETHOSTENT in __read_etc_hosts_r. In result,
output buffer wasn't initialized at all.
* gethostent static buffer has insufficient size to store aliases,
so __read_etc_hosts_r always returns ERANGE. Restore ALIAS_DIM define.
Add test-case.
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
Save ~1k static space (.bss)
text data bss dec hex filename
- 68 0 126 194 c2 libc/inet/gethostent.os
- 79 0 460 539 21b libc/inet/gethostbyname2.os
- 83 0 460 543 21f libc/inet/gethostbyaddr.os
+ 98 0 24 122 7a libc/inet/gethostent.os
+ 110 0 24 134 86 libc/inet/gethostbyname2.os
+ 113 0 24 137 89 libc/inet/gethostbyaddr.os
==================================================================
+91 -974
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
lookups
The latter half of gethostbyname2_r (doing AAAA queries) is rather dramatically different
from the corresponding portion of gethostbyname_r (doing A queries). This leads to problems
like calls to getaddrinfo only returning one IPv6 address, even when multiple exist.
Seems to be entirely a case of divergent evolution -- a half-decade of fixes for the IPv4
code but no love for IPv6. Until now. ;)
DNS behaviour for IPv6 is really no different than for IPv4 -- beyond the difference in
address sizes, there's no need for the functions to be so different.
Consequently, this patch really is almost just a cut-and-paste of gethostbyname_r, with
the appropriate substitutions of in6_addr, AF_INET6, etc; while holding on to the few
extra bits that actually belong in there (eg #ifdef __UCLIBC_HAS_IPV6__).
Signed-off-by: Wes Campaigne <westacular@gmail.com>
|
|
Commit 2dab3f5a "resolv: tiny shrinkage in /etc/hosts handling" leads to
that read_etc_hosts_r() provide garbage pointer at the end of h_aliases
list if more than four hostnames follow a dotted quad in /etc/hosts
Test-case:
Add following line to /etc/hosts
63.63.0.2 host1 alias2 alias3 alias4 alias5
#include <stdio.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main (void)
{
int i;
char *a;
struct hostent *he;
struct in_addr ipv4addr;
inet_pton(AF_INET, "63.63.0.2", &ipv4addr);
he = gethostbyaddr(&ipv4addr, sizeof ipv4addr, AF_INET);
if (he == NULL)
exit(1);
printf("Host name: '%s'\n", he->h_name);
i = 0;
while ((a = he->h_aliases[i]) != NULL) {
printf("Host alias: '%s'\n", a);
++i;
}
return 0;
}
Wrong output:
Host name: 'host1'
Host alias: 'alias2'
Host alias: 'alias3'
Host alias: 'alias4'
Host alias: 'alias5'
Host alias: '??'
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
set error events
https://bugs.busybox.net/show_bug.cgi?id=3211
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
As recently discussed on the pgsql mailinglist, this
warnings are more or less useless and some configure scripts
are failing when these warnings are enabled.
http://www.postgresql.org/message-id/20150320132351.GS3636@alvh.no-ip.org
|
|
On execution of "inet/gethost_r-align" test I noticed failure due
to unaligned access (instaed of 4-byte aligned 1-byte aligned
address was attempted to be accessed).
Further investigation confirmed this nice and helpful test failure.
Following commit removed usage of ALIGN_BUFFER_OFFSET on entry to
__read_etc_hosts_r():
http://git.uclibc.org/uClibc/commit/?id=f65e66078b9f4d2d7f0fc336dee36e78fc467c0f
So indeed if target architecture doesn't allow unaligned access
and provided tmp buffer is not word aligned (and we will deal with pointers
which means word-sized data units), then CPU will fail during execution.
In case of ARC we'll see "Unaligned access" exception like this:
--->8---
# potentially unexpected fatal signal 7.
Path: /root/uClibc/test/inet/gethost_r-align
CPU: 0 PID: 5514 Comm: gethost_r-align Not tainted 3.13.11 #2
task: 8f42a580 ti: 8f40e000 task.ti: 8f40e000
[ECR ]: 0x00230400 => Misaligned r/w from 0x5fdab341
[EFA ]: 0x5fdab341
[BLINK ]: 0x20032a18
[ERET ]: 0x20032a3c
@off 0x12a3c in [/lib/libuClibc-0.9.34-git.so]
VMA: 0x20020000 to 0x20062000
[STAT32]: 0x00000086 : U E2 E1
BTA: 0x20046014 SP: 0x5fdab260 FP: 0x00000000
LPS: 0x20046064 LPE: 0x20046068 LPC: 0x00000000
r00: 0x5fdab341 r01: 0x00000005 r02: 0x00000015
r03: 0x00000000 r04: 0x5fdab358 r05: 0x00000000
r06: 0x0a0a0a00 r07: 0x00000000 r08: 0x0000003f
r09: 0x20067050 r10: 0x00000000 r11: 0x00000014
r12: 0x00000001 r13: 0x00000000 r14: 0x20060660
r15: 0x20060661 r16: 0x00000006 r17: 0x5fdab371
r18: 0x00000018 r19: 0x5fdab2b4 r20: 0x00020000
r21: 0x00000000 r22: 0x00029068 r23: 0x5fdab371
r24: 0x00010000 r25: 0x00000000
--->8---
To fix this problem we'll re-introduce tmp buffer force alignment
before config parser invocation.
Signed-off-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
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. This
fix makes sure we try the next server on SERVFAIL.
Signed-off-by: Michel Stam <michel@reverze.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
In a multi-threaded application where res_init() was called either
directly or implicitly, getaddrinfo() and others failed to add the
DNS search domain to hostnames.
This problem made it not possible to look up a hostname without its
domain appended.
The problem is caused by res_sync_func() overwriting the configuration
read by __open_nameservers() immediately after it is read.
The suggested solutin is to disable res_sync_func() while reading name
server configuration in res_init().
Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
res_init() was not atomic, which could give undesired behaviour. Now
res_init() is completely locked under one lock and the locking is
removed from __res_vinit().
Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Commit aab4df0fb51660300559f5f29290709db2f7bfee says that the line with
after res_init() function. Commit
7f74de5d4d6d10baafab4b37bb3d472f5c5f0e8c moves the res_init()
function below the line with #undef _res.
This commit moves res_init() back above #undef _res.
Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
res_mkquery() takes out __resolv_lock to copy _res.options to function local
_res_options on line 4204, but later unsafely accesses _res.options without a
lock, instead of its local copy _res_options, on line 4221. Looks like a
period / underscore typo.
Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Fixes displaying the nameserver in busybox nslookup.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Fixes bug #5342
res_query was silently rejecting responses against T_ANY DNS
questions.
Remove the type-filtering from res_query altogether.
__dns_lookup is supposed to return the proper stuff that you asked
for (and only that).
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
In res_iclose we were operating on the global _res even if called via
res_nclose where we are supposed to operate on the user provided
res_state.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Partially revert e9af4dfbd328e9f3bba235fdb2d1027dd2dbbcde
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
All other TLS data in uClibc is explicitly using the IE model,
so use it for __resp too. This generates smaller and faster
code.
Signed-off-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The definition of __resp has been hidden for some years (commit
22de495d). Remove the comment suggesting that it is not.
Signed-off-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Added attribute_noreturn even if it has return at the end of function
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
while there add one for future (currently in unused code)
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
-4b
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
PR networking/4916
Reserve space for the terminating 0 alias and zero out the
scratch-buffer so the last entry of the alias list is empty.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Some places have opencoded the ARRAY_SIZE macro, so move it to a global
internal location so other places can leverage it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Timothy Holdener writes:
small memory leak in __dns_lookup() when the A record
in the DNS answer is preceded by one or more CNAME records.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
previously gethostbyname_r(ipv6.google.com);herror("ERROR:") gave
Answer name = |ipv6.google.com|
Answer type = |5|
herrno=1
h_errno=0
ERROR:: Error 0
herrno=1
h_errno=1
ERROR:: Unknown host
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
text data bss dec hex filename
- 2915 0 0 2915 b63 libc/inet/ns_name_old.o
+ 2656 0 0 2656 a60 libc/inet/ns_name.o
- 958 0 0 958 3be libc/inet/ns_parse_old.o
+ 898 0 0 898 382 libc/inet/ns_parse.o
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Some reordering of existing functions was necessary in order to provide
this functionality.
Signed-off-by: Daniel Mack <zonque@gmail.com>
|
|
Signed-off-by: Daniel Mack <zonque@gmail.com>
|
|
There are build 'ifdef L_ns_parse'.
Signed-off-by: Daniel Mack <zonque@gmail.com>
|
|
One uses the other, so add them in one go.
Signed-off-by: Daniel Mack <zonque@gmail.com>
|
|
Signed-off-by: Daniel Mack <zonque@gmail.com>
|
|
These are built '#ifdef L_ns_name'
Signed-off-by: Daniel Mack <zonque@gmail.com>
|