Commit Graph

2987 Commits

Author SHA1 Message Date
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
Denys Vlasenko
be5ca42e8d tls: code shrink
function                                             old     new   delta
aesgcm_GHASH                                         223     196     -27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 14:03:59 +01:00
Denys Vlasenko
23d0d8caf4 tls: on x86, use xorbuf_aligned_AES_BLOCK_SIZE() even with non-aligned source
function                                             old     new   delta
aesgcm_GHASH                                         228     223      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 12:02:45 +01:00
Denys Vlasenko
ab3c5e4c44 tls: actually fill in CIPHER_ID3 value in hello message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 00:53:19 +01:00
Denys Vlasenko
0d18e5cab2 ntpd: do not SEGV on "-p keyno:192.168.1.1", show --help instead
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-25 00:42:56 +01:00
Denys Vlasenko
5084bae61a wget: code shrink
function                                             old     new   delta
base64enc                                             53      46      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-24 21:56:21 +01:00
Denys Vlasenko
d2923b3d23 tls: fix is.gd again, fix AES-CBC using decrypt key instead of encrypt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-24 21:26:20 +01:00
Denys Vlasenko
03569bc50f tls: speed up xor'ing of aligned 16-byte buffers
function                                             old     new   delta
xorbuf_aligned_AES_BLOCK_SIZE                          -      23     +23
xwrite_encrypted                                     585     580      -5
aesgcm_GHASH                                         233     228      -5
GMULT                                                192     187      -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 23/-15)              Total: 8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-24 14:08:29 +01:00
Denys Vlasenko
941440cf16 tls: in AES-GCM decoding, avoid memmove
function                                             old     new   delta
xorbuf3                                                -      36     +36
xorbuf                                                24      12     -12
tls_xread_record                                     656     634     -22
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 36/-34)              Total: 2 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-24 13:51:46 +01:00
Denys Vlasenko
985702c892 tls: fix a thinko in GHASH optimization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-24 13:47:44 +01:00
Denys Vlasenko
624066f0cc tls: make tls_get_random() FAST_FUNC
function                                             old     new   delta
tls_handshake                                       1977    1985      +8
tls_get_random                                        32      28      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 8/-4)                Total: 4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 19:24:57 +01:00
Denys Vlasenko
26602b85a3 wget: print the final newline only for non-tty output
$ busybox wget URL 2>&1 | cat
Connecting to ....
install.iso          0% |                                | 2629k  0:02:05 ETA
install.iso          7% |**                              | 25.7M  0:00:23 ETA
install.iso         16% |*****                           | 54.1M  0:00:14 ETA
install.iso         20% |******                          | 67.4M  0:00:15 ETA
install.iso         25% |********                        | 81.0M  0:00:14 ETA
install.iso         30% |*********                       | 97.3M  0:00:13 ETA
install.iso         36% |***********                     |  117M  0:00:12 ETA
install.iso         41% |*************                   |  134M  0:00:11 ETA
install.iso         47% |***************                 |  152M  0:00:10 ETA
install.iso         54% |*****************               |  176M  0:00:08 ETA
install.iso         61% |*******************             |  200M  0:00:06 ETA
install.iso         66% |*********************           |  215M  0:00:06 ETA
install.iso         71% |**********************          |  231M  0:00:05 ETA
install.iso         75% |************************        |  244M  0:00:04 ETA
install.iso         79% |*************************       |  257M  0:00:03 ETA
install.iso         84% |***************************     |  275M  0:00:02 ETA
install.iso         91% |*****************************   |  297M  0:00:01 ETA
install.iso         99% |******************************* |  321M  0:00:00 ETA
install.iso        100% |********************************|  323M  0:00:00 ETA
  <-- no empty line here
$

function                                             old     new   delta
bb_progress_update                                   622     632     +10
progress_meter                                       152     158      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 16/0)               Total: 16 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 19:14:52 +01:00
Denys Vlasenko
fbf5e6363b tls: code shrink
function                                             old     new   delta
aesgcm_GHASH                                         262     233     -29

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 19:07:05 +01:00
Denys Vlasenko
d496b4002a tls: typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 19:00:12 +01:00
Denys Vlasenko
25569c3ca9 tls: make local buffers in aesgcm_GHASH() explicitly 32-bit aligned
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 18:55:15 +01:00
Denys Vlasenko
219c9d4b5d tls: code shrink
function                                             old     new   delta
xwrite_encrypted                                     599     585     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 18:48:20 +01:00
Denys Vlasenko
ecc9090cfc tls: simplify aesgcm_GHASH()
function                                             old     new   delta
xwrite_encrypted                                     604     599      -5
FlattenSzInBits                                       52       -     -52
aesgcm_GHASH                                         395     262    -133
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-190)           Total: -190 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 18:31:26 +01:00
Denys Vlasenko
5e4236d226 tls: in AES-CBC code, do not set key for every record - do it once
function                                             old     new   delta
aes_setkey                                            16     212    +196
tls_handshake                                       1941    1977     +36
aes_encrypt_1                                        382     396     +14
xwrite_encrypted                                     605     604      -1
tls_xread_record                                     659     656      -3
aes_encrypt_one_block                                 65      59      -6
aes_cbc_encrypt                                      172     121     -51
aesgcm_setkey                                         58       -     -58
aes_cbc_decrypt                                      958     881     -77
KeyExpansion                                         188       -    -188
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/5 up/down: 246/-384)         Total: -138 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 18:02:44 +01:00
Denys Vlasenko
83e5c627e1 tls: add support for TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher
function                                             old     new   delta
xwrite_encrypted                                     209     605    +396
GHASH                                                  -     395    +395
aes_encrypt_1                                          -     382    +382
GMULT                                                  -     192    +192
tls_xread_record                                     489     659    +170
aes_encrypt_one_block                                  -      65     +65
aesgcm_setkey                                          -      58     +58
FlattenSzInBits                                        -      52     +52
tls_handshake                                       1890    1941     +51
xwrite_and_update_handshake_hash                      46      81     +35
xorbuf                                                 -      24     +24
aes_setkey                                             -      16     +16
psRsaEncryptPub                                      413     421      +8
stty_main                                           1221    1227      +6
ssl_client_main                                      138     143      +5
next_token                                           841     845      +4
spawn_ssl_client                                     218     219      +1
volume_id_probe_hfs_hfsplus                          564     563      -1
read_package_field                                   232     230      -2
i2cdetect_main                                       674     672      -2
fail_hunk                                            139     136      -3
parse_expr                                           891     883      -8
curve25519                                           802     793      -9
aes_cbc_decrypt                                      971     958     -13
xwrite_handshake_record                               43       -     -43
aes_cbc_encrypt                                      644     172    -472
------------------------------------------------------------------------------
(add/remove: 9/1 grow/shrink: 9/8 up/down: 1860/-553)        Total: 1307 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-23 17:48:07 +01:00
Denys Vlasenko
4e46b98a45 tls: add comment, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-18 19:50:24 +01:00
Denys Vlasenko
fe836d8455 tls: code shrink
function                                             old     new   delta
spawn_ssl_client                                     219     218      -1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-14 11:35:36 +01:00
Denys Vlasenko
dbe95682b4 wget: print "TLS certificate validation not implemented" only once on redirects
function                                             old     new   delta
spawn_ssl_client                                     209     219     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-13 12:00:19 +01:00
Denys Vlasenko
d5a0405a6f tls: code shrink
function                                             old     new   delta
tls_get_zeroed_outbuf                                  -      28     +28
static.empty_client_cert                               7       -      -7
tls_handshake                                       1930    1890     -40
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 28/-47)            Total: -19 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-13 11:58:53 +01:00
Denys Vlasenko
de7b5bb59a tls: tidy up recently added ECDSA code
function                                             old     new   delta
tls_handshake                                       1935    1930      -5
static.OID_ECDSA_KEY_ALG                              21      11     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-15)             Total: -15 bytes
   text	   data	    bss	    dec	    hex	filename
 950036	    477	   7296	 957809	  e9d71	busybox_old
 950048	    477	   7296	 957821	  e9d7d	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-13 11:44:32 +01:00
Denys Vlasenko
375fc78d51 tls: code shrink
function                                             old     new   delta
static.f25519_one                                     32       -     -32
curve25519                                           835     802     -33
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-65)             Total: -65 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-13 03:15:15 +01:00
Denys Vlasenko
bddb6545a9 tls: add support for ECDHE-ECDSA-AES-128-CBC-SHA and x25519 curve
function                                             old     new   delta
curve25519                                             -     835    +835
tls_handshake                                       1619    1935    +316
xc_diffadd                                             -     230    +230
fe_mul__distinct                                       -     149    +149
lm_sub                                                 -     103    +103
lm_add                                                 -      82     +82
fe_mul_c                                               -      74     +74
fe_select                                              -      45     +45
static.f25519_one                                      -      32     +32
static.basepoint9                                      -      32     +32
static.OID_ECDSA_KEY_ALG                               -      21     +21
static.OID_RSA_KEY_ALG                                 -      13     +13
static.supported_groups                                -       8      +8
static.empty_client_cert                               -       7      +7
der_binary_to_pstm                                    40      42      +2
static.expected                                       13       -     -13
------------------------------------------------------------------------------
(add/remove: 14/1 grow/shrink: 2/0 up/down: 1949/-13)        Total: 1936 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-13 02:17:54 +01:00
Denys Vlasenko
084bac472b tls: code shrink
function                                             old     new   delta
tls_handshake                                       1643    1619     -24

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-05 00:19:15 +01:00
Denys Vlasenko
5df3b12241 tls: reorder a few more cipher ids
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-04 21:25:41 +01:00
Denys Vlasenko
b29d045581 tls: move TLS_AES_128_GCM_SHA256 definition up
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-04 21:18:29 +01:00
Denys Vlasenko
9b0ce4d608 tls: add more cipher ids, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-04 20:53:54 +01:00
Denys Vlasenko
9d05ad087e udhcpc: code shrink
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-11-03 23:34:35 +01:00
Denys Vlasenko
63d053d8c3 ntpd: default to FEATURE_NTP_AUTH=y
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-30 23:07:26 +01:00
Denys Vlasenko
c05aa6a776 udhcpc: ensure at least one unicast renew attempt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-30 11:56:18 +01:00
Brandon P. Enochs
a541314b1f ntpd: add support for MD5/SHA1 message authentication
Add support for MD5 message authentication as described in RFC 5905.
This patch also supports SHA1 authentication.

The key file format is the same file format as used by ntpd.
The configuration file format follows standard Unix conventions
(# comments) with lines consist of the following fields separated by whitespace:
<key identifier, [1,65535]> <SHA1|MD5> <an ASCII string of up to 20 characters|an octet string [a-zA-F0-9] of up to 40 characters>.

https://www.ietf.org/rfc/rfc5905.txt

function                                             old     new   delta
ntp_init                                             473     987    +514
hash                                                   -     125    +125
recv_and_process_peer_pkt                            889     961     +72
packed_usage                                       33066   33130     +64
ntpd_main                                           1226    1277     +51
find_key_entry                                         -      29     +29
add_peers                                            195     207     +12
recv_and_process_client_pkt                          509     514      +5
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 6/0 up/down: 872/0)             Total: 872 bytes

Signed-off-by: Brandon P. Enochs <enochs.brandon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-27 18:57:37 +02:00
Denys Vlasenko
4329116b6d nbd-client: support newstyle protocol, -b, -d, -p, -N
Recognize the "newstyle" protocol and switch to it automatically.
Add options for setting blocksize (-b) and for disconnecting
a nbd device (-d).

function                                             old     new   delta
nbdclient_main                                       492    1179    +687
static.long_options                                    -      80     +80
print_direc                                          438     457     +19
brctl_main                                          1169    1183     +14
bb_strtoll                                            84      89      +5
packed_usage                                       33082   33066     -16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/1 up/down: 805/-16)           Total: 789 bytes

Signed-off-by: Elvira Khabirova <lineprinter@altlinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-24 15:52:04 +02:00
Bernhard Reutner-Fischer
7effa31cd4 brctl: use a single buffer for brname and ifname
function                                             old     new   delta
brctl_main                                          1681    1675      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-6)               Total: -6 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2018-10-01 22:45:36 +02:00
Brandon Maier
14454b3071 ifupdown: support "source-directory" stanza
Support the "source-directory" stanza from ifupdown[1]. source-directory
will include all files in the named directory. Similar to the Busybox
version of the "source" stanza, this version of source-directory does
not currently support shell wildcards.

We only check that the stanza starts with "source-dir" as ifupdown does[2].

[1] https://manpages.debian.org/stretch/ifupdown/interfaces.5.en.html#INCLUDING_OTHER_FILES
[2] https://salsa.debian.org/debian/ifupdown/blob/0.8.33/config.c#L498

function                                             old     new   delta
read_interfaces                                     1150    1241     +91

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-09-30 13:23:05 +02:00
Denys Vlasenko
aae428f0bf udhcpc: give SIGUSR1-induced renew one chance of unicast renew
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-09-28 14:44:09 +02:00
Denys Vlasenko
1303962957 ntpd: more verbose message for "root distance too high" case
Managed to make ntpd on one of my machines to be stuck getting
"root distance too high" all the time, but log is not giving me
more informatin what exactly is happening...

function                                             old     new   delta
select_and_cluster                                  1045    1095     +50

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-09-13 12:15:36 +02:00
Denys Vlasenko
3d6f95ede6 whois: fix a possible out-of-bounds stack access
If fgets() returns incomplete string, we replace NUL with
'\n', and then trim() runs on a non-NUL-terminated buffer.
Prevent that.

While at it, bump buffer from 1k to 2k.

function                                             old     new   delta
query                                                519     524      +5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-09-04 14:48:00 +02:00
Denys Vlasenko
78a5ef9d2c ping: use setitimer() instead of ualarm()
function                                             old     new   delta
sendping_tail                                        218     265     +47
ualarm                                                79       -     -79
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/0 up/down: 47/-79)            Total: -32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-25 19:36:06 +02:00
Denys Vlasenko
3759516672 ip: tweak --help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-14 11:19:09 +02:00
Denys Vlasenko
36d198ec6d ping: implement -i SEC
function                                             old     new   delta
common_ping_main                                    1862    1968    +106
ualarm                                                 -      79     +79
packed_usage                                       32858   32897     +39
sendping_tail                                        204     218     +14
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 3/0 up/down: 320/0)             Total: 320 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-03 18:50:50 +02:00
Denys Vlasenko
9b1c8bf89b ntpd: show real, unclamped delays on low-latency networks
On fast network, I've seen "delay:0.002000" shown for all packets,
thus completely losing information on what real delays are.

The new code is careful to not reject packets with tiny delays
if the delay "grows a lot" but is still tiny:
0.000009 is "much larger" than 0.000001 (nine times larger),
but is still very good small delay.

function                                             old     new   delta
recv_and_process_peer_pkt                            863     889     +26

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-03 11:14:22 +02:00
Denys Vlasenko
9408978a43 nslookup: add support for search domains, closes 11161
function                                             old     new   delta
parse_resolvconf                                       -     311    +311
add_query_with_search                                  -     105    +105
nslookup_main                                        873     757    -116
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/1 up/down: 416/-116)          Total: 300 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-01 19:42:46 +02:00
Denys Vlasenko
02cf149ed7 udhcpc: add a cooment about sanitizing DHCP_DOMAIN_NAME, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-01 13:36:36 +02:00
Denys Vlasenko
48ec979ed1 udhcpc: do in fact not allow hostname components which start with dash
function                                             old     new   delta
xmalloc_optname_optval                               879     893     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-01 13:16:05 +02:00
Denys Vlasenko
79153cb6bc htpd: increase MIN_FREQHOLD by 3
This means we'll start correcting frequency ~5 minutes after start,
not ~3.5 ones.

With previos 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.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-25 14:58:49 +02:00
Denys Vlasenko
2cd81698ee udhcp: add decimal option values in comments, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-04 16:05:48 +02:00
Denys Vlasenko
6d26744a2c udhcp: tweak comment indentation, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-04 15:44:22 +02:00
Jeremy Kerr
fc267214f0 udhcp: add option 211, "reboot time"
As defined in RFC 5071.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-04 15:38:19 +02:00
Denys Vlasenko
9634e8a7d5 wget: fix fetching of https URLs without http proxy
The "fix fetching of https URLs with http proxy" commit
broke the usual http-to-https redirect:

$ wget http://busybox.net/downloads/busybox-1.29.0.tar.bz2
Connecting to busybox.net (140.211.167.122:80)
Connecting to busybox.net (140.211.167.122:443)
wget: server returned error: HTTP/1.1 400 Bad Request

Fixing...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-02 18:31:02 +02:00
Denys Vlasenko
029bd187bd ntpd: increase minimum G.FREQHOLD_cnt from 8 to 10
With ~0.9 initiall offsets, using 8 results in a bit too eager
frequency correction.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-02 16:18:34 +02:00
Denys Vlasenko
2f7738e474 nslookup: placate "warning: unused variable i"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 14:44:35 +02:00
Ivan Abrea
5cb4f9081f tls: fix to handle X.509 v1 certificates correctly
The syntax of public key certificates can be found in RFC 5280 section
4.1. The relevant part of the syntax is the following:

  TBSCertificate  ::=  SEQUENCE  {
    version         [0]  EXPLICIT Version DEFAULT v1,
    serialNumber         CertificateSerialNumber,
    ... remaining fields omitted ...
  }

The version field has a default value of v1. RFC 5280 section 4.1.2.1
says the following:

  If only basic fields are present, the version SHOULD be 1 (the value
  is omitted from the certificate as the default value); however, the
  version MAY be 2 or 3.

To help detect if the version field is present or not, the type of the
version field has an explicit tag of [0]. Due to this tag, if the
version field is present, its encoding will have an identifier octet
that is distinct from that of the serialNumber field.

ITU-T X.690 specifies how a value of such a type should be encoded with
DER. There is a PDF of X.690 freely available from ITU-T. X.690 section
8.1.2 specifies the format of identifier octets which is the first
component of every encoded value. Identifier octets encode the tag of a
type. Bits 8 and 7 encode the tag class. Bit 6 will be 0 if the encoding
is primitive and 1 if the encoding is constructed. Bits 5 to 1 encode
the tag number.

X.690 section 8.14 specifies what the identifier octet should be for
explicitly tagged types. Section 8.14.3 says if implicit tagging is not
used, then the encoding shall be constructed. The version field uses
explicit tagging and not implicit tagging, so its encoding will be
constructed. This means bit 6 of the identifier octet should be 1.

X.690 section 8.14 and Annex A provide examples. Note from their
examples that the notation for tags could look like [APPLICATION 2]
where both the tag class and tag number are given. For this example, the
tag class is 1 (application) and the tag number is 2. For notation like
[0] where the tag class is omitted and only the tag number is given, the
tag class will be context-specific.

Putting this all together, the identifier octet for the DER encoding of
the version field should have a tag class of 2 (context-specific), bit 6
as 1 (constructed), and a tag number of 0.

Signed-off-by: Ivan Abrea <ivan@algosolutions.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-24 20:05:24 +02:00
Codarren Velvindron
7c43d43117 ntpd: deprecate IPTOS_LOWDELAY in favor of IPTOS_DSCP_AF21
Update QoS markers.
Use DSCP AF21 for interactive traffic. DSCP is defined in RFC2474.
Many modern equipment no longer support IPTOS.

Signed-off-by: Codarren Velvindron <codarren@hackers.mu>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-24 20:03:55 +02:00
Denys Vlasenko
148788eb0e udhcpc: remove code which requires server ID to be on local network
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-21 17:38:14 +02:00
Kartik Agaram
43b17b1cd0 restore documentation on the build config language
Kconfig-language.txt was deleted in commit 4fa499a17b 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-06-06 15:16:48 +02:00
Denys Vlasenko
0972c7f7a5 wget: emit a message that certificate verification is not implemented
function                                             old     new   delta
spawn_ssl_client                                     185     209     +24

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-28 14:36:26 +02:00
David Decotigny
8f48fc01e9 udhcpc6: carry along length of packet when parsing it.
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-24 18:34:56 +02:00
David Decotigny
a174c791ec udhcpc6: ignore invalid OPTION_IAADDR
Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-24 18:26:01 +02:00
Denys Vlasenko
3f91e662f2 nc: fix the !NC_SERVER configuration
The symptom is the "nc: NO OPT l!" message.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-24 16:38:40 +02:00
Denys Vlasenko
6027597fd1 udhcpc6: set -x options in request
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-14 11:11:08 +02:00
Samuel Mendoza-Jonas
30f4d52ed1 udhcpc6: add PXELINUX options
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-14 10:46:00 +02:00
Samuel Mendoza-Jonas
23cbd7d5bb udhcpc6: add DHCPv6 boot options
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-14 10:46:00 +02:00
Samuel Mendoza-Jonas
bcdec1a8b8 udhcpc6: add DHCPv6 env helper
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-14 10:46:00 +02:00
Samuel Mendoza-Jonas
43b9235f66 udhcp: fix use of trim() in udhcp_str2optset()
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-05-14 10:46:00 +02:00
Denys Vlasenko
bc2e70b4a2 ifplugd: close signal race
function                                             old     new   delta
ifplugd_main                                        1109    1117      +8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-29 13:46:49 +02:00
Denys Vlasenko
df45eb49ac wget: handle URLs with @ or hash differently
If server replied with 302 and

Location: ?foo

we used to underflow the allocated space while trying to form the "@foo"
filename. Switch to forming "foo" filename.

function                                             old     new   delta
packed_usage                                       32795   32799      +4
parse_url                                            387     352     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-35)             Total: -31 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-24 13:35:32 +02:00
Denys Vlasenko
2aeb201c97 libbb: new option FEATURE_ETC_SERVICES: if off, /etc/services reads often avoided
In practice, "wget http://host.com/" always uses port 80.
People explicitly set non-standard ports via options or parameters
("telnet 1.2.3.4 567" or "telnet 1.2.3.4 ftp") instead of modifying
/etc/services.

function                                             old     new   delta
telnet_main                                         1466    1464      -2
rdate_main                                           215     198     -17
fakeidentd_main                                      269     252     -17
parse_url                                            459     392     -67
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-103)           Total: -103 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-17 12:43:54 +02:00
Denys Vlasenko
c72499584a nslookup: simplify make_ptr
function                                             old     new   delta
nslookup_main                                       2644    2611     -33

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15 20:04:57 +02:00
Denys Vlasenko
71e4b3f482 nslookup: get rid of query::rlen field
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15 19:51:42 +02:00
Denys Vlasenko
58e43a4c40 nslookup: move array of queries to "globals"
function                                             old     new   delta
add_query                                             95      89      -6
nslookup_main                                       2692    2641     -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-57)             Total: -57 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15 14:10:45 +02:00
Denys Vlasenko
4b6091f92c nslookup: accept lowercase -type=soa, document query types
Usage: nslookup [-type=QUERY_TYPE] [-debug] HOST [DNS_SERVER]

    Query DNS about HOST

    QUERY_TYPE: soa,ns,a,aaaa,cname,mx,txt,ptr,any

function                                             old     new   delta
packed_usage                                       32189   32258     +69

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15 12:58:15 +02:00
Denys Vlasenko
6cdc3195a6 nslookup: change -stats to -debug (it's a bug in bind that it accepts -s)
function                                             old     new   delta
packed_usage                                       32211   32189     -22
nslookup_main                                       2754    2692     -62
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-84)             Total: -84 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15 12:50:28 +02:00
Denys Vlasenko
d4461ef9fb nslookup: rework option parsing
function                                             old     new   delta
nslookup_main                                       2715    2754     +39
packed_usage                                       32179   32211     +32
add_ns                                                65      66      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 72/0)               Total: 72 bytes
   text	   data	    bss	    dec	    hex	filename
 926262	    555	   5740	 932557	  e3acd	busybox_old
 926239	    555	   5740	 932534	  e3ab6	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15 12:01:46 +02:00
Denys Vlasenko
a980109c6a nslookup: smaller qtypes[] array
function                                             old     new   delta
nslookup_main                                       2708    2715      +7
qtypes                                                80      72      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-8)               Total: -1 bytes
   text	   data	    bss	    dec	    hex	filename
 926277	    555	   5740	 932572	  e3adc	busybox_old
 926262	    555	   5740	 932557	  e3acd	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15 10:52:11 +02:00
Denys Vlasenko
2cf75b3c81 nslookup: process replies immediately, do not store them
function                                             old     new   delta
nslookup_main                                       1837    2708    +871
parse_reply                                          852       -    -852
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 871/-852)           Total: 19 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15 10:46:44 +02:00
Denys Vlasenko
4e73c0f659 nslookup: fix output corruption for "nslookup 1.2.3.4"
function                                             old     new   delta
nslookup_main                                       1832    1837      +5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14 23:18:34 +02:00
Denys Vlasenko
cf950cd3ea nslookup: more closely resemble output format of bind-utils-9.11.3
function                                             old     new   delta
nslookup_main                                       1880    1832     -48
parse_reply                                         1022     852    -170
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-218)           Total: -218 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14 23:08:23 +02:00
Denys Vlasenko
71e016d806 nslookup: shrink send_queries()
function                                             old     new   delta
rcodes                                                68      64      -4
nslookup_main                                       2007    1880    -127
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-131)           Total: -131 bytes
   text	   data	    bss	    dec	    hex	filename
 926735	    555	   5740	 933030	  e3ca6	busybox_old
 926525	    555	   5740	 932820	  e3bd4	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14 22:53:39 +02:00