Commit Graph

85 Commits

Author SHA1 Message Date
Denys Vlasenko
1d3a04a3a4 Code style fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-28 01:22:57 +01:00
Denys Vlasenko
9844d7e830 Revert "networking: properly initialize ipv6 scope id for printing it"
This reverts commit 2fb63292f7.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-29 19:27:00 +02:00
Timo Teräs
2fb63292f7 networking: properly initialize ipv6 scope id for printing it
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-28 22:16:48 +02:00
Felix Fietkau
f2c043acfc busybox: fix uninitialized memory when displaying IPv6 addresses
After commit 8e74adab01
("libbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport")
INET_sprint6 uses more than just sin6_addr, it also tries to display the
scope id, which is uninitialized when called from ife_print6.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-01 02:20:25 +01:00
Denys Vlasenko
02859aaeb2 use auto_string() where appropriate to kill a few statics
Custom linker script 'busybox_ldscript' found, using it
function                                             old     new   delta
static.str                                             4       -      -4
static.passwd                                          4       0      -4
bb_ask                                               322     311     -11
ether_print                                           63      47     -16
UNSPEC_print                                          82      66     -16
INET_sprint                                           59      38     -21
INET6_sprint                                          54      30     -24
make_human_readable_str                              292     235     -57
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/7 up/down: 0/-153)           Total: -153 bytes
   text	   data	    bss	    dec	    hex	filename
 939880	    992	  17480	 958352	  e9f90	busybox_old
 939736	    992	  17456	 958184	  e9ee8	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-09 18:16:40 +02:00
Denys Vlasenko
a977778893 ifconfig: fix double free fatal error in INET_sprint
Based on the patch by Zheng Junling <zhengjunling@huawei.com>
and Chen Gang <cg.chen@huawei.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-03 12:11:30 +01:00
Nicolas Dichtel
6761d7da83 networking: fix potential overflow in ife_print6()
devname is used by fscanf to store a string specified by '%20s'.

Extract from the man for the '%s' specifier:
Matches a sequence of non-white-space characters; the next pointer must be a
pointer to character array that is long enough to hold the input sequence and
the terminating null byte ('\0'), which is added automatically. The input
string stops at white space or at the maximum field width, whichever occurs
first.

Hence, the right length is 20 + 1 for the '\0'.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-14 17:43:05 +02:00
Bartosz Golaszewski
c19be75d57 networking: code shrink
function                                             old     new   delta
in_ether                                               -     124    +124
hexchar2int                                           42       -     -42
ifconfig_main                                       1237    1106    -131
ether_input                                          141       -    -141
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/1 up/down: 124/-314)         Total: -190 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-25 04:39:04 +02:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Denys Vlasenko
6967578728 whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 01:34:48 +01:00
Dan Fandrich
f533ec8767 *: simplify Ethernet header includes
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-10 05:17:59 +02:00
Denys Vlasenko
2514302658 Use net/ethernet.h instead of linux/if_ether.h in more cases. Closes 3619
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16 18:31:53 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
0f8960542f *: more empty lines removed. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:35:44 +02:00
Denys Vlasenko
a85b66e0f9 ifconfig: do not truncate interface names. closes bug 1795
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-23 23:04:15 +02:00
Denys Vlasenko
4836331924 libbb: factor out hex2bin() for infiniband address parser
function                                             old     new   delta
hex2bin                                                -     149    +149
in_ib                                                172      27    -145

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 15:29:32 +02:00
Denys Vlasenko
5342c3f310 clean up redundant, commented-out and misplaced includes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-01 15:09:44 +02:00
Denys Vlasenko
bb1dcc9aab more thorough fix for systems with strange socklen_t
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-02 12:45:38 +01:00
Denys Vlasenko
56b3eec162 small optimizations of toupper/tolower
function                                             old     new   delta
in_ib                                                191     172     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 13:03:59 +02:00
Denys Vlasenko
6935ec9c0b networking/interface.c: tiny code shrink
function                                             old     new   delta
if_readlist_proc                                     634     631      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22 19:42:26 +02:00
Denis Vlasenko
360d9661b6 libbb: add strncpy_IFNAMSIZ
function                                             old     new   delta
...
udhcp_read_interface                                 225     220      -5
brctl_main                                          1151    1146      -5
add_interface                                        109     104      -5
ipaddr_list_or_flush                                2174    2167      -7
do_add_ioctl                                          88      80      -8
vconfig_main                                         249     240      -9
do_del_ioctl                                          78      68     -10
do_iplink                                           1186    1173     -13
do_if_fetch                                          766     753     -13
buffer_fill_and_print                                196     179     -17
parse_args                                          1709    1684     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/20 up/down: 11/-140)         Total: -129 bytes
2008-12-02 18:18:50 +00:00
Denis Vlasenko
00d8417631 vi: speedup and code shrink (Walter Harms)
networking/interface.c: silence warning (Vladimir)
wget: more robust EINTR detection
2008-11-24 07:34:42 +00:00
Denis Vlasenko
12ff9dc714 networking/interface.c: better readability (by Walter Harms)
mkfs_minix: whitespace fix
2008-11-22 18:58:11 +00:00
Denis Vlasenko
dadfb4975b hush: add #defines to switch off break/continue if loops are not supported
*: remove a few inline keywords
no code changes
2008-07-29 10:16:05 +00:00
Denis Vlasenko
5415c856ea libbb: [x]fopen_for_{read,write} introduced and used.
(by Valdimir)

function                                             old     new   delta
config_open2                                           -      41     +41
config_read                                          507     542     +35
find_pair                                            169     187     +18
fopen_for_write                                        -      14     +14
fopen_for_read                                         -      14     +14
find_main                                            406     418     +12
xfopen_for_write                                       -      10     +10
xfopen_for_read                                        -      10     +10
popstring                                            134     140      +6
parse_inittab                                        396     401      +5
next_token                                           923     928      +5
pack_gzip                                           1659    1661      +2
bb__parsespent                                       117     119      +2
fallbackSort                                        1719    1717      -2
evalvar                                             1376    1374      -2
qrealloc                                              36      33      -3
...
...
...
...
singlemount                                         4579    4569     -10
process_stdin                                        443     433     -10
patch_main                                          1111    1101     -10
ifupdown_main                                       2175    2165     -10
file_action_grep                                      90      80     -10
uuidcache_init                                       649     637     -12
hush_main                                            797     785     -12
read_config                                          230     217     -13
dpkg_main                                           3835    3820     -15
read_line_input                                     3134    3110     -24
sysctl_main                                          232     203     -29
config_open                                           40      10     -30
WARN_BAD_LINE                                         44       -     -44
login_main                                          1714    1575    -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)        Total: -563 bytes
2008-07-21 23:05:26 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
defc1ea340 *: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text    data     bss     dec     hex filename
 808035     611    6868  815514   c719a busybox_old
 804472     611    6868  811951   c63af busybox_unstripped
2008-06-27 02:52:20 +00:00
Denis Vlasenko
3b162ecdf6 networking/interface.c: fix indentation 2008-06-04 07:59:51 +00:00
Denis Vlasenko
85e015c7c8 two fixlets for -Wall 2008-05-17 02:36:28 +00:00
Bernhard Reutner-Fischer
f3b778a4dc - fix bug where we incorrectly rejected ifconfig eth0 hw ether $whatever
- add support for printing ipoib to ifconfig
2008-05-16 16:10:31 +00:00
Denis Vlasenko
6b06cb80be more of -Wall fixes from Cristian Ionescu-Idbohrn.
Some are fixing real bugs.

function                                             old     new   delta
syslogd_main                                         938     958     +20
get_signum                                           136     143      +7
obj_load                                             777     782      +5
recv_from_to                                         210     214      +4
get_next_block                                      1795    1799      +4
display_topmem_process_list                         1117    1121      +4
logread_main                                         484     487      +3
buffer_fill_and_print                                 73      76      +3
kill_main                                            687     689      +2
ll_remember_index                                    240     241      +1
do_stats                                             452     453      +1
if_readconf                                          166     165      -1
display_process_list                                1192    1191      -1
run_applet_and_exit                                  507     505      -2
print_signames                                        33      31      -2
parse_one_line                                      1092    1090      -2
find_out_spec                                         57      55      -2
add_ksymoops_symbols                                 421     419      -2
ash_main                                            1407    1402      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17)            Total: 37 bytes
2008-05-15 21:30:45 +00:00
Denis Vlasenko
43d5d429fd remove stray semicolons (by Cristian Ionescu-Idbohrn) 2008-05-15 19:44:46 +00:00
Denis Vlasenko
01eaee9309 *: s/IF_NAMESIZE/IFNAMSIZ/, regularize its use a bit.
function                                             old     new   delta
strncpy_IFNAMSIZ                                       -      13     +13
set_slave_mtu                                         39      37      -2
set_slave_hwaddr                                      52      50      -2
set_master_hwaddr                                     52      50      -2
set_if_flags                                          40      38      -2
get_if_settings                                      101      98      -3
ifenslave_main                                      1680    1661     -19
vconfig_main                                         306     280     -26
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/7 up/down: 13/-56)            Total: -43 bytes
2008-04-21 02:21:45 +00:00
Denis Vlasenko
f90ab183d6 *: use fopen_or_warn in few more places 2008-03-20 21:19:35 +00:00
Denis Vlasenko
68404f13d4 *: add -Wunused-parameter; fix resulting breakage
function                                             old     new   delta
procps_scan                                         1265    1298     +33
aliascmd                                             278     283      +5
parse_file_cmd                                       116     120      +4
dname_enc                                            373     377      +4
setcmd                                                90      93      +3
execcmd                                               57      60      +3
count_lines                                           72      74      +2
process_command_subs                                 340     339      -1
test_main                                            409     407      -2
mknod_main                                           179     177      -2
handle_incoming_and_exit                            2653    2651      -2
argstr                                              1312    1310      -2
shiftcmd                                             131     128      -3
exitcmd                                               46      43      -3
dotcmd                                               297     294      -3
breakcmd                                              86      83      -3
evalpipe                                             353     349      -4
evalcommand                                         1180    1176      -4
evalcmd                                              109     105      -4
send_tree                                            374     369      -5
mkfifo_main                                           82      77      -5
evalsubshell                                         152     147      -5
typecmd                                               75      69      -6
letcmd                                                61      55      -6
add_cmd                                             1190    1183      -7
main                                                 891     883      -8
ash_main                                            1415    1407      -8
parse_stream                                        1377    1367     -10
alloc_procps_scan                                     55       -     -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148)          Total: -94 bytes
   text    data     bss     dec     hex filename
 797195     658    7428  805281   c49a1 busybox_old
 797101     658    7428  805187   c4943 busybox_unstripped
2008-03-17 09:00:54 +00:00
Denis Vlasenko
11c23d7b99 whitespace/style fix 2007-10-11 19:53:10 +00:00
Denis Vlasenko
4daad9004d introduce bb_putchar(). saves ~1800 on uclibc (less on glibc). 2007-09-27 10:20:47 +00:00
Denis Vlasenko
6ca409e0e4 trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
  of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts

size saving: 0.5k
2007-08-12 20:58:27 +00:00
Denis Vlasenko
6b74b0241c interface.c: code shrink (IIRC ~30 bytes) 2007-07-29 14:17:48 +00:00
Denis Vlasenko
b71c668c57 style fix (stray space before ';') 2007-07-21 15:08:09 +00:00
Denis Vlasenko
2851082d5d ifconfig: make it work with ifaces with ifnames > 255 2007-07-17 22:53:05 +00:00
Denis Vlasenko
fb79a2e2cf xioctl and friends by Tito <farmatito@tiscali.it>
function                                             old     new   delta
do_iptunnel                                          203     977    +774
process_dev                                         5328    5494    +166
ioctl_or_perror                                        -      54     +54
ioctl_or_perror_and_die                                -      51     +51
ioctl_alt_func                                         -      49     +49
bb_ioctl_or_warn                                       -      47     +47
do_add_ioctl                                         102     145     +43
bb_xioctl                                              -      39     +39
print_value_on_off                                     -      31     +31
get_lcm                                              105     123     +18
arp_main                                            2155    2167     +12
..................
zcip_main                                           1576    1566     -10
setlogcons_main                                       92      82     -10
dumpkmap_main                                        263     253     -10
do_get_ioctl                                          85      75     -10
setkeycodes_main                                     165     154     -11
write_table                                          244     232     -12
vconfig_main                                         318     306     -12
do_del_ioctl                                          93      81     -12
set_address                                           75      62     -13
maybe_set_utc                                         30      16     -14
loadfont_main                                        495     479     -16
slattach_main                                        712     695     -17
do_loadfont                                          191     174     -17
do_iplink                                           1155    1136     -19
getty_main                                          2583    2562     -21
fbset_main                                          2058    2035     -23
do_time                                              588     565     -23
xioctl                                                25       -     -25
read_rtc                                             186     160     -26
parse_conf                                          1299    1270     -29
udhcp_read_interface                                 269     239     -30
bb_ioctl                                              45       -     -45
bb_ioctl_alt                                          70       -     -70
bb_ioctl_on_off                                       78       -     -78
.rodata                                           129370  129018    -352
do_show                                              799       -    -799
------------------------------------------------------------------------------
(add/remove: 6/5 grow/shrink: 13/49 up/down: 1316/-1864)     Total: -548 bytes
   text	   data	    bss	    dec	    hex	filename
 675352	   2740	  13968	 692060	  a8f5c	busybox_old
 674804	   2740	  13968	 691512	  a8d38	busybox_unstripped
2007-07-14 22:07:14 +00:00
Denis Vlasenko
6d9ea24611 networking/interface.c: huke remaining big statics; use malloc for INET[6]_rresolve
return value. Went thru callers and adjusted them - code got smaller too.

function                                             old     new   delta
ip_port_str                                            -     126    +126
INET6_rresolve                                       165     182     +17
static.cache                                          20      24      +4
route_main                                          2092    2091      -1
INET_sprint                                           61      59      -2
INET_nn                                                4       -      -4
INET6_sprint                                          59      53      -6
udp_do_one                                           518     508     -10
tcp_do_one                                           433     423     -10
raw_do_one                                           494     484     -10
traceroute_main                                     4117    4105     -12
INET_rresolve                                        334     321     -13
bb_displayroutes                                     494     456     -38
snprint_ip_port                                      244       -    -244
static.buff                                          264      16    -248
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/10 up/down: 147/-598)        Total: -451 bytes

size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 751073    3048   14688  768809   bbb29 busybox_old
 750873    3048   14440  768361   bb969 busybox_unstripped
2007-06-19 11:12:46 +00:00
Denis Vlasenko
1b16bdaebf networking/interface.c: reduce bss usage
function                                             old     new   delta
.rodata                                           158918  158950     +32
display_interfaces                                   133     153     +20
UNSPEC_print                                          56      68     +12
pr_ether                                              59      65      +6
static.proc_read                                       4       1      -3
interface_opt_a                                        4       1      -3
in_ether                                             139     136      -3
ifconfig_main                                       1296    1293      -3
if_readlist_proc                                     686     680      -6
ife_print                                           1350    1338     -12
do_if_print                                           46       -     -46
static.buff                                          369     264    -105
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/7 up/down: 70/-181)          Total: -111 bytes

# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 751073    3080   14800  768953   bbbb9 busybox_old
 751073    3048   14688  768809   bbb29 busybox_unstripped
2007-06-19 11:10:02 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +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
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
ad67a3925c remove unused #include,, improve code readability 2007-02-09 18:26:52 +00:00
Denis Vlasenko
731d357295 trivial warning fix 2007-02-02 01:16:33 +00:00