diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-05 09:21:57 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-05 09:21:57 +0000 |
commit | 76140a77c9c47c41f244d90d4250d77b9504f7d4 (patch) | |
tree | 67c43b25beb904f111e8a96548bee1592f5010e2 /networking/libiproute/iproute.c | |
parent | 021de3f0297af87bfc098bd364dffb332d6ace20 (diff) | |
download | busybox-w32-76140a77c9c47c41f244d90d4250d77b9504f7d4.tar.gz busybox-w32-76140a77c9c47c41f244d90d4250d77b9504f7d4.tar.bz2 busybox-w32-76140a77c9c47c41f244d90d4250d77b9504f7d4.zip |
networking/libiproute/*: code shrink by optimizing numeric conversions
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
Diffstat (limited to 'networking/libiproute/iproute.c')
-rw-r--r-- | networking/libiproute/iproute.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index a7ec66c7f..66557d8fd 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -202,7 +202,6 @@ static int print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
202 | if (tb[RTA_DST]) { | 202 | if (tb[RTA_DST]) { |
203 | if (r->rtm_dst_len != host_len) { | 203 | if (r->rtm_dst_len != host_len) { |
204 | printf("%s/%u ", rt_addr_n2a(r->rtm_family, | 204 | printf("%s/%u ", rt_addr_n2a(r->rtm_family, |
205 | RTA_PAYLOAD(tb[RTA_DST]), | ||
206 | RTA_DATA(tb[RTA_DST]), | 205 | RTA_DATA(tb[RTA_DST]), |
207 | abuf, sizeof(abuf)), | 206 | abuf, sizeof(abuf)), |
208 | r->rtm_dst_len | 207 | r->rtm_dst_len |
@@ -222,7 +221,6 @@ static int print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
222 | if (tb[RTA_SRC]) { | 221 | if (tb[RTA_SRC]) { |
223 | if (r->rtm_src_len != host_len) { | 222 | if (r->rtm_src_len != host_len) { |
224 | printf("from %s/%u ", rt_addr_n2a(r->rtm_family, | 223 | printf("from %s/%u ", rt_addr_n2a(r->rtm_family, |
225 | RTA_PAYLOAD(tb[RTA_SRC]), | ||
226 | RTA_DATA(tb[RTA_SRC]), | 224 | RTA_DATA(tb[RTA_SRC]), |
227 | abuf, sizeof(abuf)), | 225 | abuf, sizeof(abuf)), |
228 | r->rtm_src_len | 226 | r->rtm_src_len |
@@ -252,7 +250,6 @@ static int print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
252 | and symbolic name will not be useful. | 250 | and symbolic name will not be useful. |
253 | */ | 251 | */ |
254 | printf(" src %s ", rt_addr_n2a(r->rtm_family, | 252 | printf(" src %s ", rt_addr_n2a(r->rtm_family, |
255 | RTA_PAYLOAD(tb[RTA_PREFSRC]), | ||
256 | RTA_DATA(tb[RTA_PREFSRC]), | 253 | RTA_DATA(tb[RTA_PREFSRC]), |
257 | abuf, sizeof(abuf))); | 254 | abuf, sizeof(abuf))); |
258 | } | 255 | } |
@@ -367,8 +364,7 @@ USE_FEATURE_IP_RULE(ARG_table,) | |||
367 | mxlock |= (1 << RTAX_MTU); | 364 | mxlock |= (1 << RTAX_MTU); |
368 | NEXT_ARG(); | 365 | NEXT_ARG(); |
369 | } | 366 | } |
370 | if (get_unsigned(&mtu, *argv, 0)) | 367 | mtu = get_unsigned(*argv, "mtu"); |
371 | invarg(*argv, "mtu"); | ||
372 | rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); | 368 | rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); |
373 | } else if (arg == ARG_protocol) { | 369 | } else if (arg == ARG_protocol) { |
374 | uint32_t prot; | 370 | uint32_t prot; |
@@ -391,8 +387,7 @@ USE_FEATURE_IP_RULE(ARG_table,) | |||
391 | } else if (arg == ARG_metric) { | 387 | } else if (arg == ARG_metric) { |
392 | uint32_t metric; | 388 | uint32_t metric; |
393 | NEXT_ARG(); | 389 | NEXT_ARG(); |
394 | if (get_u32(&metric, *argv, 0)) | 390 | metric = get_u32(*argv, "metric"); |
395 | invarg(*argv, "metric"); | ||
396 | addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric); | 391 | addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric); |
397 | } else { | 392 | } else { |
398 | int type; | 393 | int type; |