This is to avoid parsing garbage past packet's actual end.
Also const-ize params to a few functions.
function old new delta
d6_run_script_no_option - 12 +12
option_to_env 791 798 +7
d6_run_script 253 255 +2
perform_d6_release 95 93 -2
udhcpc6_main 2596 2592 -4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 21/-6) Total: 15 bytes
Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
In commit
c4fb8c6a - fsck: do not use statics
not only statics were changed but also a couple of
statics-unrelated changes were made.
This included the handling of the child termination status
as follows:
- if (WIFEXITED(status))
- status = WEXITSTATUS(status);
- else if (WIFSIGNALED(status)) {
+ status = WEXITSTATUS(status);
+ if (WIFSIGNALED(status)) {
This is wrong, should have used a different variable to hold exit code.
Reported by Niklas Hambüchen <mail@nh2.me>.
function old new delta
wait_one 294 282 -12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Add support for the PXELINUX options 209 ("ConfigFile") and 210
("PathPrefix") in the DHCPv6 client.
See also: RFC5071, "Dynamic Host Configuration Protocol Options Used by
PXELINUX".
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Add support for 'bootfile-url' and 'bootfile-params' as defined by
RFC5970 "DHCPv6 Options for Network Boot".
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Add string_option_to_env() to easily generate environment variables for
known simple options.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
trim() modifies the string in place if needed and returns a pointer to
the end of the resulting string. Update udhcp_str2optset() so it no
longer sets the value of 'val' to the return value of trim().
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-t, -S and -G each take mandatory integer arguments. getopt32long()'s
option string syntax for this type of argument is 'c:+', however nsenter's
opt_str uses 'c+', which specifies two options 'c' and '+' which do not
take arguments. This means that giving a target PID causes nsenter to
exit and print the usage string:
# nsenter -t1 sh
nsenter: unrecognized option: 1
BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.
...
The long form options are also broken:
# nsenter --setuid=1000 --setgid=1000 sh
BusyBox v1.29.0.git (2018-05-04 13:56:49 UTC) multi-call binary.
...
`nsenter --target=<pid> sh` parses correctly and appears to work, but
<pid> is ignored and set to 0. This doesn't raise an error unless one
of the namespace arguments is also given:
# ./busybox_unstripped nsenter --target=42 sh
# exit
# ./busybox_unstripped nsenter -n --target=42 sh
BusyBox v1.29.0.git (2018-05-04 13:56:49 UTC) multi-call binary.
...
This has caused problems in a couple of places:
https://github.com/linuxkit/linuxkit/issues/567https://github.com/gliderlabs/docker-alpine/issues/359https://github.com/kontena/pharos-cluster/pull/81
Signed-off-by: Euan Harris <euan.harris@docker.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
In nsenter from util-linux, the long version of the -n option is
--net=<path>. BusyBox's version expects --network=<path>, so scripts
and examples written for util-linux's version cause BusyBox's version
to exit with the usage message.
Confusingly, until commit 036585a911, the usage message erroneously
claimed that the long option was indeed called --net; after that commit
long options are not listed at all.
Signed-off-by: Euan Harris <euan.harris@docker.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
If server replied with 302 and
Location: ?foo
we used to underflow the allocated space while trying to form the "@foo"
filename. Switch to forming "foo" filename.
function old new delta
packed_usage 32795 32799 +4
parse_url 387 352 -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-35) Total: -31 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Testcase: (sleep 10; ls) | busybox less
[...]
~ LICENSE
~ Makefile
~ Makefile.custom
~ Makefile.flags
[...]
less did not want this part:
+ /* dont convert NL to CR+NL on output */
+ newterm->c_oflag &= ~(ONLCR);
function old new delta
get_termios_and_make_raw 108 115 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Usage: nslookup [-type=QUERY_TYPE] [-debug] HOST [DNS_SERVER]
Query DNS about HOST
QUERY_TYPE: soa,ns,a,aaaa,cname,mx,txt,ptr,any
function old new delta
packed_usage 32189 32258 +69
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Commit 952d5a6024 (applets/install: accept more than one install
option) changed the way we handle install options: before that commit, a
missing install type would mean to install nothing; after, we would
iterate over options, so we would never notice there was a mising
option.
Fix that by introducing an explicit --none option to specify to install
nothing.
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Upstream commit:
Date: Sun, 25 Mar 2018 16:38:00 +0800
expand: Fix buffer overflow in expandmeta
The native version of expandmeta allocates a buffer that may be
overrun for two reasons. First of all the size is 1 byte too small
but this is normally hidden because the minimum size is rounded
up to 2048 bytes. Secondly, if the directory level is deep enough,
any buffer can be overrun.
This patch fixes both problems by calling realloc when necessary.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
expmeta 517 635 +118
expandarg 990 996 +6
mklocal 288 290 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 126/0) Total: 126 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The files generated by the include/config/MARKER target are in the
dependency list for applets/applet_tables.
If applets/applet_tables is created first during applets_dir then it will
be created again later as part of $(busybox-dirs).
As a result include/applet_tables.h is created again. This time while other
build commands may need it.
Let applets_dir depend on include/config/MARKER to avoid this particular
race condition and create the header files atomically to ensure that the
compiler never sees incomplete files.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>