Commit Graph

2883 Commits

Author SHA1 Message Date
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