aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/iptunnel.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-10-14 13:56:42 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-14 13:56:42 +0200
commit926d801fa51717b3af3faf33f9d686e92a20ecfd (patch)
treebe5d1e982d1ec0330055ebeb0e216eca9a07892f /networking/libiproute/iptunnel.c
parent0f296a3a56b52842057e5a2bc653621a3a6c7bec (diff)
downloadbusybox-w32-926d801fa51717b3af3faf33f9d686e92a20ecfd.tar.gz
busybox-w32-926d801fa51717b3af3faf33f9d686e92a20ecfd.tar.bz2
busybox-w32-926d801fa51717b3af3faf33f9d686e92a20ecfd.zip
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/iptunnel.c')
-rw-r--r--networking/libiproute/iptunnel.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index b88c3a401..eb136e435 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -404,22 +404,18 @@ static int do_del(char **argv)
404 404
405static void print_tunnel(struct ip_tunnel_parm *p) 405static void print_tunnel(struct ip_tunnel_parm *p)
406{ 406{
407 char s1[256]; 407 char s3[INET_ADDRSTRLEN];
408 char s2[256]; 408 char s4[INET_ADDRSTRLEN];
409 char s3[64];
410 char s4[64];
411
412 format_host(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1));
413 format_host(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2));
414 inet_ntop(AF_INET, &p->i_key, s3, sizeof(s3));
415 inet_ntop(AF_INET, &p->o_key, s4, sizeof(s4));
416 409
417 printf("%s: %s/ip remote %s local %s ", 410 printf("%s: %s/ip remote %s local %s ",
418 p->name, 411 p->name,
419 p->iph.protocol == IPPROTO_IPIP ? "ip" : 412 p->iph.protocol == IPPROTO_IPIP ? "ip" :
420 (p->iph.protocol == IPPROTO_GRE ? "gre" : 413 p->iph.protocol == IPPROTO_GRE ? "gre" :
421 (p->iph.protocol == IPPROTO_IPV6 ? "ipv6" : "unknown")), 414 p->iph.protocol == IPPROTO_IPV6 ? "ipv6" :
422 p->iph.daddr ? s1 : "any", p->iph.saddr ? s2 : "any"); 415 "unknown",
416 p->iph.daddr ? format_host(AF_INET, 4, &p->iph.daddr) : "any",
417 p->iph.saddr ? format_host(AF_INET, 4, &p->iph.saddr) : "any"
418 );
423 if (p->link) { 419 if (p->link) {
424 char *n = do_ioctl_get_ifname(p->link); 420 char *n = do_ioctl_get_ifname(p->link);
425 if (n) { 421 if (n) {
@@ -442,9 +438,11 @@ static void print_tunnel(struct ip_tunnel_parm *p)
442 if (!(p->iph.frag_off & htons(IP_DF))) 438 if (!(p->iph.frag_off & htons(IP_DF)))
443 printf(" nopmtudisc"); 439 printf(" nopmtudisc");
444 440
441 inet_ntop(AF_INET, &p->i_key, s3, sizeof(s3));
442 inet_ntop(AF_INET, &p->o_key, s4, sizeof(s4));
445 if ((p->i_flags & GRE_KEY) && (p->o_flags & GRE_KEY) && p->o_key == p->i_key) 443 if ((p->i_flags & GRE_KEY) && (p->o_flags & GRE_KEY) && p->o_key == p->i_key)
446 printf(" key %s", s3); 444 printf(" key %s", s3);
447 else if ((p->i_flags | p->o_flags) & GRE_KEY) { 445 else {
448 if (p->i_flags & GRE_KEY) 446 if (p->i_flags & GRE_KEY)
449 printf(" ikey %s ", s3); 447 printf(" ikey %s ", s3);
450 if (p->o_flags & GRE_KEY) 448 if (p->o_flags & GRE_KEY)