Age | Commit message (Collapse) | Author |
|
map_newlink() may abort when interface list changed between netlink
request for getting interfaces and getting addresses. This commit is
ported from the same change from glibc commit.
Signed-off-by: Vincent Hou <vincent.houyi@gmail.com>
|
|
Old version manages strings the regular way (i.e. counting on zero-ended
sequences). In fact strings captured from the /etc/ethers file are
'\n'-ended. So, for example, using strchr function could lead to buffer
overflow.
Reported-by: "Andrey V. Zhmurin" <zhmurin_a@mcst.ru
|
|
|
|
|
|
|
|
The recvmmsg and sendmmsg is very important for UDP stream application.
If we only use recvmsg for UDP stream, it will only copy one mtu size
of data in a syscall. And recvmmsg copy as many as you want in a syscall.
So recvmmsg is more efficient,and some applications will depends on the
recvmmsg and sendmmsg, eg: UDP media stream player.
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
|
|
|
|
|
|
The included RPC implementation is ipv4 only.
Other C library projects have either deprecated the internal
RPC implementation (GNU C Library) or never implemented such
functionality (musl C Library). The latest rpcbind release (0.2.4)
checks for libtirpc and does not allow to be build with uClibc-ng
RPC without patching. The common use case for RPC nowadays is to
use rpcbind together with nfs-utils to provide NFS server or client
support to a system.
The included RPC implementation does create issues with duplicate
symbol failures when statically compiling with RPC enabled.
|
|
Follow documented behaviour:
http://man7.org/linux/man-pages/man3/getnameinfo.3.html
Sync with GNU libc behaviour.
|
|
|
|
As __UCLIBC_HAS_GETTEXT_AWARENESS__ is never defined, this is
mostly dead code. It is planned to integrate libiconv-tiny
and gettext-tiny into uClibc-ng after the next release, so
that more software packages can be used without modification.
Remove any _/_N macro usage.
|
|
CVE-2016-4429:
The call is technically in a loop, and under certain circumstances
(which are quite difficult to reproduce in a test case), alloca
can be invoked repeatedly during a single call to clntudp_call.
As a result, the available stack space can be exhausted (even
though individual alloca sizes are bounded implicitly by what
can fit into a UDP packet, as a side effect of the earlier
successful send operation).
From GNU libc:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=bc779a1a5b3035133024b21e2f339fe4219fb11c
|
|
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>
|
|
When trying to resolve a hostname by getaddrinfo() using some specific
settings, it will always return -EAI_NONAME (Name or service not known).
To reproduce this behavior, you need to request an IPv6 address with the
additional AF_V4MAPPED flag set from an non IPv6 capable hostname. If
you choose a IPv4/IPv6 capable hostname like google.com, everything
works fine.
This patch is more or less a port [1][2] from the glibc and their behavior
for the AF_V4MAPPED flag. To test the bug you can use the following snippet.
---- 8< ----
int ret;
struct addrinfo* result;
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET6;
hints.ai_flags = AI_V4MAPPED;
ret = getaddrinfo("test.com", NULL, &hints, &result);
printf("getaddrinfo(): %i", ret);
---- 8< ----
[1] https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo.c;h=925c3c5c71596c02f7e58a0ffcdcaae44eb065c1
[2] https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo.c;h=28977c2c1acb789660ad47e0d88e42486059c916
Signed-off-by: Alexander Wenzel <alexander.wenzel@qsc.de>
|
|
|
|
As recently reported on the Buildroot list:
http://lists.busybox.net/pipermail/buildroot/2016-March/155325.html
DNS lookups with Node.js currently fails on uClibc-ng. The reason for this
is the way AI_V4MAPPED is handled. According to POSIX, AI_V4MAPPED should
be ignored unless ai_family is AF_INET6:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html
If the AI_V4MAPPED flag is specified along with an ai_family of AF_INET6,
then getaddrinfo() shall return IPv4-mapped IPv6 addresses on finding no
matching IPv6 addresses (ai_addrlen shall be 16). The AI_V4MAPPED flag
shall be ignored unless ai_family equals AF_INET6.
uClibc-ng was also handling AI_V4MAPPED for AF_UNSPEC, fix that.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
|
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>
|
|
order
Implement simplest variant of /etc/gai.conf to control getaddrinfo
IPv6/IPv4 addresses sorting. Keep the default sort order - IPv6 first,
IPv4 second. To invert it, create /etc/gai.conf containing single line:
precedence ::ffff:0:0/96 100
Example before:
$ nslookup security.debian.org 8.8.8.8
Server: 8.8.8.8
Address 1: 8.8.8.8 google-public-dns-a.google.com
Name: security.debian.org
Address 1: 2001:a78:5:0:216:35ff:fe7f:be4f villa.debian.org
Address 2: 2001:a78:5:1:216:35ff:fe7f:6ceb lobos.debian.org
Address 3: 195.20.242.89 wieck.debian.org
Address 4: 212.211.132.250 lobos.debian.org
Address 5: 212.211.132.32 villa.debian.org
After patch & precedence set in /etc/gai.conf:
$ nslookup security.debian.org 8.8.8.8
Server: 8.8.8.8
Address 1: 8.8.8.8 google-public-dns-a.google.com
Name: security.debian.org
Address 1: 195.20.242.89 wieck.debian.org
Address 2: 212.211.132.250 lobos.debian.org
Address 3: 212.211.132.32 villa.debian.org
Address 4: 2001:a78:5:0:216:35ff:fe7f:be4f villa.debian.org
Address 5: 2001:a78:5:1:216:35ff:fe7f:6ceb lobos.debian.org
bloat-o-meter report:
function old new delta
getaddrinfo 726 1138 +412
gaih_inet 2660 2692 +32
.rodata 16618 16643 +25
__gai_precedence - 1 +1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 882/0) Total: 470 bytes
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>
|
|
Free 1k of static data (.bss)
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
http://bugs.busybox.net/show_bug.cgi?id=5588
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
I mailed with Jan-Benedict Glaw, it seems VAX on Linux
is really a lot of work todo and uClibc support didn't work ever.
|
|
The changeset 9dea5dc921b5f4045a18c63eb92e84dc274d17eb in the Linux kernel
expose the direct syscalls for sockets. For example udhcpc then will use sendto
syscall directly and get an EINVAL error. Disable direct syscalls as it was done
for SPARC in the past. Musl and GNU libc are not affected, as they already
disable direct socket syscalls on i386.
Reported-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
|
|
TODO: this could need a cleanup..
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
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>
|
|
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
|
|
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
|
|
mkostemp(char *template, int flags) generates a unique temporary
filename from a template. The flags parameter accepts three of
the same flags as open(2): O_APPEND, O_CLOEXEC, and O_SYNC. The
current implementation of mkostemp(3) does not respect the flags
and in fact confuses the flags with the file mode which should
always be S_IRUSR | S_IWUSR. This patch corrects this issue.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
mkostemp(char *template, int flags) generates a unique temporary
filename from a template. The flags parameter accepts three of
the same flags as open(2): O_APPEND, O_CLOEXEC, and O_SYNC. The
current implementation of mkostemp(3) does not respect the flags
and in fact confuses the flags with the file mode which should
always be S_IRUSR | S_IWUSR. This patch corrects this issue.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
|
|
define NOT_IN_libc / IS_IN_libxxx appropriately
to fix pthread_once
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
This commit 1e2e4ac6193ffe0900bd392fa3c596883771eb34 breaks networking
on sparc systems. In Linux the socket functions are declared, but not
implemented and must be routed through socketcall().
Tested via Qemu 2.0.0.
Signed-off-by: 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>
|
|
Before the patch, the query itself was sent via UDP
(the query contained correct protocol ID).
The fix is taken from glibc.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.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>
|