aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
AgeCommit message (Collapse)Author
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-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-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-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-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-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-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>
2018-04-13udhcp: support string user options, closes 10946Denys Vlasenko
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>
2017-06-28udhcpc6: make -O OPT workDenys Vlasenko
Patch is based on work by tiggerswelt.net. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29typo in commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25udhcpc: check read of overload option data byte to be within packetDenys Vlasenko
function old new delta udhcp_get_option 220 225 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25udhcpc: check read of option length byte to be within packetBrian Foley
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>
2016-03-30udhcp: fix capitalization of two messagesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30udhcp: get rid of bb_info_msg()Denys Vlasenko
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>
2016-02-26udhcpc: fix OPTION_6RD parsing (could overflow its malloced buffer)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-16udhcp: add PXELINUX path prefix option (code 210) definitionJeremy Kerr
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>
2013-11-12udhcp: add PXELINUX config file option (code 209) definitionJeremy Kerr
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>
2013-05-17udhcp: code shrinkDenys Vlasenko
function old new delta attach_option 416 413 -3 allocate_tempopt_if_needed 74 - -74 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-17udhcpc: fix a problem with binary-encoded options #2Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-16udhcp: finish support of classless static routes (now the correct patch!)Michael McTernan
Signed-off-by: Michael McTernan <Michael.McTernan.2001@cs.bris.ac.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-08udhcpc: sanitize hostnames in incoming packets. Closes 3979.Denys Vlasenko
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>
2011-11-16udhcpc6: rudimentary code to export data to script; fix IAADDR parsingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20dhcpc: fix the case where we might add extra space at the end of envvar.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-19udhcpc: add support for DHCP option 212 (RFC 5969)Denys Vlasenko
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>
2011-04-26udhcp: add FEATURE_UDHCP_8021Q optionNigel Hathaway
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>
2011-02-06udhcpc: fix a problem with binary-encoded optionsDenys Vlasenko
function old new delta attach_option 395 413 +18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20udhcpc: remove now-unneeded definitions of vendor and client-id optsDenys Vlasenko
function old new delta dhcp_optflags 68 64 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20udhcpc: remove -c CLIENTID, it is hard to use, -x 61:hexstring does the same ↵Denys Vlasenko
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>
2010-09-26udhcp: add support for 0x21 ROUTES and 0xf9 MS_STATIC_ROUTES optionsVladislav Grishenko
Signed-off-by: Vladislav Grishenko <themiron@mail.ru> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
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>
2010-05-30dhcp: readability cleanups and small code shrinkDenys Vlasenko
function old new delta udhcp_run_script 654 617 -37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-06udhcp: s/sipservers/sipsrv/ to match other similar option namesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04udhcp: implement "raw" binary options. Closes bug 735Denys Vlasenko
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>
2010-04-04udhcp: s/dhcp_option/dhcp_optflag/gDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-03udhcpd: support decoding of option 120 "SIP servers". Closes bug 737Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-03libbb: make index_in_substrings return -1 on ambiguous matchesDenys Vlasenko
function old new delta index_in_substrings 67 93 +26 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-27udhcp: abort if we see unknown option, and show valid options if soDenys Vlasenko
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>
2010-03-26udhcp: pass pointer to whole packet to "add option" functionsDenys Vlasenko
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>
2010-03-26udhcp: move options.c to common.c; disable unused bool and s16 option codeDenys Vlasenko
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>
2009-06-17udhcp: logging improvements, field and variable renamesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17udhcp: change UDHCP_DEBUG into int, make verbosity selectable with -vDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2007-08-12trylink: produce even more info about final link stageDenis Vlasenko
trylink: explain how to modify link and drastically decrease amount of padding (unfortunately, needs hand editing ATM). *: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts size saving: 0.5k
2007-08-02udhcp: slight shrinkDenis Vlasenko
udhcpd_main 1171 1208 +37 udhcpc_main 2363 2387 +24 dhcprelay_main 1145 1146 +1 dhcprelay_stopflag 4 1 -3 dhcprelay_signal_handler 11 8 -3 client_background 46 42 -4 udhcp_read_interface 230 211 -19 udhcp_make_pidfile 76 - -76 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 3/4 up/down: 62/-105) Total: -43 bytes text data bss dec hex filename 770052 1096 11228 782376 bf028 busybox_old 769980 1096 11228 782304 befe0 busybox_unstripped
2007-07-03udhcp: many small fixes:Denis Vlasenko
* arpping(): smaller and even probably fixed * lots of variables/params converted: ulong -> uint32_t * uptime() nuked in favor of monotonic_sec() * udhcp_get_packet(): only one "bad vendor", simplify function old new delta reservedIp 36 35 -1 udhcpc_main 2462 2460 -2 addStaticLease 64 62 -2 static.broken_vendors 16 - -16 uptime 19 - -19 udhcpd_main 1273 1238 -35 udhcp_get_packet 223 184 -39 .rodata 144162 144106 -56 arpping 690 609 -81 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/7 up/down: 0/-251) Total: -251 bytes text data bss dec hex filename 734241 3028 14400 751669 b7835 busybox_old 734005 3028 14400 751433 b7749 busybox_unstripped
2007-05-03udhcpc: stop deleting our own pidfile if we daemonize.Denis Vlasenko
udhcp[cd]: stop using atexit magic fir pidfile removal.
2007-04-07udhcp: MAC_BCAST_ADDR and blank_chaddr are in fact constant, move to rodata.Denis Vlasenko
a few global variables reduced to smallints function old new delta add_lease 75 227 +152 static.blank_chaddr - 16 +16 MAC_BCAST_ADDR - 6 +6 sockfd 4 8 +4 udhcp_run_script 1153 1155 +2 state 8 5 -3 listen_mode 4 1 -3 perform_release 152 148 -4 fd 8 4 -4 blank_chaddr 16 - -16 udhcpc_main 2518 2497 -21 .rodata 131864 131832 -32 oldest_expired_lease 61 - -61 clear_lease 127 - -127 ------------------------------------------------------------------------------ (add/remove: 2/3 grow/shrink: 3/6 up/down: 180/-271) Total: -91 bytes
2007-03-27make pidfile writing configurable.Denis Vlasenko
[ui]toa_to_buf: change API. No users yet.
2007-03-26Move udhcp to new NOMMU helpers.Denis Vlasenko
Fix server part to compile under NOMMU. Client is not compilable yet. On MMU everything compiles (and maybe even works :)