Commit Graph

13498 Commits

Author SHA1 Message Date
Michel Stam
9f41271f3c udhcpd: add option for tweaking arpping
Some clients have a very short timeout for sending the DHCP
DISCOVER, shorter than the arpping timeout of 2000 milliseconds
that udhcpd uses by default.

This patch allows tweaking the timeout, or disabling of arpping
altogether, at the risk of handing out addresses which are
already in use.

function                                             old     new   delta
udhcpd_main                                         1460    1501     +41
udhcpc_main                                         2814    2851     +37
packed_usage                                       29957   29974     +17
arpping                                              477     493     +16
find_free_or_expired_nip                             161     174     +13
send_offer                                           285     292      +7
nobody_responds_to_arp                                85      89      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/0 up/down: 135/0)             Total: 135 bytes

Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-10-30 11:59:04 +01:00
Miroslav Lichvar
760d035699 ntpd: calculate offset to jitter ratio before updating jitter
The offset to jitter ratio is now calculated before updating
jitter to make the test more sensitive.

function                                             old     new   delta
ntp_init                                             460     474     +14
update_local_clock                                   752     764     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 26/0)               Total: 26 bytes

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-10-05 03:11:53 +02:00
Denys Vlasenko
cd73871178 sed: fix "sed CMD -i nonexistent_file". Closes 7484
function                                             old     new   delta
sed_main                                             643     676     +33

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-10-05 02:44:34 +02:00
Miroslav Lichvar
b434ce7069 ntpd: don't stay at short polling interval
To avoid polling servers frequently slowly increase the interval up
to BIGPOLL when
- no replies are received from a peer
- no source can be selected
- peer claims to be unsynchronized (e.g. we are polling it too
  frequently)

When recv() returns with an error, drop code to try to continue
on network errors: I'm not convinced those cases happen in real life.

function                                             old     new   delta
recv_and_process_peer_pkt                            919     838     -81

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-10-02 17:24:34 +02:00
Denys Vlasenko
cf76b5ce12 getty: set tty attrs so that control chars are shown as ^c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-10-02 13:45:21 +02:00
Denys Vlasenko
d3fe960271 ntpd: be less eager to use shorter poll intervals
* on step, poll interval drops to 8.5 mins instead of 32 seconds
* on total loss of all replies (no replies from any peer
  for last 8 requests), also drop poll interval to 8.5 mins
  instead of 32 seconds
* on send abd recv errors, RETRY_INTERVAL is now 32 seconds,
  not 5 seconds
* on timing out listening to reply, instead of unconditional
  shortening poll interval by x4, clamp it to NOREPLY_INTERVAL
  (512 seconds)
* if a largish offset is seen, clamp nexp poll interval
  to 128 seconds, not 64 seconds

function                                             old     new   delta
clamp_pollexp_and_set_MAXSTRAT                         -      37     +37
recv_and_process_peer_pkt                            861     869      +8
poll_interval                                         52      48      -4
update_local_clock                                   762     752     -10
ntpd_main                                           1063    1050     -13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/3 up/down: 45/-27)             Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-27 22:56:09 +02:00
Denys Vlasenko
186b98a86f ubiupdatevol: fix -t to not require an option. Closes 7466
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-25 22:10:32 +02:00
Denys Vlasenko
054f5a5b0d install: fix help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24 22:16:24 +02:00
Miroslav Lichvar
590a22cf8d ntpd: split out poll adjusting code
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24 15:37:17 +02:00
Miroslav Lichvar
fb143f783d ntpd: don't wait for good offset before disabling burst mode
The burst mode needs to be stopped even when no replies are received.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24 15:21:18 +02:00
Aaro Koskinen
0f78d616cb install: implement -t DIR
Some packages want to install themselves using "-t" to specify
the directory (as supported by GNU coreutils). Add support for the option
for compatibility reasons.

function                                             old     new   delta
install_longopts                                      76      95     +19
install_main                                         769     777      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0)               Total: 27 bytes

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24 02:52:08 +02:00
Aaro Koskinen
307d26c0eb less: make -E work
function                                             old     new   delta
buffer_print                                          71     104     +33

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-23 22:58:18 +02:00
Denys Vlasenko
865814a617 less: trivial code shrink
function                                             old     new   delta
read_lines                                           715     695     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-22 21:17:24 +02:00
Denys Vlasenko
d6e7672545 less: move "retry-on-EAGAIN" logic closer to read ops
This makes "G" (goto end of input) command work as well as
/search_for_nonexistent_string: both will read to EOF now
even from somewhat slow input (such as kernel's "git log").

function                                             old     new   delta
ndelay_on                                             35      43      +8
ndelay_off                                            35      43      +8
read_lines                                           695     691      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 16/-4)              Total: 12 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-22 21:14:02 +02:00
Denys Vlasenko
15943c886d less: disable "suppress empty wraparound" optimization
It is buggy wrt another use case...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-21 22:10:55 +02:00
Ari Sundholm
fbdc167f27 df: fix -T option when ENABLE_FEATURE_HUMAN_READABLE=0
Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-20 18:55:17 +02:00
Denys Vlasenko
cd7a38a87d false: make "false --help" exit with 1
function                                             old     new   delta
run_applet_no_and_exit                               447     445      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-18 00:47:05 +02:00
Ari Sundholm
d0cdacafa9 df: implement -T option
function                                             old     new   delta
df_main                                              863     998    +135
packed_usage                                       29827   29861     +34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 169/0)             Total: 169 bytes

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-17 20:53:58 +02:00
Denys Vlasenko
9caea2448e sed: fix a buglet in s///NUM handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-16 01:11:13 +02:00
Denys Vlasenko
7666fa1d02 ftpd: make LIST command show dotfiles too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-15 23:35:58 +02:00
Denys Vlasenko
05399fc53d vi: fix incorrect memory access on brace matching. Closes 7256
While at it, fix brace matching to actually show the match
(missed fflush was causing cursor positioning to be buffered);
shorten brace matching code; remove unused macro indirection
in indicate_error().

Custom linker script 'busybox_ldscript' found, using it
function                                             old     new   delta
indicate_error                                         -      61     +61
mysleep                                               43      56     +13
char_insert                                          483     486      +3
find_pair                                            167     124     -43
Indicate_Error                                        61       -     -61
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/1 up/down: 77/-104)           Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-15 17:06:10 +02:00
Denys Vlasenko
26a8b9f196 mdev: treat zero-length /dev/mdev.seq the same as "\n" one. Closes 7334
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-08 18:19:15 +02:00
Denys Vlasenko
07f7ea70ed ash: fix off-by-one in "jobs %4" handling. closes 7310
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-08 17:21:52 +02:00
Denys Vlasenko
2ec34969e7 ash: factor out ASH_HELP config option
It used to be aliased to !FEATURE_SH_EXTRA_QUIET for ash,
while hush had it separate from FEATURE_SH_EXTRA_QUIET.

Bring ash in line with hush.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-08 16:52:39 +02:00
Denys Vlasenko
3e9b13e4c5 find: support -perm /BITS. Closes 7340
function                                             old     new   delta
parse_params                                        1487    1497     +10
func_perm                                             57      61      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 14/0)               Total: 14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-05 12:16:15 +02:00
Denys Vlasenko
4eb1e425fe tftpd: tweak HP PA-RISC firmware bug compatibility
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-04 12:24:03 +02:00
Denys Vlasenko
67e01fecce tftpd: support full 512-byte requests
Some HP PA-RISC firmware always sends fixed 512-byte requests,
with trailing garbage.

function                                             old     new   delta
tftpd_main                                           578     572      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-03 18:35:38 +02:00
Denys Vlasenko
f02c52bcde taskset: fix logic error in "if it doesn't start with 0x..."
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-31 01:35:45 +02:00
Denys Vlasenko
34cc6c91a2 grep: fix "grep -r PATTRN SYMLINK_TO_DIR"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-28 15:50:09 +02:00
Florian Fainelli
6ff0551157 ping: add -p to specify data pattern
function                                             old     new   delta
common_ping_main                                    1788    1831     +43
sendping6                                             56      82     +26
sendping4                                             82     108     +26
packed_usage                                       29959   29938     -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 95/-21)             Total: 74 bytes

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-27 16:01:25 +02:00
Denys Vlasenko
962c4e8220 taskset: support CPU masks for more than 64 CPUs
function                                             old     new   delta
taskset_main                                         522     631    +109

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-17 19:36:22 +02:00
Denys Vlasenko
fb8d1ef2d0 addgroup: mention -S in the help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-15 14:29:43 +02:00
Denys Vlasenko
e9ab07c211 ash: make ${#var} unicode-aware
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-13 18:00:08 +02:00
Denys Vlasenko
841f8331d7 ash,hush: run reinit_unicode() only if makes sense
With static Unicode support, no need to check $LANG et al.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-13 10:09:49 +02:00
Denys Vlasenko
c538d5bcc3 hush: make ${#var} unicode-aware
This mimics bash

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-13 09:57:44 +02:00
Denys Vlasenko
45b4ecc868 init: if libc-based Unicode support is on, run setlocale(LC_ALL, "") at startup
It is not clear why we were excluding init from this.
The "getpid() != 1" clause was there from the beginning (2001)
but not explained.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-11 20:33:18 +02:00
Morten Kvistgaard
feac9b607d ftpd: add optional support for authentication
function                                             old     new   delta
cmdio_get_cmd_and_arg                                  -     237    +237
get_passwd                                             -      97     +97
check_password                                         -      82     +82
ftpd_main                                           2297    2178    -119
ask_and_check_password_extended                      206      84    -122
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 0/2 up/down: 416/-241)          Total: 175 bytes

Signed-off-by: Morten Kvistgaard <MK@pch-engineering.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-05 21:57:18 +02:00
Denys Vlasenko
09a0e2223f sha3: tweak comments and indentation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-30 16:26:09 +02:00
Denys Vlasenko
4ff933c0e7 sha3: code shrink (and speedup for SHA3_SMALL=0)
function                                             old     new   delta
sha3_process_block72                                1454    1359     -95

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-30 14:18:57 +02:00
Denys Vlasenko
6c6d37ee45 top: fix memset length (sizeof(ptr) vs sizeof(array) problem)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-29 17:00:30 +02:00
Timo Teräs
7df1f1dda1 top: fix and merge code to parse /proc/meminfo
display_header() code to parse meminfo as is was buggy:
- uninitialized variables were used if meminfo was not as expected
- meminfo parsing failed on new kernels (3.14+) as new field 'MemAvailable'
  was introduced between MemFree and Buffers
- shared memory was handled only for ancient kernels (2.4.x and earlier)

as result Buffers and shared memory fields were shown with bogus values
on current kernels.

The new code does not try to parse the old style summary header, as the
separated fields are always present (it saves code size). Additionally,
both Shmem (2.6+) and MemShared (2.4 and earlier) fields are now parsed
and summed for shared memory usage; as only one of them exists depending
on kernel version.

display_topmem_header() parses also meminfo so this makes it use the
same code for code shrink.

function                                             old     new   delta
display_header                                         -     681    +681
display_topmem_process_list                          465     684    +219
parse_meminfo                                          -     189    +189
static.fields                                          -     106    +106
static.match                                         132       -    -132
.rodata                                           120254  120117    -137
display_topmem_header                                513       -    -513
display_process_list                                1705     667   -1038
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 1/2 up/down: 1195/-1820)       Total: -625 bytes

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-27 21:49:27 +02:00
Denys Vlasenko
2a563ea49a sha3: add 32-bit optimized bit-sliced implementation
It is an interesting trick, but so far I only managed to make it work
correctly, not to make it faster and/or smaller.
The code is ifdefed out for now.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-25 17:24:13 +02:00
Ken Sharp
a4d564ad7c zcip: fix link-local IP conflict detection
During link-local IP resolution, if a regular ARP request is received
during the ARP probe period, it will incorrectly cause a target IP
conflict.  This then leads to a new IP being picked unnecessarily.

Per RFC 3927, section 2.2.1, we should flag a target IP conflict only if
the source IP is null, the target IP matches our IP, and the source
hw addr does not match our hw addr.

function                                             old     new   delta
zcip_main                                           1354    1322     -32

Signed-off-by: Ken Sharp <ken.sharp@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-20 14:01:49 +02:00
Jeremy Kerr
b8ffd11e65 udhcp: add PXELINUX path prefix option (code 210) definition
Like d3092c99, this change adds support for the DHCP "path-prefix"
option, as defined in RFC 5071. We use the string identifer
"pxepathprefix".

Adding this option makes string parsing in the hook scripts simpler.

function                                             old     new   delta
dhcp_option_strings                                  255     269     +14
dhcp_optflags                                         72      74      +2

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-16 14:21:42 +02:00
Denys Vlasenko
278842dd72 ntpd: add support for -I IFACE
function                                             old     new   delta
packed_usage                                       29908   29947     +39
ntp_init                                             428     460     +32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 71/0)               Total: 71 bytes

Signed-off-by: Nikolaus Froehlich <nikolaus@mathematik.uni-marburg.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-15 15:06:54 +02:00
David Marchand
7d16964c3e modinfo: fix module parsing with kernel >= 2.6.37
display() function returns the length of the value we are displaying + 1.
As a consequence, if we have field=value\0field=value\0field=value in the
binary, then the second occurence will be skipped as ptr will miss the first
character of the following field.

Example trying to list aliases from ixgbe.ko on a 3.2 kernel.

- In the module we have:
alias=pci:v00008086d00001560sv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Asv*sd*bc*sc*i*\0
alias=pci:v00008086d00001557sv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Fsv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Dsv*sd*bc*sc*i*\0
...

- Using modinfo -F alias ixgbe returns:
alias:          pci:v00008086d00001560sv*sd*bc*sc*i*
alias:          pci:v00008086d00001557sv*sd*bc*sc*i*
alias:          pci:v00008086d0000154Dsv*sd*bc*sc*i*
...

This problem appeared with kernel commit "modules: no need to align .modinfo
strings" b6472776816af1ed52848c93d26e3edb3b17adab in 2.6.37.

Fix this by not trusting display() return value but increment ptr by strlen(ptr)
(the same way as depmod.c does).

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-04 16:39:28 +02:00
Denys Vlasenko
03e17bfa8d fatattr: use the standard type for 32-bit int
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-04 15:16:46 +02:00
Denys Vlasenko
6e17766c33 setlogcons: fix help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-04 13:58:57 +02:00
Joshua Judson Rosen
ae57fcad5d syslogd: make "reopen log file every second" logic work for multiple logs
Move last_log_time from a single global to *each logFile_t*
so that we can actually apply the logic to every log-file
in multi-file configurations, rather than working only
for the first file written in each 1-second interval
and then leaving the others connected to possibly wrong files.

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-03 14:51:47 +02:00
Joshua Judson Rosen
e46047aa87 syslogd: syslogd: don't *decrement* log_file->size on write failures
Even if we fail to write to a log-file, and it's not growing,
it's not *shrinking* either....

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-02 19:41:41 +02:00