Age | Commit message (Collapse) | Author |
|
advance the optionptr by two bytes, not one
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Discovered that the DHCP server on a TrendNet router (unknown model)
provides a zero-length option 12 (Host Name) in the DHCP ACK message. This
has the effect of causing udhcpc to drop the rest of the options, including
option 51 (IP Address Lease Time), 3 (Router), and 6 (Domain Name Server),
most importantly leaving the OpenWrt device with no default gateway.
The TrendNet behavior violates RFC 2132, which in Section 3.14 declares that
option 12 has a minimum length of 1 octet. It is perhaps not a cosmic coincidence
that I found this behavior on Pi Day.
This patch allows zero length options without bailing out, by simply skipping them.
function old new delta
udhcp_scan_options 183 172 -11
Signed-off-by: Russell Senior <russell@personaltelco.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcp_str2optset 616 650 +34
setpriv_main 950 975 +25
switch_root_main 688 706 +18
parse 958 970 +12
getopt_main 622 628 +6
parse_resolvconf 302 306 +4
mpstat_main 1139 1142 +3
static.p 4 - -4
cdcmd 717 702 -15
strtok 148 - -148
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 7/1 up/down: 102/-167) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Added an option scanner to udhcp to enable iteration over packet options.
Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
attach_option 411 406 -5
dname_enc 381 167 -214
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-219) Total: -219 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The following caused udhcpc to segfault:
busybox udhcpc -i lo -s /dev/null -x 0x3d:
function old new delta
udhcp_str2optset 629 641 +12
Signed-off-by: Michal Kazior <michal@plume.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by
Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower
overhead call to bb_perror_msg() when only a string was being printed
with no parameters. This saves space for some CPU architectures because
it avoids the overhead of a call to a variadic function. However there
has never been a simple version of bb_error_msg(), and since 2007 many
new calls to bb_perror_msg() have been added that only take a single
parameter and so could have been using bb_simple_perror_message().
This changeset introduces 'simple' versions of bb_info_msg(),
bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and
bb_herror_msg_and_die(), and replaces all calls that only take a
single parameter, or use something like ("%s", arg), with calls to the
corresponding 'simple' version.
Since it is likely that single parameter calls to the variadic functions
may be accidentally reintroduced in the future a new debugging config
option WARN_SIMPLE_MSG has been introduced. This uses some macro magic
which will cause any such calls to generate a warning, but this is
turned off by default to avoid use of the unpleasant macros in normal
circumstances.
This is a large changeset due to the number of calls that have been
replaced. The only files that contain changes other than simple
substitution of function calls are libbb.h, libbb/herror_msg.c,
libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c,
networking/udhcp/common.h and util-linux/mdev.c additonal macros have
been added for logging so that single parameter and multiple parameter
logging variants exist.
The amount of space saved varies considerably by architecture, and was
found to be as follows (for 'defconfig' using GCC 7.4):
Arm: -92 bytes
MIPS: -52 bytes
PPC: -1836 bytes
x86_64: -938 bytes
Note that for the MIPS architecture only an exception had to be made
disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h)
because it made these files larger on MIPS.
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was
eliminated and calls to it changed to be bb_error_msg(). The downside of
this is that daemons now log all messages to syslog at the LOG_ERR level
which makes it hard to filter errors from informational messages.
This change optionally re-introduces bb_info_msg(), controlled by a new
option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that
were removed (only in applets that set logmode to LOGMODE_SYSLOG or
LOGMODE_BOTH), and also changes informational messages in ifplugd and
ntpd.
The code size change of this is as follows (using 'defconfig' on x86_64
with gcc 7.3.0-27ubuntu1~18.04)
function old new delta
bb_info_msg - 182 +182
bb_vinfo_msg - 27 +27
static.log7 194 198 +4
log8 190 191 +1
log5 190 191 +1
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes
If you don't care about everything being logged at LOG_ERR level
then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller:
function old new delta
static.log7 194 200 +6
log8 190 193 +3
log5 190 193 +3
syslog_level 1 - -1
bb_verror_msg 583 581 -2
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Support for the IEEE timezone string and timezone database strings (100
and 101 options respectively) is added for ipv4, conforming to RFC-4833.
The two options are passed to hook scripts in the variables tzstr and
tzdbstr.
function old new delta
dhcp_option_strings 280 294 +14
dhcp_optflags 76 80 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 18/0) Total: 18 bytes
Signed-off-by: Antoine Girard-Vallée <antoine.girard-vallee@savoirfairelinux.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcp_run_script 795 801 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
attach_option 406 349 -57
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcp_get_option32 - 27 +27
udhcp_get_option 231 248 +17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 44/0) Total: 44 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
As defined in RFC 5071.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Last foru commits:
function old new delta
option_to_env 621 791 +170
.rodata 168351 168505 +154
attach_option 431 506 +75
add_d6_client_options 112 167 +55
d6_option_strings 30 84 +54
udhcp_str2optset 644 660 +16
d6_optflags 12 20 +8
udhcpc6_main 2590 2596 +6
udhcpc_main 2648 2651 +3
read_optset 15 18 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 10/0 up/down: 544/0) Total: 544 bytes
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>
|
|
function old new delta
udhcp_str2optset 536 628 +92
packed_usage 32757 32760 +3
udhcpc_main 2708 2692 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 95/-16) Total: 79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Patch is based on work by tiggerswelt.net.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcp_get_option 220 225 +5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcp_get_option 215 220 +5
udhcp_run_script 802 803 +1
Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcpd_main 1501 1531 +30
d6_recv_raw_packet 251 264 +13
perform_d6_release 188 198 +10
udhcpc6_main 2443 2449 +6
udhcp_recv_raw_packet 582 588 +6
udhcp_recv_kernel_packet 132 138 +6
send_d6_renew 140 146 +6
d6_recv_kernel_packet 118 124 +6
send_renew 77 82 +5
send_discover 85 90 +5
send_decline 84 89 +5
send_d6_select 97 102 +5
send_d6_discover 174 179 +5
perform_release 167 172 +5
count_lines 72 74 +2
udhcpc_main 2836 2837 +1
bb_info_msg 125 - -125
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 17/4 up/down: 117/-180) Total: -63 bytes
text data bss dec hex filename
924935 906 17160 943001 e6399 busybox_old
924736 906 17160 942802 e62d2 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Like d3092c99, this change adds support for the DHCP "path-prefix"
option, as defined in RFC 5071. We use the string identifer
"pxepathprefix".
Adding this option makes string parsing in the hook scripts simpler.
function old new delta
dhcp_option_strings 255 269 +14
dhcp_optflags 72 74 +2
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This change adds a definition for DHCP option 209. RFC 5071 defines code
209 as a configuration file for a PXE bootloader; this change uses
the string "pxeconffile" as its text identifier.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
attach_option 416 413 -3
allocate_tempopt_if_needed 74 - -74
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Michael McTernan <Michael.McTernan.2001@cs.bris.ac.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The following options are replaced with string "bad" if they
contain malformed hostname:
HOST_NAME, DOMAIN_NAME, NIS_DOMAIN, TFTP_SERVER_NAME
function old new delta
xmalloc_optname_optval 850 888 +38
attach_option 440 443 +3
len_of_option_as_string 13 14 +1
dhcp_option_lengths 13 14 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 43/0) Total: 43 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The patch is from OpenWRT people.
function old new delta
xmalloc_optname_optval 637 874 +237
dhcp_option_strings 237 243 +6
dhcp_optflags 68 70 +2
len_of_option_as_string 12 13 +1
dhcp_option_lengths 12 13 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 247/0) Total: 247 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
dhcp_option_strings 217 237 +20
dhcp_optflags 64 68 +4
Signed-off-by: Nigel Hathaway <Nigel.Hathaway@ubiquisys.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
attach_option 395 413 +18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
dhcp_optflags 68 64 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
better
function old new delta
packed_usage 27802 27808 +6
static.udhcpc_longopts 261 250 -11
udhcpc_main 2799 2780 -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 6/-30) Total: -24 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcp_run_script 654 617 -37
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
allocate_tempopt_if_needed - 76 +76
udhcp_str2optset 351 415 +64
attach_option 380 398 +18
len_of_option_as_string 11 12 +1
dhcp_option_lengths 11 12 +1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 160/0) Total: 160 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
index_in_substrings 67 93 +26
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcp_option_idx - 77 +77
udhcp_str2optset 366 351 -15
udhcpc_main 2845 2801 -44
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 77/-59) Total: 18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This is needed for "overflow option" support
function old new delta
udhcp_find_option - 34 +34
udhcp_add_binary_option 94 106 +12
write_leases 227 223 -4
udhcp_init_header 86 82 -4
send_release 104 99 -5
init_packet 87 81 -6
add_client_options 160 154 -6
add_server_options 100 92 -8
udhcpd_main 1964 1954 -10
udhcpc_main 2859 2837 -22
find_option 34 - -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/8 up/down: 46/-99) Total: -53 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
udhcp_add_binary_option - 94 +94
udhcp_str2nip - 42 +42
len_of_option_as_string 12 10 -2
dhcp_option_lengths 12 10 -2
udhcpc_main 2859 2851 -8
read_nip 42 - -42
xmalloc_optname_optval 590 536 -54
udhcp_str2optset 443 366 -77
udhcp_add_option_string 86 - -86
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/5 up/down: 136/-271) Total: -135 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|