Commit Graph

1103 Commits

Author SHA1 Message Date
Denis Vlasenko
50f7f446ec bb_full_fd_action: remove potential xmalloc from NOFORK path
cat: stop using stdio.h opens
libbb: introduce & use open[3]_or_warn
function                                             old     new   delta
open3_or_warn                                          -      54     +54
bb_cat                                               115     144     +29
open_or_warn                                           -      25     +25
unlzma                                              2404    2412      +8
chattr_main                                          334     339      +5
xstrtoul_range_sfx                                   251     255      +4
telnet_main                                         1514    1510      -4
static.opt                                             4       -      -4
qgravechar                                           122     118      -4
fuser_add_pid                                         61      54      -7
fuser_add_inode                                      154     147      -7
writeFileToTarball                                  1542    1534      -8
refresh                                             1156    1148      -8
do_show                                              856     846     -10
read_leases                                          212     200     -12
setup_redirects                                      236     222     -14
iproute_list_or_flush                               1582    1568     -14
read_config                                          427     411     -16
write_leases                                         284     264     -20
hash_file                                            338     318     -20
copy_file                                           1760    1740     -20
do_iproute                                          2610    2588     -22
bb_full_fd_action                                    320     269     -51
open_to_or_warn                                      103      49     -54
fuser_main                                          1660    1596     -64
.rodata                                           131160  131096     -64
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/19 up/down: 125/-423)        Total: -298 bytes
2007-04-11 23:20:53 +00:00
Denis Vlasenko
6398cf477d style fixes, no code changes. 2007-04-11 17:04:29 +00:00
Bernhard Reutner-Fischer
12c96a64a4 - set the scope properly. Thanks to Jean Wolter, who wrote:
busybox ip and the original ip utility behave differently when setting
the following route (verified with ip route show using the original ip
utility):

   ip route add 10.0.0.138 dev eth0

Result for busybox ip:

       # ip route add 10.0.0.138 dev eth0
       # /usr/local/bin/ip route show
       10.0.0.138 dev eth0

Result for ip:

       # /usr/local/bin/ip route add 10.0.0.138 dev eth0
       #  /usr/local/bin/ip route show
       10.0.0.138 dev eth0  scope link

A following "ip route add default via 10.0.0.138" fails for busybox
ip, since the kernel can not find a route to 10.0.0.138 (it replies
with Network is unreachable).

The reasons seems to be that the original ip utility explicitly sets
the scope after parsing all parameters. This is missing in busybox,
the attached patch fixes this. I took this from the original iproute
sources and removed some variables, which are not needed for busybox.
2007-04-11 16:23:57 +00:00
Denis Vlasenko
473dae080a add more convenient defines for [NO]MMU:
"#ifndef BB_NOMMU" is a double negative
2007-04-11 07:04:23 +00:00
Bernhard Reutner-Fischer
07c394e69b - mv ip*_main into ip.c; use a dispatcher to save on needless duplication.
Saves a minor 12b.
2007-04-10 20:11:12 +00:00
Bernhard Reutner-Fischer
e87d7955f8 - rewrite the ip applet to be less bloaty
- mark libiproute's matches() as deprecated. Convert to index_in_(sub)str_array()!
   text    data     bss     dec     hex filename
    314       0       0     314     13a ip.o.orig
    200       0       0     200      c8 ip.o
Using a smallint for the key would save another byte.
2007-04-10 18:43:27 +00:00
Denis Vlasenko
ff131b980d style fixes. No code changes. 2007-04-10 15:42:06 +00:00
Bernhard Reutner-Fischer
7e8a53a335 - add libbb function str_tolower to convert a string to lowercase.
- shrink wget a bit
2007-04-10 09:37:29 +00:00
Denis Vlasenko
8d9f495d68 getopt32: fix llist_t options ordering. llist_rev is not unused.
function                                             old     new   delta
tar_main                                             705     695     -10
sort_main                                            928     918     -10
decode_format_string                                 886     876     -10
run_parts_main                                       197     185     -12
ps_main                                              513     500     -13
wget_main                                           2764    2750     -14
awk_main                                            1014    1000     -14
od_main                                             2886    2866     -20
llist_rev                                             25       -     -25
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/8 up/down: 0/-128)           Total: -128 bytes
2007-04-08 15:08:42 +00:00
Denis Vlasenko
540a2a1f3b libiproute: audit callgraph, shortcut error paths into die() functions.
Kill a few statics, made other globals smaller:
oneline is smallint, _SL_ is char

function                                             old     new   delta
print_tunnel                                         693     731     +38
print_route                                         1775    1777      +2
print_addrinfo                                      1495    1497      +2
ipaddr_list_or_flush                                2826    2828      +2
oneline                                                4       1      -3
_SL_                                                   4       1      -3
ipaddr_modify                                       1476    1472      -4
parse_address                                        124     119      -5
ip_parse_common_args                                 429     423      -6
on_off                                                53      46      -7
do_del_ioctl                                         113     106      -7
do_add_ioctl                                         120     113      -7
do_show                                              864     856      -8
iprule_list                                          157     148      -9
do_iptunnel                                          310     299     -11
do_add                                               143     126     -17
get_ctl_fd                                            95      76     -19
set_address                                          108      84     -24
ip_main                                              351     323     -28
static.ifr                                            32       -     -32
parse_args                                          1992    1949     -43
iproute_list_or_flush                               1673    1582     -91
do_iplink                                           1583    1485     -98
filter                                               280       -    -280
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 4/18 up/down: 44/-702)         Total: -658 bytes
2007-04-07 01:14:45 +00:00
Denis Vlasenko
fbd2918f5c udhcp: MAC_BCAST_ADDR and blank_chaddr are in fact constant, move to rodata.
a few global variables reduced to smallints
function                                             old     new   delta
add_lease                                             75     227    +152
static.blank_chaddr                                    -      16     +16
MAC_BCAST_ADDR                                         -       6      +6
sockfd                                                 4       8      +4
udhcp_run_script                                    1153    1155      +2
state                                                  8       5      -3
listen_mode                                            4       1      -3
perform_release                                      152     148      -4
fd                                                     8       4      -4
blank_chaddr                                          16       -     -16
udhcpc_main                                         2518    2497     -21
.rodata                                           131864  131832     -32
oldest_expired_lease                                  61       -     -61
clear_lease                                          127       -    -127
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 3/6 up/down: 180/-271)          Total: -91 bytes
2007-04-07 01:05:47 +00:00
Denis Vlasenko
04c99ebb4f random small shrinkage and elimination of statics 2007-04-07 00:44:31 +00:00
Denis Vlasenko
19507f0869 nc: code shrinkage, bugfixes. -50 bytes code size 2007-04-06 10:41:05 +00:00
Denis Vlasenko
5f42d26865 nc: missed exit() in signal handler 2007-04-05 20:57:10 +00:00
Denis Vlasenko
29fe7265b8 nc: port nc 1.10 to busybox 2007-04-05 20:26:28 +00:00
Bernhard Reutner-Fischer
2e75dcc80d - add -s|--spider which only checks if the file exists but does not download it's content.
Closes #1291
2007-04-05 10:31:47 +00:00
Bernhard Reutner-Fischer
febe3c4211 - sed -e "s/char[[:space:]]*\*[[:space:]]*argv\[\]/char **argv/g" 2007-04-04 20:52:03 +00:00
Denis Vlasenko
ba2fb719b9 Copyright, help text, whitespace cleanups 2007-04-01 09:39:03 +00:00
Denis Vlasenko
2856dab477 tcpsvd: new applet
It's a GPL-ed 'clone' of Dan Bernstein's tcpserver.
Author: Gerrit Pape <pape@smarden.org>
http://smarden.sunsite.dk/ipsvd/
size tcpsvd.o
   text    data     bss     dec     hex filename
   2571       4      16    2591     a1f tcpsvd.o
2007-04-01 01:18:20 +00:00
Denis Vlasenko
2e723237c9 traceroute: move data off bss. small code optimizations.
function                                             old     new   delta
traceroute_main                                     4358    4397     +39
verbose                                               13       9      -4
useicmp                                                4       -      -4
nflag                                                  4       -      -4
split_suffices                                        40      24     -16
route                                                 16       -     -16
dumpleases_main                                      392     357     -35
gwlist                                                36       -     -36
whereto                                              128       -    -128
wherefrom                                            128       -    -128
packet                                               512       -    -512
------------------------------------------------------------------------------
(add/remove: 0/7 grow/shrink: 1/3 up/down: 39/-883)          Total: -844 bytes
2007-03-29 21:55:22 +00:00
Denis Vlasenko
5e43d8591b dumpleases: getopt32()-ization
(from Mats Erik Andersson <mats.andersson64@comhem.se>)
2007-03-29 19:29:32 +00:00
Bernhard Reutner-Fischer
0864f4d14f - fix formatting of help text 2007-03-28 16:46:03 +00:00
Denis Vlasenko
10457b90db make pidfile writing configurable.
[ui]toa_to_buf: change API. No users yet.
2007-03-27 22:01:31 +00:00
Denis Vlasenko
afa7023b46 zcip: make it work on NOMMU (+ improve NOMMU support machinery)
fsck: fix bad English in a comment
2007-03-26 17:25:33 +00:00
Denis Vlasenko
53091ecd20 Attempt to get more applets compile for NOMMU.
TODO_config_nommu documents what I managed to compile so far
(yay! msh works! cool). inetd, telnetd, httpd still do not compile. TODO
Also make fork(), daemon() produce warnings on compile stage
(in addition to erros on link stage).
2007-03-26 13:35:09 +00:00
Denis Vlasenko
ec1a4b5a52 pidfile.c: not used anymore
BTW, previous change removed pidfile locking, -700 code (static compile)
2007-03-26 13:24:24 +00:00
Denis Vlasenko
af1c84360f Move udhcp to new NOMMU helpers.
Fix server part to compile under NOMMU.
Client is not compilable yet.
On MMU everything compiles (and maybe even works :)
2007-03-26 13:22:35 +00:00
Denis Vlasenko
5a142025d3 move everything to new NOMMU helpers, except udhcp 2007-03-26 13:20:54 +00:00
Denis Vlasenko
cad04ef4f3 add NOMMU fixme's; move move_fd from runit_lib to libbb; nuke fd_copy 2007-03-25 23:21:05 +00:00
Denis Vlasenko
55f30b05ac inetd,ed,msh: data/bss reduction (in mss, more than 9k of it) 2007-03-24 22:42:29 +00:00
Denis Vlasenko
219d14d514 random style fixes (extra spaces deleted) 2007-03-24 15:40:16 +00:00
Denis Vlasenko
5b27fbe990 dc: use common_bufsiz1 for evaluation stack
msh: fix "underscore bug" (a_b=1111 didn't work)
dnsd: openlog(), so that applet's name is logged
2007-03-24 14:06:51 +00:00
Denis Vlasenko
b5b45a91f0 dnsd: last commit had a typo :( 2007-03-24 13:09:07 +00:00
Denis Vlasenko
d3bac03988 dnsd: fix several buglets, make smaller 2007-03-24 12:13:04 +00:00
Denis Vlasenko
9067f13be0 NOMMU re-exec trick shuld not depend on existence of "don't daemonize"
option for every affected applet (and dnsd, for example, don't have one).
Thus rework re-exec support to not require it. Code got smaller too.
2007-03-24 12:11:17 +00:00
Denis Vlasenko
ce074df814 inetd: indent labels uniformly 2007-03-24 12:07:31 +00:00
Denis Vlasenko
58875aefe4 assorted fixes uncovered by randomconfig runs 2007-03-22 22:22:10 +00:00
Denis Vlasenko
d0587ed966 interface: revert part of commit 18120 (eth aliases work again) 2007-03-22 19:35:51 +00:00
Denis Vlasenko
1787e22465 ifconfig: support (by ignoring it) "inet" before IP address or hostname 2007-03-22 18:56:00 +00:00
Bernhard Reutner-Fischer
6111a8f2e7 - don't automatically select run-parts but point out that this is a system-utility in the strict sense. 2007-03-19 20:28:03 +00:00
Bernhard Reutner-Fischer
16deb86746 - very minor size tweak.
TODO: mv to globals, config-out non-busybox dhcp client stuff, reduce string bloat, etc
   text    data     bss     dec     hex filename
   7543       0      28    7571    1d93 networking/ifupdown.o.orig
   7515       0      28    7543    1d77 networking/ifupdown.o
2007-03-19 19:54:56 +00:00
Denis Vlasenko
54e3d1f00d telnet: finish style cleanup bits 2007-03-19 14:52:26 +00:00
Denis Vlasenko
f24cdf1554 telnet: someone tried to do data optimization before me. Complete it.
text    data     bss     dec     hex filename
   2558       0     404    2962     b92 busybox.t2/networking/telnet.o
   2542       0       0    2542     9ee busybox.t3/networking/telnet.o
2007-03-19 14:47:09 +00:00
Denis Vlasenko
1cc70225e7 networking/interface.c: was doing really strange caching of fd's
open for getting ifconfig data - ??! Simplified all that. -200 bytes.
2007-03-15 19:46:43 +00:00
Denis Vlasenko
7f2527e5a7 arp, networking/interface.c: eliminate statics
and unneeded on-stack buffers, disable (comment out)
some apparently unused (and buggy) code paths. -700 bytes.
2007-03-14 22:11:20 +00:00
Denis Vlasenko
1ce190b7c1 udhcp: use fdprintf for pidfile creation (smaller code) 2007-03-14 21:54:42 +00:00
Denis Vlasenko
baca175912 kill superfluous returns at the end of void functions 2007-03-11 13:43:10 +00:00
Denis Vlasenko
2b52b2797b ifupdown: do not complain if !/var/run/ifstate 2007-03-09 22:48:08 +00:00
Denis Vlasenko
80281fefc0 httpd: make httpd usable for NOMMU CPUs 2007-03-07 22:16:38 +00:00
Denis Vlasenko
8e858e2700 clean up accumulated whitespace damage 2007-03-07 09:35:43 +00:00