summaryrefslogtreecommitdiff
path: root/networking/libiproute/ipaddress.c
diff options
context:
space:
mode:
authorDenys Vlasenko2015-10-14 13:56:42 +0200
committerDenys Vlasenko2015-10-14 13:56:42 +0200
commit926d801fa51717b3af3faf33f9d686e92a20ecfd (patch)
treebe5d1e982d1ec0330055ebeb0e216eca9a07892f /networking/libiproute/ipaddress.c
parent0f296a3a56b52842057e5a2bc653621a3a6c7bec (diff)
downloadbusybox-926d801fa51717b3af3faf33f9d686e92a20ecfd.zip
busybox-926d801fa51717b3af3faf33f9d686e92a20ecfd.tar.gz
libiproute: make rt_addr_n2a() and format_host() return auto strings
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>
Diffstat (limited to 'networking/libiproute/ipaddress.c')
-rw-r--r--networking/libiproute/ipaddress.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index c0f27c7..5c975d8 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -214,8 +214,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
{
struct ifaddrmsg *ifa = NLMSG_DATA(n);
int len = n->nlmsg_len;
- struct rtattr * rta_tb[IFA_MAX+1];
- char abuf[256];
+ struct rtattr *rta_tb[IFA_MAX+1];
if (n->nlmsg_type != RTM_NEWADDR && n->nlmsg_type != RTM_DELADDR)
return 0;
@@ -291,9 +290,9 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
printf(" family %d ", ifa->ifa_family);
if (rta_tb[IFA_LOCAL]) {
- fputs(rt_addr_n2a(ifa->ifa_family,
- RTA_DATA(rta_tb[IFA_LOCAL]),
- abuf, sizeof(abuf)), stdout);
+ fputs(rt_addr_n2a(ifa->ifa_family, RTA_DATA(rta_tb[IFA_LOCAL])),
+ stdout
+ );
if (rta_tb[IFA_ADDRESS] == NULL
|| memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), 4) == 0
@@ -301,25 +300,22 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
printf("/%d ", ifa->ifa_prefixlen);
} else {
printf(" peer %s/%d ",
- rt_addr_n2a(ifa->ifa_family,
- RTA_DATA(rta_tb[IFA_ADDRESS]),
- abuf, sizeof(abuf)),
- ifa->ifa_prefixlen);
+ rt_addr_n2a(ifa->ifa_family, RTA_DATA(rta_tb[IFA_ADDRESS])),
+ ifa->ifa_prefixlen
+ );
}
}
if (rta_tb[IFA_BROADCAST]) {
printf("brd %s ",
rt_addr_n2a(ifa->ifa_family,
- RTA_DATA(rta_tb[IFA_BROADCAST]),
- abuf, sizeof(abuf))
+ RTA_DATA(rta_tb[IFA_BROADCAST]))
);
}
if (rta_tb[IFA_ANYCAST]) {
printf("any %s ",
rt_addr_n2a(ifa->ifa_family,
- RTA_DATA(rta_tb[IFA_ANYCAST]),
- abuf, sizeof(abuf))
+ RTA_DATA(rta_tb[IFA_ANYCAST]))
);
}
printf("scope %s ", rtnl_rtscope_n2a(ifa->ifa_scope));