aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/utils.c
AgeCommit message (Collapse)Author
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-05whitespace and comment format fixes, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-07libiproute: FACT_FUNCizationDenys Vlasenko
function old new delta get_addr_1 258 287 +29 next_arg - 22 +22 print_neigh 885 902 +17 do_iplink 1269 1276 +7 get_unsigned 54 55 +1 get_u32 54 55 +1 get_u16 62 63 +1 rt_addr_n2a 53 52 -1 ipaddr_modify 1229 1226 -3 get_addr32 58 54 -4 invarg_1_to_2 18 12 -6 inet_addr_match 109 103 -6 duparg2 18 12 -6 duparg 18 12 -6 print_addrinfo 1231 1223 -8 ipneigh_list_or_flush 724 714 -10 incomplete_command 10 - -10 iproute_get 847 835 -12 ipaddr_list_or_flush 1265 1253 -12 get_prefix 356 344 -12 do_add_or_delete 1162 1150 -12 get_addr 73 58 -15 iproute_list_or_flush 1210 1191 -19 parse_args 1434 1412 -22 print_rule 634 610 -24 iprule_modify 864 816 -48 print_route 1621 1565 -56 iproute_modify 1221 1164 -57 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 6/20 up/down: 78/-349) Total: -271 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-14libiproute: make rt_addr_n2a() and format_host() return auto stringsDenys Vlasenko
function old new delta rt_addr_n2a 56 53 -3 print_addrinfo 1227 1178 -49 print_neigh 933 881 -52 print_rule 689 617 -72 print_tunnel 640 560 -80 print_route 1727 1588 -139 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-395) Total: -395 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-14libiproute: rename invarg(a,b) to invarg_1_to_2(a,b)Denys Vlasenko
invarg(a,b) - "invalid argument", but how a and b enter the message? invarg_1_to_2(a,b) is somewhat easier to read: "invalid argument 'a' to 'b'" Audit of usage revealed a number of bad uses, with too long messages. text data bss dec hex filename 938848 932 17448 957228 e9b2c busybox_old 938788 932 17448 957168 e9af0 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-14networking: add 'ip neigh' commandCurt Brune
This patch ports the 'ip neigh' command, originally written by Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>, to busybox. The base of the port is the version of iproute that shipped with Debian Squeeze, taken from: http://http.debian.net/debian/pool/main/i/iproute/iproute_20100519.orig.tar.gz This patch has actively been used by the Open Network Install Environment (ONIE) project for over 3 years without incident. function old new delta print_neigh - 933 +933 ipneigh_list_or_flush - 742 +742 get_hz - 109 +109 do_ipneigh - 62 +62 do_iproute 2112 2153 +41 packed_usage 30647 30667 +20 ipneigh_main - 14 +14 static.ip_neigh_commands - 12 +12 static.nuds - 9 +9 static.ip_func_ptrs 32 36 +4 print_route 1858 1727 -131 ------------------------------------------------------------------------------ (add/remove: 8/0 grow/shrink: 3/1 up/down: 1946/-131) Total: 1815 bytes Signed-off-by: Curt Brune <curt@cumulusnetworks.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-23iproute: fix parsing and matching of of "short" IP addrs like 10/8Denys Vlasenko
function old new delta print_route 1613 1813 +200 get_addr_1 209 258 +49 get_prefix 393 356 -37 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 249/-37) Total: 212 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-30networking/*: remove superfluous commentsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-29whitespace cleanupDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-01better shared strings trickDenys Vlasenko
text data bss dec hex filename 861980 441 7540 869961 d4649 busybox_old 861914 441 7540 869895 d4607 busybox_unstripped Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
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>
2009-10-04remove useless (unsigned >= 0) comparisonDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23*: optimize code size in strtoul callsDenys Vlasenko
function old new delta bb_parse_mode 433 431 -2 rtnl_rtntype_a2n 202 198 -4 ParseField 511 498 -13 bb_init_module_24 4730 4675 -55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74) Total: -74 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-03-05networking/libiproute/*: code shrink by optimizing numeric conversionsDenis Vlasenko
and other misc stuff function old new delta print_tunnel 660 656 -4 format_host 5 - -5 get_unsigned 70 54 -16 get_u32 70 54 -16 do_iplink 1173 1151 -22 get_prefix 417 393 -24 print_rule 800 771 -29 print_addrinfo 1374 1342 -32 print_route 1745 1709 -36 iprule_modify 905 866 -39 iproute_modify 1105 1048 -57 get_integer 70 - -70 parse_args 1684 1440 -244 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/11 up/down: 0/-594) Total: -594 bytes text data bss dec hex filename 817378 476 7892 825746 c9992 busybox_old 816784 476 7892 825152 c9740 busybox_unstripped
2009-03-03ip: in "ip rule add from all table 1", "all" is taken as 0.0.0.0/32,Denis Vlasenko
whereas "any" and "default" would be 0.0.0.0/0. They must be all 0.0.0.0/0. Closes bug 57.
2008-10-21- fix ip route rejecting dotted quads as prefixBernhard Reutner-Fischer
- adjust error message for wrong prefix not to mention address Previously e.g. ip route add 127.0.0.0/255.0.0.0 dev dummy0 was rejected, saying ip: an inet address is expected rather than "127.0.0.0/255.0.0.0" function old new delta get_prefix_1 201 309 +108 get_prefix 55 73 +18 get_addr 55 73 +18 get_addr32 48 58 +10 get_addr_1 249 204 -45 .rodata 114569 114524 -45 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/2 up/down: 154/-90) Total: 64 bytes
2008-07-05*: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko
2007-06-21- remove matches() from networking/. Untested.Bernhard Reutner-Fischer
text data bss dec hex filename 1705 0 0 1705 6a9 networking/libiproute/utils.o.orig 1676 0 0 1676 68c networking/libiproute/utils.o 766 0 0 766 2fe networking/libiproute/rtm_map.o.orig 670 0 0 670 29e networking/libiproute/rtm_map.o 4942 0 0 4942 134e networking/libiproute/iptunnel.o.orig 4687 0 0 4687 124f networking/libiproute/iptunnel.o
2007-06-04snprintf(... "%s"...) => safe_strncpyDenis Vlasenko
2007-05-31delete tons of extra #includesDenis Vlasenko
2007-04-12- shrink iproute a bit (-200 bytes). UntestedBernhard Reutner-Fischer
2007-04-07libiproute: audit callgraph, shortcut error paths into die() functions.Denis Vlasenko
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-01-29preparatory patch for -Wwrite-strings #4Denis Vlasenko
2007-01-29preparatory patch for -Wwrite-strings #2Denis Vlasenko
2006-12-31remove commented out #includes etcDenis Vlasenko
move get_hz to the only caller
2006-12-31stop using __u32 etc. uint32_t is there for a reasonDenis Vlasenko
2006-12-07- Improve wording in error message.Bernhard Reutner-Fischer
2006-11-21bb_INET_default[] is really just a const "default",Denis Vlasenko
nothing INET-specific
2006-11-05rename: compare_string_array -> index_in_str_arrayDenis Vlasenko
introduce index_in_substr_array and use it in iproute2
2006-10-20message string changes, mostly for consistency, also -32 bytes in .rodataDenis Vlasenko
2006-07-02Standardize on the vi editing directives being on the first line."Robert P. J. Day"
2006-06-14- correct typoBernhard Reutner-Fischer
2006-06-07- reuse strings and messages. Saves about 600BBernhard Reutner-Fischer
2006-06-02Header cleanup: don't #include headers that libbb.h already includes.Rob Landley
2006-01-30sort out yet more type issuesEric Andersen
2006-01-30- add some ATTRIBUTE_UNUSED.Bernhard Reutner-Fischer
- use shorter boilerplate while at it.
2005-09-22network "default" --> bb_INET_default. Reduce 2 exported from find applet"Vladimir N. Oleynik"
2005-04-16In Bug 208, bernhardf writes:Mike Frysinger
On machines with only ANSI compliant compilers, not explitily delcaring an empty parameter list 'void' causes failure.
2003-03-19Major coreutils update.Manuel Novoa III
2003-02-12Don't use HZ -- use sysconf(_SC_CLK_TCK)Eric Andersen
2002-12-16Only included headers that are used.Glenn L McGrath
2002-11-28Clean up error messagesGlenn L McGrath
2002-11-18Use error_msg_and_die, styleGlenn L McGrath
2002-11-10IP applet by Bastian Blank <waldi@debian.org>Glenn L McGrath