aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/iproute.c
AgeCommit message (Collapse)Author
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>
2015-10-08libiproute: use itoa() where appropriateDenys Vlasenko
function old new delta rtnl_rtprot_a2n 31 88 +57 print_tunnel 647 640 -7 print_route 1865 1858 -7 print_linkinfo 820 812 -8 print_addrinfo 1241 1227 -14 rtnl_rttable_n2a 53 38 -15 rtnl_rtscope_n2a 53 38 -15 rtnl_rtrealm_n2a 53 38 -15 rtnl_dsfield_n2a 61 38 -23 rtnl_rtntype_n2a 118 89 -29 print_rule 724 689 -35 ipaddr_list_or_flush 1293 1253 -40 rtnl_rtprot_n2a 53 - -53 rtnl_rtprot_initialize 63 - -63 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 1/11 up/down: 57/-324) Total: -267 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-17iproute: support onelink route option and print route flagsMichael Tokarev
function old new delta print_route 1797 1865 +68 do_iproute 2097 2112 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 83/0) Total: 83 bytes Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22libbb: use a wrapper around sysconf(_SC_CLK_TCK) to save a few bytesBartosz Golaszewski
function old new delta bb_sc_clk_tck - 10 +10 timescmd 118 113 -5 print_route 1763 1758 -5 mpstat_main 1288 1283 -5 iostat_main 1947 1942 -5 INET_setroute 879 871 -8 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/5 up/down: 10/-28) Total: -18 bytes Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.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>
2011-02-10fix trivial build failureDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-09iproute: fix handling of "dev IFACE" selectorDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-04ip: Fix command line option parsing of "ip route get ..."Christian Hornung
I found and fixed a bug in the command line options parsing of "ip route get": It was impossible to get any option other than the IP address recognized correctly, and e.g. the command "ip route get connected" just hung up infinitely in the options parsing loop instead of printing an error message. Signed-off-by: Christian Hornung <chhornung@googlemail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-29whitespace cleanupDenys Vlasenko
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>
2010-07-24libiproute: code shrink by adding FAST_FUNCDenys Vlasenko
function old new delta ipaddr_list_or_flush 1282 1293 +11 ip_parse_common_args 153 151 -2 ip_main 53 50 -3 ip_do 19 15 -4 do_iptunnel 985 980 -5 do_iprule 982 977 -5 do_iplink 1637 1631 -6 do_iproute 2105 2098 -7 do_ipaddr 1406 1398 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/8 up/down: 11/-40) Total: -29 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23*: merge some common stringsDenys Vlasenko
text data bss dec hexfilename 838650 8009 0 846659 ceb43busybox_old 838519 8009 0 846528 ceac0busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-05*: fix 1/4 remaining aliasing warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-28*: style fixes. no code changes (verified with objdump)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-26libiproute: eliminate unused fields in struct filter_t's; style fixesDenys Vlasenko
function old new delta print_route 1603 1588 -15 iproute_list_or_flush 1254 1230 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-39) Total: -39 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13*: use "can't" instead of "cannot"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-13libiproute/*: code shrinkDenys Vlasenko
function old new delta ll_addr_a2n 181 178 -3 rtnl_rtntype_a2n 198 194 -4 ipaddr_modify 1309 1305 -4 print_addrinfo 1303 1298 -5 do_iplink 1137 1132 -5 print_route 1609 1603 -6 parse_args 1440 1434 -6 iproute_list_or_flush 1261 1254 -7 rtnl_rttable_a2n 39 31 -8 rtnl_rtscope_a2n 39 31 -8 rtnl_rtrealm_a2n 39 31 -8 rtnl_rtprot_a2n 39 31 -8 rtnl_dsfield_a2n 39 31 -8 ll_type_n2a 78 70 -8 get_rt_realms 115 107 -8 print_tunnel 656 647 -9 rtnl_rttable_n2a 63 53 -10 rtnl_rtscope_n2a 63 53 -10 rtnl_rtrealm_n2a 63 53 -10 rtnl_rtntype_n2a 128 118 -10 rtnl_dsfield_n2a 71 61 -10 print_linkinfo 815 805 -10 ipaddr_list_or_flush 1246 1235 -11 iproute_modify 1048 1036 -12 iprule_modify 866 851 -15 print_rule 765 738 -27 ll_addr_n2a 182 150 -32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/27 up/down: 0/-262) Total: -262 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05*: add FAST_FUNC to function ptrs where it makes senseDenys Vlasenko
function old new delta evalcommand 1195 1209 +14 testcmd - 10 +10 printfcmd - 10 +10 echocmd - 10 +10 func_exec 270 276 +6 echo_dg 104 109 +5 store_nlmsg 85 89 +4 pseudo_exec_argv 195 198 +3 dotcmd 287 290 +3 machtime_stream 29 31 +2 discard_stream 24 26 +2 argstr 1299 1301 +2 killcmd 108 109 +1 evalfor 226 227 +1 daytime_stream 43 44 +1 run_list 2544 2543 -1 lookupvar 62 61 -1 ipaddr_modify 1310 1309 -1 ... parse_stream 2254 2245 -9 evalpipe 356 347 -9 collect_if 210 197 -13 read_opt 869 851 -18 handle_dollar 681 658 -23 print_addrinfo 1342 1303 -39 iterate_on_dir 156 59 -97 print_route 1709 1609 -100 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767) Total: -693 bytes text data bss dec hex filename 841748 467 7872 850087 cf8a7 busybox_old 841061 467 7872 849400 cf5f8 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-04-21*: mass renaming of USE_XXXX to IF_XXXXDenis Vlasenko
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
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
2008-10-07- route metric support (Natanael Copa)Bernhard Reutner-Fischer
Adds about 75b
2008-07-21libbb: [x]fopen_for_{read,write} introduced and used.Denis Vlasenko
(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-05*: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko
2008-06-29libiproute: print_route() always uses stdout, do not pass FILE pointer to it.Denis Vlasenko
libiproute: Use FAST_FUNC function old new delta iprule_modify 884 905 +21 ipaddr_modify 1289 1310 +21 rtnl_send 53 69 +16 xrtnl_wilddump_request 109 124 +15 xrtnl_dump_filter 394 403 +9 rtnl_talk 534 539 +5 print_addrinfo 1369 1374 +5 iproute_modify 1017 1020 +3 iprule_list 81 83 +2 xrtnl_open 163 161 -2 parse_rtattr 89 87 -2 ipaddr_list_or_flush 2176 2174 -2 addattr_l 91 88 -3 flush_update 116 108 -8 iproute_list_or_flush 1285 1263 -22 iproute_get 878 852 -26 print_route 1913 1752 -161 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 9/8 up/down: 97/-226) Total: -129 bytes
2008-06-25whitespace fixes. no code changesDenis Vlasenko
2008-06-12- make the first arg of the filter function passed to rtnl_dump_filter constantBernhard Reutner-Fischer
to match normal iproute. No obj-code changes.
2008-06-08ip: make numeric table work: "ip route list table 255". closes bug 3664.Denis Vlasenko
function old new delta iproute_list_or_flush 1270 1300 +30
2008-05-31libiproute: style fixes, and using smallint as appropriateDenis Vlasenko
function old new delta print_route 1730 1731 +1 print_addrinfo 1497 1498 +1 iproute_list_or_flush 1232 1229 -3 ipaddr_list_or_flush 2490 2484 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 2/-9) Total: -7 bytes
2008-03-20*: use fopen_or_warn in few more placesDenis Vlasenko
2008-01-04ip route: "ip route" was misbehaving (extra argv+1 ate 1st env var)Denis Vlasenko
2007-11-27ip route: add comment, no code changesDenis Vlasenko
2007-11-26iproute: fix a bug where "ip r flush table main" was rejected,Denis Vlasenko
add "ip r flush cache" (however I'm unsure it is really valid syntax) Add a few comments and stop mixing params and params' keywords.
2007-11-18ip: stop propagating argc; optimize ip_parse_common_argsDenis Vlasenko
function old new delta find_pair 167 187 +20 static.families - 17 +17 die_must_be_on_off - 11 +11 ... on_off 33 22 -11 do_ipaddr 103 90 -13 do_iptunnel 1001 986 -15 iproute_list_or_flush 1237 1217 -20 static.ip_common_commands 43 22 -21 do_iproute 2217 2193 -24 parse_args 1444 1414 -30 ip_do 47 16 -31 do_iprule 994 963 -31 ip_main 153 113 -40 ipaddr_modify 1357 1305 -52 ipaddr_list_or_flush 2543 2490 -53 ip_parse_common_args 294 159 -135 ------------------------------------------------------------------------------ (add/remove: 4/1 grow/shrink: 4/24 up/down: 85/-563) Total: -478 bytes text data bss dec hex filename 775561 966 9236 785763 bfd63 busybox_old 775073 962 9236 785271 bfb77 busybox_unstripped
2007-09-30libiproute: add missing break'sDenis Vlasenko
2007-08-12trylink: produce even more info about final link stageDenis Vlasenko
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-07-24Replace index_in_[sub]str_array with index_in_[sub]strings,Denis Vlasenko
which scans thru "abc\0def\0123\0\0" type strings. Saves 250 bytes. text data bss dec hex filename 781266 1328 11844 794438 c1f46 busybox_old 781010 1328 11844 794182 c1e46 busybox_unstripped
2007-05-31delete tons of extra #includesDenis Vlasenko
2007-04-16- fix compilation when ENABLE_FEATURE_IP_RULE was offBernhard Reutner-Fischer
2007-04-12- shrink iproute a bit (-200 bytes). UntestedBernhard Reutner-Fischer
2007-04-12- add xsendto and use where appropriate; shrink iplink; sanitize libiproute ↵Bernhard Reutner-Fischer
a bit. -916 byte
2007-04-11bb_full_fd_action: remove potential xmalloc from NOFORK pathDenis Vlasenko
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- set the scope properly. Thanks to Jean Wolter, who wrote:Bernhard Reutner-Fischer
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-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 #5Denis Vlasenko
2007-01-27fix numbering in switch(): we don't have "del" anymore,Denis Vlasenko
substring match on "delete" handles it ok. But we (I?) forgot to renumber case labels...
2007-01-11Trailing whitespace removal over entire treeDenis Vlasenko
2006-12-31iproute: remove double get_hz optimizationDenis Vlasenko
2006-12-31remove commented out #includes etcDenis Vlasenko
move get_hz to the only caller