summaryrefslogtreecommitdiff
path: root/libc/inet
AgeCommit message (Collapse)Author
2012-04-17resolv: remove unused variablesBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17resolv: Fix /etc/hosts for more than MAXALIASES aliasesBernhard Reutner-Fischer
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>
2012-04-17getaddrinfo(): avoid call to __check_pf() when not neededAlexander Komyagin
__check_pf() function is called from getaddrinfo() and it calls getifaddrs(), which is too much overhead especially if RSBAC-Net is enabled. So with this patch __check_pf() is being called only when AI_ADDRCONFIG hint flag is specified - just when we really need that check. Signed-off-by: Alexander Komyagin <komyagin@altell.ru> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17inet: adjust handling of cacnonname in getaddrinfoEd W
Posix says that canonname should use the text representation of an IP address when a numerical nodename given See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html Signed-off-by: Ed Wildgoose <lists@wildgooses.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-26inet:rpc: fix build in !NPTL caseCarmelo Amoroso
__libc_once is not available / needed when multithreading support is not enabled, so authnone_create() calls authnone_create_once() directly. When LT.{old,new} is used instead of NPTL, it needs to explicitly include <bits/libc-lock.h> to get __libc_once to be visible. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-02-07inet:rpc: fix authnone_marshal in multithreading contextCarmelo Amoroso
This is a port of glibc's fix by Zack Weinberg as reported in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=142312, and discussed in http://sourceware.org/ml/libc-alpha/2002-04/msg00069.html and following. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-11-27make ARRAY_SIZE commonly available internallyMike Frysinger
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>
2011-11-17inet: hide relocationsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-17resolv: hide relocationsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-21resolv: fix memory leakBernhard Reutner-Fischer
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>
2011-10-20resolv: commentary typo fixBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-20gethostbyname_r: set correct h_errno upon failureBernhard Reutner-Fischer
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>
2011-10-20resolv: fix compilationBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-09-10resolv: simple optimizations and style/readability fixesDenys Vlasenko
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>
2011-08-26inet: build all res_* and ns_* functions conditionallyDaniel Mack
This patch changes the build system so that all DNS resolver related functions (ie, those starting with dn_, ns_ and res_) are only built if UCLIBC_HAS_RESOLVER_SUPPORT is set. This means that the libc will lack support for things that existed in the library before unless this new config option is set. On the other hand, if users really need support for resolver functions, they now get a more complete set, and the library is smaller than before it is deselected. Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26inet/resolv: add res_ninit and res_ncloseDaniel Mack
Some reordering of existing functions was necessary in order to provide this functionality. Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26inet/resolv: add res_mkqueryDaniel Mack
Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26inet/resolv: add ns_initparse, ns_parserr, ns_skiprr and ns_msg_getflagDaniel Mack
There are build 'ifdef L_ns_parse'. Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26inet/resolv: add dn_skipname and ns_name_skipDaniel Mack
One uses the other, so add them in one go. Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26inet/resolv: Add dn_compDaniel Mack
Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26inet/resolv: add ns_name_pton, ns_name_pack and ns_name_compressDaniel Mack
These are built '#ifdef L_ns_name' Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26inet/resolv: add ns_{put,get}{16,32}Daniel Mack
This patch introduces a new config directive 'UCLIBC_HAS_RESOLVER_SUPPORT' and adds the new symbols conditionally. Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26libc/inet/resolv.c: comment on #endif linesDaniel Mack
While reading this file, I found it rather confusing to relate the "endif" lines to their opening counter-part. This patch adds comments to most of these lines to denote what the actually do. Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-06-17resolv: fix bug in res_init with ipv6 nameserversBernhard Reutner-Fischer
Thanks to Christian Krause <chkr plauener.de> for finding and fixing this! Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14resolv: try next server on SERVFAILBernhard Reutner-Fischer
in bug 3637 Andrey Kovalev aka pxe.ru writes: getaddrinfo does NOT add domain to query when receive SERVFAIL RFC1035 7.2 suggests that - If a resolver gets a server error or other bizarre response from a name server, it should remove it from SLIST, and may wish to schedule an immediate transmission to the next candidate server address. So let's try the next server upon SERVFAIL even if it's not strictly required. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14getaddrinfo: allow numeric service without any hintsNatanael Copa
This appears to correspond to what glibc does and this fixes an issue with iptables-1.4.11 with udp and raw port numbers. (see http://bugzilla.netfilter.org/show_bug.cgi?id=721) This fixes #3841 https://bugs.busybox.net/show_bug.cgi?id=3841 Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-12linux_specific: handle accept4 and pipe2Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11accept4: Implement cancellationBernhard Reutner-Fischer
.. and add proper prototype, move it into it's own obj and other such cleanups. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11Implement accept4 system call.Thierry Reding
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-03getaddrinfo.c: fix incorrect check for ERANGE from gethostbyaddr_rDenys Vlasenko
Also, freeaddrinfo(NULL) is ok, no need to check parameted for NULL before calling it. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-05-03getaddrinfo.c: improve code readability. No functional changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-05-02ether_aton: reject invalid inputBernhard Reutner-Fischer
fixes PR2227 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-13resolv: really fix res_close not to hang with ipv6Bernhard Reutner-Fischer
Fix goof in previous commit. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-12resolv: fix res_close not to hang with ipv6Bernhard Reutner-Fischer
Timo Teräs writes: The memory release loop is missing an obvious counter increment. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-03-09sunrpc: fix spurious fall-throughMark Salter
Fix spurious fall-through. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2011-03-06simplify ffs* codePeter S. Mazinger
Remove __libc_ffs*, unneeded Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-03-05Implement ffsl and ffsll.Bernd Schmidt
This imports and adapts ffsll.c from glibc. The same mechanism as in glibc is used to choose between ffs and ffsll to implement ffsl. The single user in libc is changed to use the hidden version __libc_ffs. Signed-off-by: Bernd Schmidt <bernds@codesourcery.com> Acked-by: Bernhard Reutner-Fischer <aldot@uclibc.org>
2011-03-03guard IPv6 stuffPeter S. Mazinger
disable IPv6 related stuff if feature is disabled. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-01-01libc/inet/netlinkaccess.h: Use the types from kernelKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2010-11-23resolv.c fails for /etc/hosts lookupsPhilip Nye
Patch attached: Fix a bug in offset calculations when parsing /etc/hosts in resolv.c. Formerly a miscalculation meant that having found the correct line, the code was trashing its own result data. Signed-off-by: Philip Nye <philipn@engarts.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14getproto: increase line buffer size, simlify and fix alias handlingNatanael Copa
We increase line buffer size, reduce MAXALIASES and make sure we don't segfault when there are too manuy aliases in /etc/protocols. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14getnet: simplify alias handling and reduce MAXALIASESNatanael Copa
Reduce MAXALIASES to something lower. There will probably never be need for more than 1 alias but we allow a few extra. While here we alos fix segfault when there are too many aliases. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14getservice: fix handling of long linesNatanael Copa
Don't try to be smart by dynamically realloc buffersize as it doesn't work. Instead, be simple and allocate a buffer big enough. This fixes a memory leak when calling getserv{ent,byname,byport} multiple times. To save memory we reduce number of max aliases. We seldomly will need more than 1 anyways. While here, fix segfault that happened if there were too many aliases. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14getservice: getservent_r must return ERANGE when buffer is too smallNatanael Copa
This fixes issue introduced by 72e1a1ce186c39f07282398e2af9eb0253e60f15 This should also fix the following testcase to exit with error rather than cause an endless loop. int main(void) { if (getservbyname("non-existing", "udp") == NULL) err(1, "getservbyname"); return 0; } Reported by Pirmin Walthert http://lists.uclibc.org/pipermail/uclibc/2010-August/044277.html Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-09-17libc: Handle cancellation in non multiplexed socket callsCarmelo Amoroso
For those archs that provide non multiplexed socket calls it possible to implement the lib C wrappers without calling the multi-purpose __socketcall. For a subset of these functions that are cancellation point, it needs to correctly handle cancellation. Signed-off-by: Francesco Rundo <francesco.rundo@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-08-28Fix resolver broken in NPTL buildTimo Teräs
The combination of commit aab4df0fb51660300559f5f29290709db2f7bfee resolv.c: add support for per thread res_state commit cca45baf8353d1e338d232f5bdb2d1d6b357f1da /etc/resolv.conf: support "timeout:n" and "attempts:n" options .. and NPTL results in broken resolver in very annoying ways. Now, it seems that most of the uclibc code does not work well if res_state is TLS variable. Technically, this is the correct thing to do since this gives proper per-thread resolving behavior, and it also makes the config options overridable per thread. This probably what apps expect as glibc does it too. But alas, most places use _res to sync up static global variables which results in breakage. It gets more or less randomly selected which threads options get applied. Also in case of multiple servers it looks like the retry logic is shared between all threads, e.g. two concurrent resolutions can make other resolvers skip nameservers due to shared "last_ns_num". And finally the timeout/attempts commit breaks the accumulated stuff horribly. What happens is: 1. multithreaded application startups, initializes resolver, resolves things just fine 2. resolv.conf gets changed, application calls res_init after res_init uclibc will call res_sync on all resolver functions to refresh globals from the TLS variable _res 3. res_init was called only in one thread, so other thread's _res contains all zeroes (yes, this is correct app usage: res_init should be called only from one thread) 4. threads not calling res_init get broken resolver due to timeout being set to zero Now, one proper solution would be to: 1. make __open_nameservers return the configuration options 2. pass the config options struct to res_sync_func so it can do the proper overrides from per-thread _res 3. remove the related globals and use locally config options from __open_nameservers But technically, the correct thing (as in glibc does this) is: - res_init increases global "res_init timestamp" - use _res (or pointer within there) for resolver retries etc. get proper per-thread behavior - resolvers functions call "maybe_init" which reinitialize the TLS'ed resolver state (e.g. reload resolv.conf) if their res_init timestamp is out dated As an immediate emergency kludge fix, the following might do: resolv: fix options handling for TLS _res If _res is in TLS (NPTL), it might not get initialized. Assume zeroes mean default values. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-19resolv: simplify MAXALIAS handlingBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-19getserv: fix reading services lines w > 80 charsBernhard Reutner-Fischer
e.g. getservbyname() Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-05resolver: switch to config parserBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-05getnet: switch to config parserBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>