Commit Graph

3067 Commits

Author SHA1 Message Date
Ron Yorston
17764603f2 httpd: allow '-h' to work when daemonized with NOMMU enabled
Commit d1b75e184 (httpd: permit non-default home directory with NOMMU
enabled) only works when used with the '-f' (foreground) option.

When '-f' isn't specified and NOMMU is enabled bb_daemonize_or_rexec()
is called to daemonize the server.  Since the server process has been
re-execed the previous patch results in the xchdir() not being called.

Fix this by resetting the re_execed variable in this case.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09 17:38:21 +02:00
Denys Vlasenko
0cad5f9b6d udhcp: comment out unused domain compression code
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>
2020-06-09 17:22:06 +02:00
Martin Lewis
726d0d148b dhcpc: code shrink in good_hostname
Incorporated valid_domain_label into good_hostname to simplify the implementation.

function                                             old     new   delta
static.xmalloc_optname_optval                        973     958     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-15)             Total: -15 bytes
   text	   data	    bss	    dec	    hex	filename
 993144	  16915	   1872	1011931	  f70db	busybox_old
 993129	  16915	   1872	1011916	  f70cc	busybox_unstripped

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09 01:49:10 +02:00
Dimitri John Ledkov
45fa3f18ad wget: implement TLS verification with ENABLE_FEATURE_WGET_OPENSSL
When ENABLE_FEATURE_WGET_OPENSSL is enabled, correctly implement TLS
verification by default. And only ignore verification errors, if
--no-check-certificate was passed.

Also note, that previously OPENSSL implementation did not implement
TLS verification, nor printed any warning messages that verification
was not performed.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1879533

CVE-2018-1000500

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-05-20 15:10:44 +02:00
Ron Yorston
d1b75e1842 httpd: permit non-default home directory with NOMMU enabled
When BusyBox is compiled with NOMMU enabled running httpd with
the '-h' option fails even if the specified directory exists:

   $ ls -d www
   www
   $ busybox httpd  -fvvvp 8080 -h www
   ...
   ... try to access http://localhost:8080/www
   ...
   httpd: can't change directory to 'www': No such file or directory

The parent process executes xchdir("www").  When a connection is accepted
it's handled by re-executing httpd in inetd mode.  The child process
inherits the current directory "www" and tries to change directory again
to "www", which fails.

Omit the call to xchdir() when httpd is re-executed.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30 16:37:44 +02:00
Denys Vlasenko
adc540f0db tftp: on download, open local file only when first bit of data arrived
No reason to potentially clobber existing file before absolutely necessary.

function                                             old     new   delta
tftp_protocol                                       1947    2020     +73
tftp_main                                            393     376     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 73/-17)             Total: 56 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13 15:27:23 +01:00
Denys Vlasenko
0c4e5977df tftp: fix thinko in code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13 15:03:12 +01:00
Denys Vlasenko
779df9f228 tftp: code shrink
function                                             old     new   delta
tftp_protocol                                       1949    1947      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13 13:01:43 +01:00
Denys Vlasenko
260bd21169 tftpd: show requested file name in open error message
function                                             old     new   delta
tftp_protocol                                       1902    1949     +47

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13 12:58:46 +01:00
Denys Vlasenko
020abc8856 udhcpd: mangle hostnames starting with dash ("-option")
function                                             old     new   delta
add_lease                                            316     328     +12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-01-14 17:07:18 +01:00
Denys Vlasenko
9ec836c033 whois: limit total length of response to 32+2 kb
function                                             old     new   delta
query                                                517     554     +37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-12-03 14:52:17 +01:00
Denys Vlasenko
ea096d6c13 ntpd: decrease MIN_FREQHOLD by 2, increase "penalty" for largish offset x2
> 2018-07-25:
> ntpd: increase MIN_FREQHOLD by 3
> This means we'll start correcting frequency ~5 minutes after start,
> not ~3.5 ones.
> With previous settings I still often see largish ~0.7s initial offsets
> only about 1/2 corrected before frequency correction kicks in,
> resulting in ~200ppm "correction" which is then slowly undone.

Review of real-world results of the above shows that with small
initial offsets, freq correction can be allowed to kick in sooner,
whereas with large (~0.8s) offsets, we still start freq correction
a bit too soon.

Let's rebalance this a bit.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-30 12:18:07 +01:00
Jo-Philipp Wich
6b4960155e nslookup: implement support for SRV records
Add support for querying and parsing SRV DNS records.

function                                             old     new   delta
send_queries                                        1711    1865    +154
qtypes                                                72      80      +8

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27 17:07:35 +01:00
Jo-Philipp Wich
8c3b520d4f nslookup: handle replies without RRs
Under some circumstances, a DNS reply might contain no resource records,
e.g. when a valid domain is queried that does not have records of the
requested type.

Example with nslookup from BIND dnsutils:

    $ nslookup -q=SRV example.org
    Server:	10.11.12.13
    Address:	10.11.12.13#53

    Non-authoritative answer:
    *** Can't find example.org: No answer

Currently the busybox nslookup applet simply prints nothing after the
"Non-authoritative answer:" line in the same situation.

This change modifies nslookup to either print "Parse error" or "No answer"
diagnostics, depending on the parse_reply() return value.

function                                             old     new   delta
send_queries                                        1676    1711     +35

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27 17:02:08 +01:00
Denys Vlasenko
d6ff27de15 ntpd: abs(tmx.offset) was truncating a "long" typed value
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 17:35:58 +02:00
Denys Vlasenko
b4ad1d86b6 tc: array address is never NULL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:41:31 +02:00
Denys Vlasenko
e076162897 traceroute: fix gcc-ism
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:39:41 +02:00
Denys Vlasenko
e5897d041d suppress a few "unused function" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:05:15 +02:00
Denys Vlasenko
1f1492bb96 netstat: suppress a warning (conversion from 'int' to 'smallint' changes value)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:00:01 +02:00
Denys Vlasenko
95867147f5 telnet: add disabled code to emit EC and IP
> I'm trying to connect to a Korenix 3005 switch through telnet
> for management purposes, and all is well except for the backspace character
> - seems like my switch doesn't handle it too well and instead of erasing
> the last character all it does is print some garbage to the screen.
> I've had the same issue before while using putty, but saw a solution that
> suggests to enable "Telnet special commands" in the options menu, and it
> worked.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-18 16:47:37 +02:00
Denys Vlasenko
37a9008f8e brctl: code shrink
function                                             old     new   delta
show_bridge                                          323     317      -6
brctl_main                                          2171    2164      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-13)             Total: -13 bytes
   text	   data	    bss	    dec	    hex	filename
1002083	    551	   5612	1008246	  f6276	busybox_old
1002065	    551	   5612	1008228	  f6264	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-15 12:31:54 +02:00
Denys Vlasenko
eb1395147a brctl: tweak help text, fix comments
function                                             old     new   delta
packed_usage                                       33255   33236     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12 19:51:46 +02:00
Denys Vlasenko
b4fa16d5ed brctl: fold show_bridge_ports_ into its caller
function                                             old     new   delta
brctl_main                                          2235    2171     -64

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12 19:42:37 +02:00
Denys Vlasenko
3398753818 brctl: code shrink
packed_usage                                       33253   33255      +2
write_uint                                            96      90      -6
show_bridge_timer                                     93      69     -24
brctl_main                                          2338    2235    -103
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-133)           Total: -131 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12 19:24:38 +02:00
Martin Lewis
6dcf563633 brctl: add support for showstp command
function                                             old     new   delta
brctl_main                                           974    2339   +1365
show_bridge_timer                                      -      93     +93
static.state_names                                     -      48     +48
printf_xstrtou                                         -      26     +26
packed_usage                                       33243   33253     +10
show_bridge                                          333     323     -10
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/1 up/down: 1542/-10)         Total: 1532 bytes
   text	   data	    bss	    dec	    hex	filename
 999868	    551	   5612	1006031	  f59cf	busybox_old
1002309	    551	   5612	1008472	  f6358	busybox_unstripped

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-11 17:58:15 +02:00
Michal Kazior
1f1988d525 udhcpc: fix segmentation fault on empty bin opt
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>
2019-10-08 15:14:46 +02:00
Martin Lewis
6c1af283f7 brctl: add support for showmacs command
function                                             old     new   delta
brctl_main                                           680     974    +294
packed_usage                                       33167   33187     +20
compare_fdbs                                           -      19     +19
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 333/0)             Total: 333 bytes

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08 14:43:51 +02:00
Tomas Paukrt
4527273f1c route: fix output of "route -n -A inet6"
The output of the command "route -n -A inet6" may be corrupted
due to partially initialized structure snaddr6 in the function
INET6_displayroutes.

Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08 13:52:12 +02:00
Denys Vlasenko
65741d004e telnet: fix uninitialized variable bug
function                                             old     new   delta
telnet_main                                         1236    1238      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-09-25 13:48:01 +02:00
Denys Vlasenko
11e024aa86 udhcpc6: add ELAPSED_TIME option to outgoing packets
function                                             old     new   delta
init_d6_packet                                        53     121     +68
udhcpc_main                                         2577    2582      +5
udhcpc6_main                                        2593    2597      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 77/0)               Total: 77 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-09-24 14:01:00 +02:00
David Demelier
4a9daf2b93 wget: increase redirections limit
Some hosting services like sourceforge perform a lot of relocations
before actually serving the file. Example of current limitation:

    busybox wget http://sourceforge.net/projects/fluxbox/files/fluxbox/1.3.7/fluxbox-1.3.7.tar.xz
    Connecting to sourceforge.net (216.105.38.13:80)
    Connecting to sourceforge.net (216.105.38.13:443)
    Connecting to sourceforge.net (216.105.38.13:443)
    Connecting to sourceforge.net (216.105.38.13:443)
    Connecting to downloads.sourceforge.net (216.105.38.13:443)
    wget: too many redirections

Signed-off-by: David Demelier <markand@malikania.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-09-12 12:09:30 +02:00
Eivind Versvik
22a6339627 udhcpc6: support stateless DHCPv6
-l will send Information-Request to request configuration parameters

function                                             old     new   delta
packed_usage                                       33114   33180     +66
send_d6_info_request                                   -      62     +62
udhcpc6_main                                        2534    2593     +59
udhcpc6_longopts                                     199     211     +12
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 199/0)             Total: 199 bytes

Signed-off-by: Eivind Versvik <versvikeivind@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-08-24 17:24:40 +02:00
Denys Vlasenko
4f70a32f46 udhcpc6: s/iphdr/ip6_hdr/
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-08-09 20:43:40 +02:00
Denys Vlasenko
b694608429 ntpd: add comment about mode6, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02 15:03:47 +02:00
Denys Vlasenko
c0961e09b2 ntpd: commonalize message strings
function                                             old     new   delta
recv_and_process_peer_pkt                            961     973     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 12/0)               Total: 12 bytes
   text	   data	    bss	    dec	    hex	filename
 953108	    481	   7288	 960877	  ea96d	busybox_old
 953086	    481	   7288	 960855	  ea957	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02 13:10:19 +02:00
James Byrne
6937487be7 libbb: reduce the overhead of single parameter bb_error_msg() calls
Back in 2007, commit 0c97c9d437 ("'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-07-02 11:35:03 +02:00
Denys Vlasenko
caecfdc20d ntpd: abort if argvs are (unexpectedly) given
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02 11:28:18 +02:00
Denys Vlasenko
84d38500a7 udhcpc: fix comment, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-13 10:02:03 +02:00
Denys Vlasenko
72f12acb6b udhcpc6: fix aliasing warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-11 18:18:48 +02:00
Martin Lewis
d378fa170a dhcpc.c: Added support for relay server parameter.
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-06-11 17:18:28 +02:00
Denys Vlasenko
894f0a3235 tftp: allow -lc and -cl options
function                                             old     new   delta
tftp_main                                            394     396      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-09 12:41:17 +02:00
Denys Vlasenko
94ce1c0ebb tftpd: revert erroneous change
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-09 11:32:23 +02:00
Denys Vlasenko
3b8025f132 tftp: optional tftp-hpa compat
function                                             old     new   delta
tftp_main                                            276     394    +118

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-09 11:12:02 +02:00
Denys Vlasenko
04a0b7f080 bc: placate compiler warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-08 12:58:16 +02:00
Denys Vlasenko
3e463e1cfd brctl: placate compiler warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-08 12:35:06 +02:00
Denys Vlasenko
1230aec77a httpd: .js is "application/javascript", not "application/x-javascript"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-07 12:32:30 +02:00
Denys Vlasenko
5c317c0b8d httpd: add js to built in MIME types list
Firefox needs this to execute .js

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-07 09:32:03 +02:00
Vicente Jimenez Aguilar
09b25ecc51 httpd: add svg to built in MIME types list
Signed-off-by: Vicente Jimenez Aguilar <googuy@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-07 09:31:57 +02:00
Denys Vlasenko
45e3967c20 libbb: move netlink socket binding to the utility function
function                                             old     new   delta
create_and_bind_to_netlink                             -     134    +134
ifplugd_main                                        1117    1052     -65
uevent_main                                          399     306     -93
mdev_main                                            314     215     -99
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 134/-257)         Total: -123 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-03 14:16:52 +02:00
Denys Vlasenko
6eb6e6a1e9 dhcp: downgrade "got raw socket fd" message to log3, make log2 default max
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-31 23:52:16 +02:00
Denys Vlasenko
65c34c52df dhcp: get rid of static data signal_pipe
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-31 23:39:22 +02:00
Denys Vlasenko
91755cb16d udhcp: rename server_config to server_data
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-30 16:23:34 +02:00
Denys Vlasenko
bcb1fc3e6c udhcp: rename client_config to client_data, server_config to server_data
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-26 15:03:05 +02:00
Martin Lewis
818d9e02f2 udhcpc6: Fixed aliasing compilation error
Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-26 14:24:32 +02:00
Denys Vlasenko
a4ed2c45b9 dhcp: get rid of last global data
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-26 13:05:04 +02:00
Denys Vlasenko
1115e40c88 dhcp: tweak comments, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-23 15:24:03 +02:00
Denys Vlasenko
028c5aa18b ip: use rtnl_send_check() on flush commands, closes 6962
function                                             old     new   delta
rtnl_send_check                                        -     160    +160
xrtnl_wilddump_request                                64      66      +2
ipneigh_list_or_flush                                714     706      -8
rtnl_send                                             69       -     -69
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/1 up/down: 162/-77)            Total: 85 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-22 13:54:46 +02:00
Denys Vlasenko
84fc645605 *: slap on a few ALIGN1/2s where appropriate
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"

   text	   data	    bss	    dec	    hex	filename
 952537	    485	   7296	 960318	  ea73e	busybox_old
 952527	    485	   7296	 960308	  ea734	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-21 17:29:24 +02:00
Denys Vlasenko
831844c139 udhcpd: fix printing of static leases
function                                             old     new   delta
read_staticlease                                     299     282     -17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-21 16:06:34 +02:00
Khem Raj
ee9e5f92b6 networking: cc is not a register
gcc accepts

  __asm__ ( "" : : : "%cc");

but cc is not a real register and clang does not like it.

networking/tls_pstm_montgomery_reduce.c:385:4: error: unknown register name '%cc' in asm
|                         INNERMUL;
|                         ^

The % syntax nominally goes before a register, in this case cc,
like "memory" isn't a true register it's just a way of specifying that
the condition code registers for the target are clobbered

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-17 22:56:47 +02:00
Denys Vlasenko
25393fb55e udhcpd: code shrink
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-16 11:27:28 +02:00
Denys Vlasenko
a840884531 udhcpd: support per-client hostnames in static leases
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-16 11:18:49 +02:00
Denys Vlasenko
abe248b208 udhcpc6: unbreak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-15 14:20:32 +02:00
Denys Vlasenko
8402969d48 udhcpd: code shrink - do not fetch requested IP twice
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-15 13:08:48 +02:00
Denys Vlasenko
8c317f03f6 style fix, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-14 17:26:47 +02:00
Denys Vlasenko
15021f393d udhcpd: code shrink
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-05-10 15:55:12 +02:00
James Byrne
253c4e787a Optionally re-introduce bb_info_msg()
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-30 10:51:27 +02:00
Denys Vlasenko
13f4204561 ip: fix comment placement
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-29 00:34:07 +02:00
Denys Vlasenko
405095d84b ifupdown: close memory leak
function                                             old     new   delta
execute_all                                           80      91     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-28 17:55:27 +02:00
Denys Vlasenko
e49a572b52 httpd: do disable header reading timeout even if proxying
function                                             old     new   delta
handle_incoming_and_exit                            2362    2369      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19 14:24:57 +02:00
Denys Vlasenko
1c356948f1 httpd: use full size of iobuf[] when piping CGI data
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19 14:19:41 +02:00
Denys Vlasenko
af6012a1a7 httpd: do not set alarm() timeout if we read cached header
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19 14:03:37 +02:00
Denys Vlasenko
bca888a73e httpd: deindent code block, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19 14:02:51 +02:00
Denys Vlasenko
ad29ba73ee httpd: require "HTTP/xyz" at the end of request line
function                                             old     new   delta
handle_incoming_and_exit                            2379    2362     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-17)             Total: -17 bytes
   text	   data	    bss	    dec	    hex	filename
 981787	    485	   7296	 989568	  f1980	busybox_old
 981779	    485	   7296	 989560	  f1978	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19 13:59:58 +02:00
Alexander Vickberg
049670fbbe httpd: pass authorization header to CGI if not Basic
Pass the Authorization header to CGI if not of type Basic. This will
make it possible for CGI to verify authorization headers of type
Bearer <token>.

function                                             old     new   delta
handle_incoming_and_exit                            2370    2379      +9

Signed-off-by: Alexander Vickberg <wickbergster@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-18 10:06:39 +02:00
Alexander Vickberg
210b52476c httpd: When sending gzipped content use content-length header
Today for gzipped content httpd is using a header with name
Transfer-Length. However I can't find a header with that name in the
standards. Instead use Content-Length.

function                                             old     new   delta
.rodata                                           157940  157936      -4
send_headers                                         980     939     -41
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-45)             Total: -45 bytes

Signed-off-by: Alexander Vickberg <wickbergster@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-17 11:34:49 +02:00
Denys Vlasenko
2efa726b22 httpd: extract query string only after proxying check
function                                             old     new   delta
handle_incoming_and_exit                            2398    2370     -28

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 13:35:56 +02:00
Denys Vlasenko
62ba9e5ac3 httpd: make rmt_ip variable local
function                                             old     new   delta
handle_incoming_and_exit                            2385    2398     +13
if_ip_denied_send_HTTP_FORBIDDEN_and_exit             51      54      +3
get_line                                             110     106      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 16/-4)              Total: 12 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 13:18:12 +02:00
Denys Vlasenko
44f5b6a1cb httpd: check denied IPs even before reading 1st query line
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 12:59:20 +02:00
Denys Vlasenko
c69f648457 httpd: do not decode URL and headers if proxying - send all verbatim
function                                             old     new   delta
handle_incoming_and_exit                            2566    2385    -181

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 12:45:26 +02:00
Denys Vlasenko
cf695976c7 httpd: remove duplicate "decode URL escape sequences" code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 11:58:28 +02:00
Denys Vlasenko
fba665a888 httpd: put all headers into environment as HTTP_UPPERCASED_HEADER=val
Set up environment variables before running the CGI script.
The variables will be named HTTP_<filtered_name> where the <filtered_name>
is the header name capitalized and all characters not matching
[a-z] | [A-Z] | [0-9] replaced with '_'.

function                                             old     new   delta
http_response                                         80      88      +8
http_response_type                                    20      22      +2
send_headers                                         718     715      -3
parse_conf                                          1481    1478      -3
get_line                                             128     110     -18
cgi_io_loop_and_exit                                 599     569     -30
send_cgi_and_exit                                    882     738    -144
handle_incoming_and_exit                            2793    2592    -201
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/6 up/down: 10/-399)          Total: -389 bytes
   text	   data	    bss	    dec	    hex	filename
 982178	    485	   7296	 989959	  f1b07	busybox_old
 981675	    485	   7296	 989456	  f1910	busybox_unstripped

Signed-off-by: Alexander Vickberg <wickbergster@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 11:37:02 +02:00
Denys Vlasenko
d0ae4103dd httpd: fix handling of EOF in get_line()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 11:07:37 +02:00
Denys Vlasenko
ff36bec49b httpd: add missing {}
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 10:14:50 +02:00
Denys Vlasenko
bae8f7eaf2 httpd: do not percent-decode URI if proxying
The proxying is documented as follows:

P:/url:[http://]hostname[:port]/new/path

Howeverm urlcopy is not a true copy anymore when it is fdprint'ed
to proxy_fd, this is because percent_decode_in_place() is called
after the copy is created.

This breaks reverse proxying all URIs containing percent
encoded spaces, e.g. - because a decoded URI will be printed out
to proxy_fd instead of the original.

The fix keeps the logic in place to canonicalize the uri first,
before reverse proxying (one could argue that the uri
should be proxied completely unaltered, except for the prefix
rewrite).

function                                             old     new   delta
handle_incoming_and_exit                            2752    2792     +40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16 10:07:33 +02:00
Denys Vlasenko
02d650e159 httpd: fix proxy headers passing - full_write() instead of write()
function                                             old     new   delta
handle_incoming_and_exit                            2763    2752     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-14 20:46:57 +02:00
Denys Vlasenko
51792e126b httpd: if remote IP is denied, send FORBIDDEN reply earlier
While at it, fix sighup_handler to not clobber errno.

function                                             old     new   delta
send_HTTP_FORBIDDEN_and_exit_if_denied_ip              -      47     +47
sighup_handler                                        15      30     +15
handle_incoming_and_exit                            2791    2763     -28
checkPermIP                                           48       -     -48
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/1 up/down: 62/-76)            Total: -14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-14 19:57:13 +02:00
Denys Vlasenko
60bf77f7e7 udhcpc6: code shrink
function                                             old     new   delta
d6_read_interface                                    593     582     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-14 17:01:10 +02:00
Denys Vlasenko
0d75e8b797 udhcpc6: add a few comments, no code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13 19:43:15 +02:00
Denys Vlasenko
cc45cbcca4 udhcpc6: make it enabled in defconfig
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13 17:32:40 +02:00
Antoine Girard-Vallée
0e7bd69bb5 udhcp: add 100 and 101 dhcp options for ipv4
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-04-13 16:27:26 +02:00
Denys Vlasenko
2945822f86 brctl: add TODO: "showmacs BR"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13 15:48:31 +02:00
Denys Vlasenko
9435608804 brctl: simplify str_to_jiffies()
function                                             old     new   delta
write_uint                                             -      96     +96
brctl_main                                           721     678     -43
write_ulong                                           96       -     -96
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 96/-139)           Total: -43 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13 14:17:55 +02:00
Denys Vlasenko
dc1b2d4356 brctl: convert remaining commands to work via /sys
function                                             old     new   delta
write_ulong                                            -      96     +96
show_bridge                                          310     338     +28
static.ops                                             3       -      -3
arm_ioctl                                             20       -     -20
packed_usage                                       33344   33315     -29
brctl_main                                           885     721    -164
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 1/2 up/down: 124/-216)          Total: -92 bytes
   text	   data	    bss	    dec	    hex	filename
 982112	    485	   7296	 989893	  f1ac5	busybox_old
 982157	    485	   7296	 989938	  f1af2	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13 13:58:06 +02:00
Denys Vlasenko
c5150e9ce7 brctl: make "show" command retrieve data from /sys
ioctl interface is obsolete and has no 32/64 compat shim,
making "brctl show" fail for 32-bit userspace and 64-bit kernel.

function                                             old     new   delta
show_bridge                                            -     310    +310
read_file                                              -      64     +64
if_indextoname                                       117       -    -117
brctl_main                                          1183     885    -298
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/1 up/down: 374/-415)          Total: -41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-12 18:52:31 +02:00
Bernhard Reutner-Fischer
c6c19c31c1 ipaddress: remove unused variable no_link
ipaddress.c: In function ‘ipaddr_list_or_flush’:
ipaddress.c:427:6: warning: variable ‘no_link’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2019-04-07 18:09:37 +02:00
Denys Vlasenko
29c2dcfe1c telnetd: whitespace fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-04 16:54:14 +02:00
Denys Vlasenko
c6a8965297 telnetd: better AYT handling
function                                             old     new   delta
telnetd_main                                        1792    1837     +45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-04 16:00:23 +02:00
Martin Lewis
93594b1197 telnetd: Added support for AYT IAC command.
Fixed a TODO in AYT IAC handling by replying back with a NOP.

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-04 15:44:36 +02:00
Stefan Sørensen
bb3a9531b2 ip: Fix ip -o link
Commit db169f2538 breaks the "ip -o link"
command, no output is displayed.. Fix by only excluding the link info if
in oneline mode and if the address family is not AF_PACKET.

function                                             old     new   delta
ipaddr_list_or_flush                                1232    1202     -30

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-03-30 18:24:46 +01:00
Denys Vlasenko
da996c5d2a ntpd: do not create pid file if not backgrounded
function                                             old     new   delta
ntp_init                                             995    1021     +26
ntpd_main                                           1267    1257     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-10)             Total: 16 bytes

Reported by Alfonso Ranieri <alforan@tin.it>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-03-27 13:47:38 +01:00
Denys Vlasenko
5059653882 do not duplicate CONFIG_PID_FILE_PATH and ".pid" strings
text	   data	    bss	    dec	    hex	filename
 981737	    485	   7296	 989518	  f194e	busybox_old
 981704	    485	   7296	 989485	  f192d	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-03-17 19:48:39 +01:00
Andrey Mazo
87e216294a udhcpc: don't exit after backgrounding on -n -b
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-27 08:27:47 +01:00
Denys Vlasenko
544143da0c udhcpc: tweak --help
function                                             old     new   delta
packed_usage                                       33324   33315      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-27 08:17:07 +01:00
Denys Vlasenko
8502fa8747 ntpd: increase SLEW_THRESHOLD from 0.125 to 0.5
Linux kernel supports it since ~2006

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-15 14:32:08 +01:00
Bernhard Reutner-Fischer
414be6c111 ip link: Fix vlan proto, closes 8261 and 11638
The proto has to be passed in network byte-order.
While at it allow for
 ip link add link eth0 name eth0.2.24 type vlan proto 802.1ad id 24
 ip link del link eth0 name eth0.2.24 type vlan proto 802.1ad id 24
The del was lacking a dev_str and thus errored out. Fix by using
name/dev counterpart as fallback.

The proto identifier 802.1Q was not recognized, just it's lowercase
variant, fix that too.

function                                             old     new   delta
do_add_or_delete                                    1275    1376    +101
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 101/0)             Total: 101 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2019-01-22 15:22:05 +01:00
Denys Vlasenko
f50faf8408 ip link: fix mismatched enums in vlan_parse_opt(), closes 11631
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-22 10:07:50 +01:00
Denys Vlasenko
9b313ddcd8 wget: detect when the length of received file is less than advertised
function                                             old     new   delta
retrieve_file_data                                   579     596     +17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-21 13:53:26 +01:00
Denys Vlasenko
fc472ea187 wget: remove empty if/endif preprocessor directive pair
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-18 23:15:20 +01:00
Martin Lewis
94e748d027 wget: don't notify on download begin and end if quiet
When printing notification on download start and end,
mistakenly, it didn't respect the quiet option

function                                             old     new   delta
retrieve_file_data                                   561     579     +18
wget_main                                           2432    2437      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0)               Total: 23 bytes

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-17 13:46:14 +01:00
Denys Vlasenko
edb74f4019 Update examples/udhcp/udhcpd.conf
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-15 13:19:01 +01:00
Denys Vlasenko
3109d1f965 tls: code shrink
function                                             old     new   delta
lm_add                                                82      78      -4
curve25519                                           793     786      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-11)             Total: -11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-10 20:18:02 +01:00
Denys Vlasenko
6ca8e347fe nslookup: return exitcode 1 on resolution errors
function                                             old     new   delta
nslookup_main                                        757     760      +3
send_queries                                        1690    1677     -13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-09 13:38:57 +01:00
Denys Vlasenko
8419123112 telnet: placate compiler's warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-09 13:12:58 +01:00
Denys Vlasenko
959b04bc0e tls: add comment about dl.fedoraproject.org needing secp256r1 ECC curve
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-08 16:09:41 +01:00
Denys Vlasenko
74d9f1ba37 udhcpc: when decoding DHCP_SUBNET, ensure it is 4 bytes long
function                                             old     new   delta
udhcp_run_script                                     795     801      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-07 15:33:42 +01:00
Denys Vlasenko
b80bdeba02 udhcp: code shrink
function                                             old     new   delta
attach_option                                        406     349     -57

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-07 15:23:18 +01:00
Danijel Tasov
3f4fac577a telnet: provide feedback after successful connect
The real telnet provides some feedback:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.

We should do this to, because people are sitting there and think
a firewall is dropping packets.

function                                             old     new   delta
telnet_main                                         1270    1279      +9

Signed-off-by: Danijel Tasov <m@rbfh.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-06 19:20:05 +01:00
Denys Vlasenko
39b18196f8 telnetd: fix bad interaction with vhangup() from login
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-06 19:06:01 +01:00
Denys Vlasenko
935afafcf3 telnet: code shrink
function                                             old     new   delta
put_iac3_IAC_x_y_merged                                -      21     +21
put_iac4_msb_lsb                                       -      19     +19
put_iac2_msb_lsb                                       -      19     +19
put_iac                                               20      34     +14
iac_flush                                             32      36      +4
put_iac2_merged                                       46       -     -46
telnet_main                                         1492    1270    -222
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/1 up/down: 77/-268)          Total: -191 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-06 18:45:38 +01:00
Denys Vlasenko
5bfc4a32fd telnet: speed up processing of network input
function                                             old     new   delta
telnet_main                                         1482    1492     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-06 18:41:11 +01:00
Kaarle Ritvanen
1c952ba206 ip: print dadfailed flag
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-04 19:00:23 +01:00
Martin Lewis
46fc3290c2 wget: notify on download begin and end
When using -o to file the progress meter is not displayed, so write that
we started the download and that we finished it.

function                                             old     new   delta
retrieve_file_data                                   465     561     +96
wget_main                                           2412    2432     +20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 116/0)             Total: 116 bytes
   text	   data	    bss	    dec	    hex	filename
 979022	    485	   7296	 986803	  f0eb3	busybox_old
 979224	    485	   7296	 987005	  f0f7d	busybox_unstripped

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-04 18:27:28 +01:00
Martin Lewis
64f35361f4 wget: add -o flag
function                                             old     new   delta
wget_main                                           2348    2412     +64
packed_usage                                       33062   33093     +31
static.wget_longopts                                 252     266     +14
progress_meter                                       158     159      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 110/0)             Total: 110 bytes

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-04 18:17:09 +01:00
Denys Vlasenko
37bdd8f8cb tls: pstm code shrink
Optimize ABI calling convention and "dead code" cases where return value
is known to be always "success".

function                                             old     new   delta
pstm_mod                                             113    1227   +1114
pstm_exptmod                                        1463    1532     +69
pstm_montgomery_reduce                               381     393     +12
pstm_sqr_comba                                       478     487      +9
pstm_mul_comba                                       447     452      +5
der_binary_to_pstm                                    42      45      +3
pstm_count_bits                                       48      46      -2
pstm_clear                                            72      70      -2
pstm_clamp                                            57      55      -2
pstm_zero                                             38      34      -4
pstm_init_size                                        46      42      -4
pstm_init_for_read_unsigned_bin                       24      20      -4
pstm_grow                                             72      68      -4
pstm_unsigned_bin_size                                37      32      -5
pstm_cmp_mag                                          78      72      -6
pstm_copy                                             92      84      -8
pstm_mul_d                                           224     215      -9
pstm_rshd                                            104      94     -10
pstm_mul_2                                           156     146     -10
tls_handshake                                       2085    2072     -13
psRsaEncryptPub                                      421     408     -13
pstm_lshd                                            109      95     -14
pstm_cmp                                              54      39     -15
s_pstm_sub                                           228     212     -16
pstm_init_copy                                        72      52     -20
pstm_read_unsigned_bin                               109      88     -21
pstm_mulmod                                          120      99     -21
s_pstm_add                                           337     314     -23
pstm_add                                             108      84     -24
pstm_mul_2d                                          186     161     -25
pstm_sub                                             102      74     -28
pstm_to_unsigned_bin                                 151     120     -31
pstm_set                                              34       -     -34
pstm_div_2d                                          409     373     -36
pstm_init                                             42       -     -42
pstm_exch                                             50       -     -50
pstm_montgomery_setup                                 89       -     -89
pstm_2expt                                            96       -     -96
pstm_montgomery_calc_normalization                   140       -    -140
pstm_div                                            1522       -   -1522
------------------------------------------------------------------------------
(add/remove: 0/7 grow/shrink: 6/27 up/down: 1212/-2343)     Total: -1131 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-01 15:40:43 +01:00
Denys Vlasenko
b86b39bfda config: more tweaks
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 17:52:43 +01:00
Denys Vlasenko
df1ff103c9 config: add size information for three more applets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 13:37:44 +01:00
Denys Vlasenko
83e7e13628 config: add size information for udhcpc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 13:03:48 +01:00
Denys Vlasenko
b097a84d62 config: update size information
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 03:20:17 +01:00
Denys Vlasenko
3d27d435db randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-27 18:03:20 +01:00
Denys Vlasenko
6d3b4bb24d udhcpc: check that 4-byte options are indeed 4-byte, closes 11506
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-12-17 18:07:18 +01:00
Denys Vlasenko
3a4d5a73a8 tls: prepare for ECDH_anon ciphers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-10 19:19:38 +01:00
Denys Vlasenko
c67ff8a1b0 tls: fix a potential (currently "disabled" by a macro) SHA1-related bug
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-10 18:49:29 +01:00
Denys Vlasenko
63bfe0e4c0 tls: if !ENABLE_FEATURE_TLS_SHA1, tls->MAC_size is always SHA256_OUTSIZE for AES-CBC
function                                             old     new   delta
tls_xread_record                                     634     636      +2
xwrite_encrypted                                     579     580      +1
tls_handshake                                       2095    2085     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 3/-10)              Total: -7 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-10 16:43:53 +01:00
Denys Vlasenko
71fa5b0a4c tls: introduce FEATURE_TLS_SHA1 to make SHA1 code optional
When disabled:

function                                             old     new   delta
xwrite_encrypted                                     580     579      -1
prf_hmac_sha256                                      222     217      -5
hmac_begin                                           158     149      -9
static.ciphers                                        32      20     -12
tls_handshake                                       2115    2095     -20
hmac                                                  87      61     -26
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-73)             Total: -73 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-10 16:14:58 +01:00
Denys Vlasenko
32ec5f1705 tls: AES-GCM: in GMULT, avoid memcpy, use one less variable in bit loop
function                                             old     new   delta
GMULT                                                168     159      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-08 21:24:38 +01:00
Denys Vlasenko
b437df1157 inetd: suppress aliasing warning
function                                             old     new   delta
sigprocmask2                                           -       8      +8
wait_for_child_or_signal                             213     218      +5
dowait                                               424     429      +5
block_CHLD_HUP_ALRM                                   62      59      -3
sigprocmask_SIG_SETMASK                               16       -     -16
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/1 up/down: 18/-19)             Total: -1 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-08 15:35:24 +01:00
Denys Vlasenko
9f00a0fdb1 tls: make RIGHTSHIFTX() in AES-GCM faster
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-08 13:34:43 +01:00
Denys Vlasenko
dffc8ff6a6 tls: add ECDHE_PSK and remove ARIA cipher ids
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-27 10:35:10 +01:00
Denys Vlasenko
8a46c74f8d tls: add _anon_ cipher definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-26 17:33:17 +01:00
Denys Vlasenko
2eb04290f9 tls: enable TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 cipher
function                                             old     new   delta
static.ciphers                                        30      32      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-26 16:39:35 +01:00
Denys Vlasenko
60f784027e tls: cipher 009D is not yet supported, don't test for it
function                                             old     new   delta
tls_handshake                                       2116    2108      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-26 16:30:22 +01:00
Denys Vlasenko
d9f6c3b091 tls: speed up prf_hmac_sha256()
function                                             old     new   delta
hmac_sha_precomputed                                   -      58     +58
prf_hmac_sha256                                      181     222     +41
hmac_sha256                                           68       -     -68
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 99/-68)             Total: 31 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-26 15:55:41 +01:00
Denys Vlasenko
d4681c7293 tls: simplify hmac_begin()
function                                             old     new   delta
hmac_begin                                           196     158     -38

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-26 10:33:23 +01:00
Denys Vlasenko
ca7cdd4b03 tls: add support for 8 more cipher ids - all tested to work
function                                             old     new   delta
tls_handshake                                       2059    2116     +57
static.ciphers                                         -      30     +30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 87/0)               Total: 87 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-26 00:17:10 +01:00
Denys Vlasenko
838b88c044 tls: fix comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 18:52:47 +01:00
Denys Vlasenko
330d7f53f7 tls: add a comment on expanding list of supported ciphers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 17:27:48 +01:00
Denys Vlasenko
a6192f347f tls: do not leak RSA key
function                                             old     new   delta
tls_handshake                                       1957    2059    +102

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 16:17:26 +01:00
Denys Vlasenko
eb53d01be5 tls: code shrink
function                                             old     new   delta
xwrite_and_update_handshake_hash                      81      80      -1
tls_handshake                                       1987    1957     -30

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 14:45:55 +01:00
Denys Vlasenko
a33b008240 tls: code shrink
function                                             old     new   delta
tls_handshake                                       1993    1987      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 14:28:32 +01:00