diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-29 06:22:40 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-29 06:22:40 +0000 |
| commit | 0db2c2eb7123385b9fe035b9ce6ee398b592abf8 (patch) | |
| tree | ff368a84c4b02572d543c151958e7a35749bc716 | |
| parent | 270d5d75f128d3d8e3e515b457b1b1a4f40bb556 (diff) | |
| download | busybox-w32-0db2c2eb7123385b9fe035b9ce6ee398b592abf8.tar.gz busybox-w32-0db2c2eb7123385b9fe035b9ce6ee398b592abf8.tar.bz2 busybox-w32-0db2c2eb7123385b9fe035b9ce6ee398b592abf8.zip | |
libiproute: print_route() always uses stdout, do not pass FILE pointer to it.
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
| -rw-r--r-- | networking/libiproute/iproute.c | 139 | ||||
| -rw-r--r-- | networking/libiproute/libnetlink.c | 24 | ||||
| -rw-r--r-- | networking/libiproute/libnetlink.h | 24 |
3 files changed, 95 insertions, 92 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index 354442c4e..07a88c4dd 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
| @@ -79,9 +79,8 @@ static unsigned get_hz(void) | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static int print_route(const struct sockaddr_nl *who ATTRIBUTE_UNUSED, | 81 | static int print_route(const struct sockaddr_nl *who ATTRIBUTE_UNUSED, |
| 82 | struct nlmsghdr *n, void *arg) | 82 | struct nlmsghdr *n, void *arg ATTRIBUTE_UNUSED) |
| 83 | { | 83 | { |
| 84 | FILE *fp = (FILE*)arg; | ||
| 85 | struct rtmsg *r = NLMSG_DATA(n); | 84 | struct rtmsg *r = NLMSG_DATA(n); |
| 86 | int len = n->nlmsg_len; | 85 | int len = n->nlmsg_len; |
| 87 | struct rtattr * tb[RTA_MAX+1]; | 86 | struct rtattr * tb[RTA_MAX+1]; |
| @@ -194,73 +193,71 @@ static int print_route(const struct sockaddr_nl *who ATTRIBUTE_UNUSED, | |||
| 194 | } | 193 | } |
| 195 | 194 | ||
| 196 | if (n->nlmsg_type == RTM_DELROUTE) { | 195 | if (n->nlmsg_type == RTM_DELROUTE) { |
| 197 | fprintf(fp, "Deleted "); | 196 | printf("Deleted "); |
| 198 | } | 197 | } |
| 199 | if (r->rtm_type != RTN_UNICAST && !filter.type) { | 198 | if (r->rtm_type != RTN_UNICAST && !filter.type) { |
| 200 | fprintf(fp, "%s ", rtnl_rtntype_n2a(r->rtm_type, b1, sizeof(b1))); | 199 | printf("%s ", rtnl_rtntype_n2a(r->rtm_type, b1, sizeof(b1))); |
| 201 | } | 200 | } |
| 202 | 201 | ||
| 203 | if (tb[RTA_DST]) { | 202 | if (tb[RTA_DST]) { |
| 204 | if (r->rtm_dst_len != host_len) { | 203 | if (r->rtm_dst_len != host_len) { |
| 205 | fprintf(fp, "%s/%u ", rt_addr_n2a(r->rtm_family, | 204 | printf("%s/%u ", rt_addr_n2a(r->rtm_family, |
| 206 | RTA_PAYLOAD(tb[RTA_DST]), | 205 | RTA_PAYLOAD(tb[RTA_DST]), |
| 207 | RTA_DATA(tb[RTA_DST]), | 206 | RTA_DATA(tb[RTA_DST]), |
| 208 | abuf, sizeof(abuf)), | 207 | abuf, sizeof(abuf)), |
| 209 | r->rtm_dst_len | 208 | r->rtm_dst_len |
| 210 | ); | 209 | ); |
| 211 | } else { | 210 | } else { |
| 212 | fprintf(fp, "%s ", format_host(r->rtm_family, | 211 | printf("%s ", format_host(r->rtm_family, |
| 213 | RTA_PAYLOAD(tb[RTA_DST]), | 212 | RTA_PAYLOAD(tb[RTA_DST]), |
| 214 | RTA_DATA(tb[RTA_DST]), | 213 | RTA_DATA(tb[RTA_DST]), |
| 215 | abuf, sizeof(abuf)) | 214 | abuf, sizeof(abuf)) |
| 216 | ); | 215 | ); |
| 217 | } | 216 | } |
| 218 | } else if (r->rtm_dst_len) { | 217 | } else if (r->rtm_dst_len) { |
| 219 | fprintf(fp, "0/%d ", r->rtm_dst_len); | 218 | printf("0/%d ", r->rtm_dst_len); |
| 220 | } else { | 219 | } else { |
| 221 | fprintf(fp, "default "); | 220 | printf("default "); |
| 222 | } | 221 | } |
| 223 | if (tb[RTA_SRC]) { | 222 | if (tb[RTA_SRC]) { |
| 224 | if (r->rtm_src_len != host_len) { | 223 | if (r->rtm_src_len != host_len) { |
| 225 | fprintf(fp, "from %s/%u ", rt_addr_n2a(r->rtm_family, | 224 | printf("from %s/%u ", rt_addr_n2a(r->rtm_family, |
| 226 | RTA_PAYLOAD(tb[RTA_SRC]), | 225 | RTA_PAYLOAD(tb[RTA_SRC]), |
| 227 | RTA_DATA(tb[RTA_SRC]), | 226 | RTA_DATA(tb[RTA_SRC]), |
| 228 | abuf, sizeof(abuf)), | 227 | abuf, sizeof(abuf)), |
| 229 | r->rtm_src_len | 228 | r->rtm_src_len |
| 230 | ); | 229 | ); |
| 231 | } else { | 230 | } else { |
| 232 | fprintf(fp, "from %s ", format_host(r->rtm_family, | 231 | printf("from %s ", format_host(r->rtm_family, |
| 233 | RTA_PAYLOAD(tb[RTA_SRC]), | 232 | RTA_PAYLOAD(tb[RTA_SRC]), |
| 234 | RTA_DATA(tb[RTA_SRC]), | 233 | RTA_DATA(tb[RTA_SRC]), |
| 235 | abuf, sizeof(abuf)) | 234 | abuf, sizeof(abuf)) |
| 236 | ); | 235 | ); |
| 237 | } | 236 | } |
| 238 | } else if (r->rtm_src_len) { | 237 | } else if (r->rtm_src_len) { |
| 239 | fprintf(fp, "from 0/%u ", r->rtm_src_len); | 238 | printf("from 0/%u ", r->rtm_src_len); |
| 240 | } | 239 | } |
| 241 | if (tb[RTA_GATEWAY] && filter.rvia.bitlen != host_len) { | 240 | if (tb[RTA_GATEWAY] && filter.rvia.bitlen != host_len) { |
| 242 | fprintf(fp, "via %s ", | 241 | printf("via %s ", format_host(r->rtm_family, |
| 243 | format_host(r->rtm_family, | 242 | RTA_PAYLOAD(tb[RTA_GATEWAY]), |
| 244 | RTA_PAYLOAD(tb[RTA_GATEWAY]), | 243 | RTA_DATA(tb[RTA_GATEWAY]), |
| 245 | RTA_DATA(tb[RTA_GATEWAY]), | 244 | abuf, sizeof(abuf))); |
| 246 | abuf, sizeof(abuf))); | ||
| 247 | } | 245 | } |
| 248 | if (tb[RTA_OIF] && filter.oifmask != -1) { | 246 | if (tb[RTA_OIF] && filter.oifmask != -1) { |
| 249 | fprintf(fp, "dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); | 247 | printf("dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); |
| 250 | } | 248 | } |
| 251 | 249 | ||
| 252 | if (tb[RTA_PREFSRC] && filter.rprefsrc.bitlen != host_len) { | 250 | if (tb[RTA_PREFSRC] && filter.rprefsrc.bitlen != host_len) { |
| 253 | /* Do not use format_host(). It is our local addr | 251 | /* Do not use format_host(). It is our local addr |
| 254 | and symbolic name will not be useful. | 252 | and symbolic name will not be useful. |
| 255 | */ | 253 | */ |
| 256 | fprintf(fp, " src %s ", | 254 | printf(" src %s ", rt_addr_n2a(r->rtm_family, |
| 257 | rt_addr_n2a(r->rtm_family, | 255 | RTA_PAYLOAD(tb[RTA_PREFSRC]), |
| 258 | RTA_PAYLOAD(tb[RTA_PREFSRC]), | 256 | RTA_DATA(tb[RTA_PREFSRC]), |
| 259 | RTA_DATA(tb[RTA_PREFSRC]), | 257 | abuf, sizeof(abuf))); |
| 260 | abuf, sizeof(abuf))); | ||
| 261 | } | 258 | } |
| 262 | if (tb[RTA_PRIORITY]) { | 259 | if (tb[RTA_PRIORITY]) { |
| 263 | fprintf(fp, " metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY])); | 260 | printf(" metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY])); |
| 264 | } | 261 | } |
| 265 | if (r->rtm_family == AF_INET6) { | 262 | if (r->rtm_family == AF_INET6) { |
| 266 | struct rta_cacheinfo *ci = NULL; | 263 | struct rta_cacheinfo *ci = NULL; |
| @@ -269,24 +266,23 @@ static int print_route(const struct sockaddr_nl *who ATTRIBUTE_UNUSED, | |||
| 269 | } | 266 | } |
| 270 | if ((r->rtm_flags & RTM_F_CLONED) || (ci && ci->rta_expires)) { | 267 | if ((r->rtm_flags & RTM_F_CLONED) || (ci && ci->rta_expires)) { |
| 271 | if (r->rtm_flags & RTM_F_CLONED) { | 268 | if (r->rtm_flags & RTM_F_CLONED) { |
| 272 | fprintf(fp, "%c cache ", _SL_); | 269 | printf("%c cache ", _SL_); |
| 273 | } | 270 | } |
| 274 | if (ci->rta_expires) { | 271 | if (ci->rta_expires) { |
| 275 | fprintf(fp, " expires %dsec", ci->rta_expires / get_hz()); | 272 | printf(" expires %dsec", ci->rta_expires / get_hz()); |
| 276 | } | 273 | } |
| 277 | if (ci->rta_error != 0) { | 274 | if (ci->rta_error != 0) { |
| 278 | fprintf(fp, " error %d", ci->rta_error); | 275 | printf(" error %d", ci->rta_error); |
| 279 | } | 276 | } |
| 280 | } else if (ci) { | 277 | } else if (ci) { |
| 281 | if (ci->rta_error != 0) | 278 | if (ci->rta_error != 0) |
| 282 | fprintf(fp, " error %d", ci->rta_error); | 279 | printf(" error %d", ci->rta_error); |
| 283 | } | 280 | } |
| 284 | } | 281 | } |
| 285 | if (tb[RTA_IIF] && filter.iifmask != -1) { | 282 | if (tb[RTA_IIF] && filter.iifmask != -1) { |
| 286 | fprintf(fp, " iif %s", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_IIF]))); | 283 | printf(" iif %s", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_IIF]))); |
| 287 | } | 284 | } |
| 288 | fputc('\n', fp); | 285 | bb_putchar('\n'); |
| 289 | fflush(fp); | ||
| 290 | return 0; | 286 | return 0; |
| 291 | } | 287 | } |
| 292 | 288 | ||
| @@ -328,11 +324,13 @@ USE_FEATURE_IP_RULE(ARG_table,) | |||
| 328 | memset(&req, 0, sizeof(req)); | 324 | memset(&req, 0, sizeof(req)); |
| 329 | 325 | ||
| 330 | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); | 326 | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); |
| 331 | req.n.nlmsg_flags = NLM_F_REQUEST|flags; | 327 | req.n.nlmsg_flags = NLM_F_REQUEST | flags; |
| 332 | req.n.nlmsg_type = cmd; | 328 | req.n.nlmsg_type = cmd; |
| 333 | req.r.rtm_family = preferred_family; | 329 | req.r.rtm_family = preferred_family; |
| 334 | req.r.rtm_table = RT_TABLE_MAIN; | 330 | if (RT_TABLE_MAIN) /* if it is zero, memset already did it */ |
| 335 | req.r.rtm_scope = RT_SCOPE_NOWHERE; | 331 | req.r.rtm_table = RT_TABLE_MAIN; |
| 332 | if (RT_SCOPE_NOWHERE) | ||
| 333 | req.r.rtm_scope = RT_SCOPE_NOWHERE; | ||
| 336 | 334 | ||
| 337 | if (cmd != RTM_DELROUTE) { | 335 | if (cmd != RTM_DELROUTE) { |
| 338 | req.r.rtm_protocol = RTPROT_BOOT; | 336 | req.r.rtm_protocol = RTPROT_BOOT; |
| @@ -476,12 +474,15 @@ static int rtnl_rtcache_request(struct rtnl_handle *rth, int family) | |||
| 476 | nladdr.nl_family = AF_NETLINK; | 474 | nladdr.nl_family = AF_NETLINK; |
| 477 | 475 | ||
| 478 | req.nlh.nlmsg_len = sizeof(req); | 476 | req.nlh.nlmsg_len = sizeof(req); |
| 479 | req.nlh.nlmsg_type = RTM_GETROUTE; | 477 | if (RTM_GETROUTE) |
| 480 | req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_REQUEST; | 478 | req.nlh.nlmsg_type = RTM_GETROUTE; |
| 481 | req.nlh.nlmsg_pid = 0; | 479 | if (NLM_F_ROOT | NLM_F_REQUEST) |
| 480 | req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_REQUEST; | ||
| 481 | /*req.nlh.nlmsg_pid = 0; - memset did it already */ | ||
| 482 | req.nlh.nlmsg_seq = rth->dump = ++rth->seq; | 482 | req.nlh.nlmsg_seq = rth->dump = ++rth->seq; |
| 483 | req.rtm.rtm_family = family; | 483 | req.rtm.rtm_family = family; |
| 484 | req.rtm.rtm_flags |= RTM_F_CLONED; | 484 | if (RTM_F_CLONED) |
| 485 | req.rtm.rtm_flags = RTM_F_CLONED; | ||
| 485 | 486 | ||
| 486 | return xsendto(rth->fd, (void*)&req, sizeof(req), (struct sockaddr*)&nladdr, sizeof(nladdr)); | 487 | return xsendto(rth->fd, (void*)&req, sizeof(req), (struct sockaddr*)&nladdr, sizeof(nladdr)); |
| 487 | } | 488 | } |
| @@ -667,7 +668,7 @@ static int iproute_list_or_flush(char **argv, int flush) | |||
| 667 | for (;;) { | 668 | for (;;) { |
| 668 | xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE); | 669 | xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE); |
| 669 | filter.flushed = 0; | 670 | filter.flushed = 0; |
| 670 | xrtnl_dump_filter(&rth, print_route, stdout); | 671 | xrtnl_dump_filter(&rth, print_route, NULL); |
| 671 | if (filter.flushed == 0) | 672 | if (filter.flushed == 0) |
| 672 | return 0; | 673 | return 0; |
| 673 | if (flush_update()) | 674 | if (flush_update()) |
| @@ -680,7 +681,7 @@ static int iproute_list_or_flush(char **argv, int flush) | |||
| 680 | } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { | 681 | } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { |
| 681 | bb_perror_msg_and_die("cannot send dump request"); | 682 | bb_perror_msg_and_die("cannot send dump request"); |
| 682 | } | 683 | } |
| 683 | xrtnl_dump_filter(&rth, print_route, stdout); | 684 | xrtnl_dump_filter(&rth, print_route, NULL); |
| 684 | 685 | ||
| 685 | return 0; | 686 | return 0; |
| 686 | } | 687 | } |
| @@ -707,16 +708,18 @@ static int iproute_get(char **argv) | |||
| 707 | iproute_reset_filter(); | 708 | iproute_reset_filter(); |
| 708 | 709 | ||
| 709 | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); | 710 | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); |
| 710 | req.n.nlmsg_flags = NLM_F_REQUEST; | 711 | if (NLM_F_REQUEST) |
| 711 | req.n.nlmsg_type = RTM_GETROUTE; | 712 | req.n.nlmsg_flags = NLM_F_REQUEST; |
| 713 | if (RTM_GETROUTE) | ||
| 714 | req.n.nlmsg_type = RTM_GETROUTE; | ||
| 712 | req.r.rtm_family = preferred_family; | 715 | req.r.rtm_family = preferred_family; |
| 713 | req.r.rtm_table = 0; | 716 | /*req.r.rtm_table = 0; - memset did this already */ |
| 714 | req.r.rtm_protocol = 0; | 717 | /*req.r.rtm_protocol = 0;*/ |
| 715 | req.r.rtm_scope = 0; | 718 | /*req.r.rtm_scope = 0;*/ |
| 716 | req.r.rtm_type = 0; | 719 | /*req.r.rtm_type = 0;*/ |
| 717 | req.r.rtm_src_len = 0; | 720 | /*req.r.rtm_src_len = 0;*/ |
| 718 | req.r.rtm_dst_len = 0; | 721 | /*req.r.rtm_dst_len = 0;*/ |
| 719 | req.r.rtm_tos = 0; | 722 | /*req.r.rtm_tos = 0;*/ |
| 720 | 723 | ||
| 721 | while (*argv) { | 724 | while (*argv) { |
| 722 | switch (index_in_strings(options, *argv)) { | 725 | switch (index_in_strings(options, *argv)) { |
| @@ -802,7 +805,7 @@ static int iproute_get(char **argv) | |||
| 802 | int len = req.n.nlmsg_len; | 805 | int len = req.n.nlmsg_len; |
| 803 | struct rtattr * tb[RTA_MAX+1]; | 806 | struct rtattr * tb[RTA_MAX+1]; |
| 804 | 807 | ||
| 805 | print_route(NULL, &req.n, (void*)stdout); | 808 | print_route(NULL, &req.n, NULL); |
| 806 | 809 | ||
| 807 | if (req.n.nlmsg_type != RTM_NEWROUTE) { | 810 | if (req.n.nlmsg_type != RTM_NEWROUTE) { |
| 808 | bb_error_msg_and_die("not a route?"); | 811 | bb_error_msg_and_die("not a route?"); |
| @@ -837,7 +840,7 @@ static int iproute_get(char **argv) | |||
| 837 | return 2; | 840 | return 2; |
| 838 | } | 841 | } |
| 839 | } | 842 | } |
| 840 | print_route(NULL, &req.n, (void*)stdout); | 843 | print_route(NULL, &req.n, NULL); |
| 841 | return 0; | 844 | return 0; |
| 842 | } | 845 | } |
| 843 | 846 | ||
diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c index 4511d36fa..6b599d91c 100644 --- a/networking/libiproute/libnetlink.c +++ b/networking/libiproute/libnetlink.c | |||
| @@ -17,12 +17,12 @@ | |||
| 17 | #include "libbb.h" | 17 | #include "libbb.h" |
| 18 | #include "libnetlink.h" | 18 | #include "libnetlink.h" |
| 19 | 19 | ||
| 20 | void rtnl_close(struct rtnl_handle *rth) | 20 | void FAST_FUNC rtnl_close(struct rtnl_handle *rth) |
| 21 | { | 21 | { |
| 22 | close(rth->fd); | 22 | close(rth->fd); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | int xrtnl_open(struct rtnl_handle *rth/*, unsigned subscriptions*/) | 25 | int FAST_FUNC xrtnl_open(struct rtnl_handle *rth/*, unsigned subscriptions*/) |
| 26 | { | 26 | { |
| 27 | socklen_t addr_len; | 27 | socklen_t addr_len; |
| 28 | 28 | ||
| @@ -46,7 +46,7 @@ int xrtnl_open(struct rtnl_handle *rth/*, unsigned subscriptions*/) | |||
| 46 | return 0; | 46 | return 0; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | int xrtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) | 49 | int FAST_FUNC xrtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) |
| 50 | { | 50 | { |
| 51 | struct { | 51 | struct { |
| 52 | struct nlmsghdr nlh; | 52 | struct nlmsghdr nlh; |
| @@ -68,7 +68,7 @@ int xrtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) | |||
| 68 | (struct sockaddr*)&nladdr, sizeof(nladdr)); | 68 | (struct sockaddr*)&nladdr, sizeof(nladdr)); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | int rtnl_send(struct rtnl_handle *rth, char *buf, int len) | 71 | int FAST_FUNC rtnl_send(struct rtnl_handle *rth, char *buf, int len) |
| 72 | { | 72 | { |
| 73 | struct sockaddr_nl nladdr; | 73 | struct sockaddr_nl nladdr; |
| 74 | 74 | ||
| @@ -78,7 +78,7 @@ int rtnl_send(struct rtnl_handle *rth, char *buf, int len) | |||
| 78 | return xsendto(rth->fd, buf, len, (struct sockaddr*)&nladdr, sizeof(nladdr)); | 78 | return xsendto(rth->fd, buf, len, (struct sockaddr*)&nladdr, sizeof(nladdr)); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len) | 81 | int FAST_FUNC rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len) |
| 82 | { | 82 | { |
| 83 | struct nlmsghdr nlh; | 83 | struct nlmsghdr nlh; |
| 84 | struct sockaddr_nl nladdr; | 84 | struct sockaddr_nl nladdr; |
| @@ -194,7 +194,7 @@ static int rtnl_dump_filter(struct rtnl_handle *rth, | |||
| 194 | return retval; | 194 | return retval; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | int xrtnl_dump_filter(struct rtnl_handle *rth, | 197 | int FAST_FUNC xrtnl_dump_filter(struct rtnl_handle *rth, |
| 198 | int (*filter)(const struct sockaddr_nl *, struct nlmsghdr *, void *), | 198 | int (*filter)(const struct sockaddr_nl *, struct nlmsghdr *, void *), |
| 199 | void *arg1) | 199 | void *arg1) |
| 200 | { | 200 | { |
| @@ -204,7 +204,7 @@ int xrtnl_dump_filter(struct rtnl_handle *rth, | |||
| 204 | return ret; | 204 | return ret; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, | 207 | int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, |
| 208 | pid_t peer, unsigned groups, | 208 | pid_t peer, unsigned groups, |
| 209 | struct nlmsghdr *answer, | 209 | struct nlmsghdr *answer, |
| 210 | int (*junk)(struct sockaddr_nl *, struct nlmsghdr *, void *), | 210 | int (*junk)(struct sockaddr_nl *, struct nlmsghdr *, void *), |
| @@ -332,7 +332,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, | |||
| 332 | return retval; | 332 | return retval; |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) | 335 | int FAST_FUNC addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) |
| 336 | { | 336 | { |
| 337 | int len = RTA_LENGTH(4); | 337 | int len = RTA_LENGTH(4); |
| 338 | struct rtattr *rta; | 338 | struct rtattr *rta; |
| @@ -346,7 +346,7 @@ int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) | |||
| 346 | return 0; | 346 | return 0; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) | 349 | int FAST_FUNC addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) |
| 350 | { | 350 | { |
| 351 | int len = RTA_LENGTH(alen); | 351 | int len = RTA_LENGTH(alen); |
| 352 | struct rtattr *rta; | 352 | struct rtattr *rta; |
| @@ -361,7 +361,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) | |||
| 361 | return 0; | 361 | return 0; |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data) | 364 | int FAST_FUNC rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data) |
| 365 | { | 365 | { |
| 366 | int len = RTA_LENGTH(4); | 366 | int len = RTA_LENGTH(4); |
| 367 | struct rtattr *subrta; | 367 | struct rtattr *subrta; |
| @@ -377,7 +377,7 @@ int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data) | |||
| 377 | return 0; | 377 | return 0; |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen) | 380 | int FAST_FUNC rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen) |
| 381 | { | 381 | { |
| 382 | struct rtattr *subrta; | 382 | struct rtattr *subrta; |
| 383 | int len = RTA_LENGTH(alen); | 383 | int len = RTA_LENGTH(alen); |
| @@ -394,7 +394,7 @@ int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen | |||
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | 396 | ||
| 397 | int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) | 397 | int FAST_FUNC parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) |
| 398 | { | 398 | { |
| 399 | while (RTA_OK(rta, len)) { | 399 | while (RTA_OK(rta, len)) { |
| 400 | if (rta->rta_type <= max) { | 400 | if (rta->rta_type <= max) { |
diff --git a/networking/libiproute/libnetlink.h b/networking/libiproute/libnetlink.h index 6c1a88129..079153b92 100644 --- a/networking/libiproute/libnetlink.h +++ b/networking/libiproute/libnetlink.h | |||
| @@ -22,13 +22,13 @@ struct rtnl_handle | |||
| 22 | uint32_t dump; | 22 | uint32_t dump; |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | extern int xrtnl_open(struct rtnl_handle *rth); | 25 | extern int xrtnl_open(struct rtnl_handle *rth) FAST_FUNC; |
| 26 | extern void rtnl_close(struct rtnl_handle *rth); | 26 | extern void rtnl_close(struct rtnl_handle *rth) FAST_FUNC; |
| 27 | extern int xrtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type); | 27 | extern int xrtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type) FAST_FUNC; |
| 28 | extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len); | 28 | extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len) FAST_FUNC; |
| 29 | extern int xrtnl_dump_filter(struct rtnl_handle *rth, | 29 | extern int xrtnl_dump_filter(struct rtnl_handle *rth, |
| 30 | int (*filter)(const struct sockaddr_nl*, struct nlmsghdr *n, void*), | 30 | int (*filter)(const struct sockaddr_nl*, struct nlmsghdr *n, void*), |
| 31 | void *arg1); | 31 | void *arg1) FAST_FUNC; |
| 32 | 32 | ||
| 33 | /* bbox doesn't use parameters no. 3, 4, 6, 7, stub them out */ | 33 | /* bbox doesn't use parameters no. 3, 4, 6, 7, stub them out */ |
| 34 | #define rtnl_talk(rtnl, n, peer, groups, answer, junk, jarg) \ | 34 | #define rtnl_talk(rtnl, n, peer, groups, answer, junk, jarg) \ |
| @@ -36,17 +36,17 @@ extern int xrtnl_dump_filter(struct rtnl_handle *rth, | |||
| 36 | extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | 36 | extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, |
| 37 | unsigned groups, struct nlmsghdr *answer, | 37 | unsigned groups, struct nlmsghdr *answer, |
| 38 | int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), | 38 | int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), |
| 39 | void *jarg); | 39 | void *jarg) FAST_FUNC; |
| 40 | 40 | ||
| 41 | extern int rtnl_send(struct rtnl_handle *rth, char *buf, int); | 41 | extern int rtnl_send(struct rtnl_handle *rth, char *buf, int) FAST_FUNC; |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data); | 44 | extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) FAST_FUNC; |
| 45 | extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen); | 45 | extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) FAST_FUNC; |
| 46 | extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data); | 46 | extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data) FAST_FUNC; |
| 47 | extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen); | 47 | extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen) FAST_FUNC; |
| 48 | 48 | ||
| 49 | extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); | 49 | extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) FAST_FUNC; |
| 50 | 50 | ||
| 51 | #if __GNUC_PREREQ(4,1) | 51 | #if __GNUC_PREREQ(4,1) |
| 52 | # pragma GCC visibility pop | 52 | # pragma GCC visibility pop |
