aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp
AgeCommit message (Collapse)Author
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
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>
2019-06-13udhcpc: fix comment, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-11udhcpc6: fix aliasing warningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-11dhcpc.c: Added support for relay server parameter.Martin Lewis
Resolved a TODO by adding support for gateway_nip parameter. function old new delta udhcp_run_script 792 835 +43 Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-31dhcp: downgrade "got raw socket fd" message to log3, make log2 default maxDenys Vlasenko
log3 messages are very much redundant function old new delta change_listen_mode 322 302 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-31dhcp: get rid of static data signal_pipeDenys Vlasenko
function old new delta udhcp_sp_setup 65 110 +45 udhcp_sp_fd_set 60 59 -1 udhcpd_main 1442 1437 -5 udhcpc_main 2684 2679 -5 signal_pipe 8 - -8 packed_usage 33292 33284 -8 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/4 up/down: 45/-27) Total: 18 bytes text data bss dec hex filename 952746 481 7296 960523 ea80b busybox_old 952768 481 7288 960537 ea819 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-30udhcp: rename server_config to server_dataDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-26udhcp: rename client_config to client_data, server_config to server_dataDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-26udhcpc6: Fixed aliasing compilation errorMartin Lewis
Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-26dhcp: get rid of last global dataDenys Vlasenko
function old new delta udhcpc_main 2680 2684 +4 state 1 - -1 listen_mode 1 - -1 sockfd 4 - -4 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 1/0 up/down: 4/-6) Total: -2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-23dhcp: tweak comments, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-21udhcpd: fix printing of static leasesDenys Vlasenko
function old new delta read_staticlease 299 282 -17 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-16udhcpd: code shrinkDenys Vlasenko
function old new delta send_packet_verbose - 35 +35 send_offer 443 423 -20 send_ACK 152 131 -21 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 35/-41) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-16udhcpd: support per-client hostnames in static leasesDenys Vlasenko
function old new delta read_staticlease 222 299 +77 add_server_options 92 154 +62 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 139/0) Total: 139 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-15udhcpc6: unbreakDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-15udhcpd: code shrink - do not fetch requested IP twiceDenys Vlasenko
function old new delta send_offer 444 443 -1 udhcpd_main 1454 1442 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-13) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-14style fix, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-10udhcpd: code shrinkDenys Vlasenko
function old new delta is_nip_reserved_as_static - 28 +28 get_static_nip_by_mac 43 47 +4 udhcpd_main 1459 1454 -5 send_offer 449 444 -5 read_leases 309 299 -10 is_nip_reserved 20 - -20 packed_usage 33283 33243 -40 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/4 up/down: 32/-80) Total: -48 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-30Optionally re-introduce bb_info_msg()James Byrne
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>
2019-04-14udhcpc6: code shrinkDenys Vlasenko
function old new delta d6_read_interface 593 582 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13udhcpc6: add a few comments, no code changes.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13udhcpc6: make it enabled in defconfigDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13udhcp: add 100 and 101 dhcp options for ipv4Antoine Girard-Vallée
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>
2019-02-27udhcpc: don't exit after backgrounding on -n -bAndrey Mazo
Currently, running "udhcpc -n -b" causes udhcpc to go to background and then exit after some time unless a lease is obtained. It's not very useful to do so as the calling process doesn't know if the lease was obtained or not anyway. The code actually tries to favor "-b" over "-n", but doesn't clear "-n" flag while clearing "-b" after backgrounding. So, clear "-n" flag after going into background. This effectively makes "-b" override "-n" completely and "-n -b" behave the same as "-b". This allows to override default "-n" option, passed to udhcpc by ifupdown, without recompiling busybox. URL: https://bugs.busybox.net/11691 Signed-off-by: Andrey Mazo <ahippo@yandex.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-27udhcpc: tweak --helpDenys Vlasenko
function old new delta packed_usage 33324 33315 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-15Update examples/udhcp/udhcpd.confDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-07udhcpc: when decoding DHCP_SUBNET, ensure it is 4 bytes longDenys Vlasenko
function old new delta udhcp_run_script 795 801 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-07udhcp: code shrinkDenys Vlasenko
function old new delta attach_option 406 349 -57 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: add size information for three more appletsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: add size information for udhcpcDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: update size informationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-27randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-17udhcpc: check that 4-byte options are indeed 4-byte, closes 11506Denys Vlasenko
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>
2018-11-03udhcpc: code shrinkDenys Vlasenko
function old new delta perform_release 112 172 +60 send_release 81 - -81 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 60/-81) Total: -21 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-30udhcpc: ensure at least one unicast renew attemptDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-09-28udhcpc: give SIGUSR1-induced renew one chance of unicast renewDenys Vlasenko
The caps were inconsistent: timeout to renew was capped at 20 seconds, and any renews with timeout <= 60 seconds were forced to broadcast. function old new delta udhcpc_main 2683 2680 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-01udhcpc: add a cooment about sanitizing DHCP_DOMAIN_NAME, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-01udhcpc: do in fact not allow hostname components which start with dashDenys Vlasenko
function old new delta xmalloc_optname_optval 879 893 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-04udhcp: add decimal option values in comments, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-04udhcp: tweak comment indentation, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-04udhcp: add option 211, "reboot time"Jeremy Kerr
As defined in RFC 5071. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-21udhcpc: remove code which requires server ID to be on local networkDenys Vlasenko
This reverts "udhcpc: paranoia when using kernel UDP mode for sending renew: server ID may be bogus". Users complain that they do have servers behind routers (with DHCP relays). function old new delta send_packet 168 166 -2 bcast_or_ucast 25 23 -2 udhcp_send_kernel_packet 301 295 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-10) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-06restore documentation on the build config languageKartik Agaram
Kconfig-language.txt was deleted in commit 4fa499a17b52b back in 2006. Move to docs/ as suggested by Xabier Oneca: http://lists.busybox.net/pipermail/busybox/2014-May/080914.html Also update references to it everywhere. Signed-off-by: Kartik Agaram <akkartik@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-24udhcpc6: carry along length of packet when parsing it.David Decotigny
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>
2018-05-24udhcpc6: ignore invalid OPTION_IAADDRDavid Decotigny
Signed-off-by: David Decotigny <ddecotig@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-14udhcpc6: set -x options in requestDenys Vlasenko
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>
2018-05-14udhcpc6: add PXELINUX optionsSamuel Mendoza-Jonas
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>
2018-05-14udhcpc6: add DHCPv6 boot optionsSamuel Mendoza-Jonas
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>
2018-05-14udhcpc6: add DHCPv6 env helperSamuel Mendoza-Jonas
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>
2018-05-14udhcp: fix use of trim() in udhcp_str2optset()Samuel Mendoza-Jonas
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>