|
|
4aca6e |
From 75d1640b9a77c2d5843a18774880aabf38d1062b Mon Sep 17 00:00:00 2001
|
|
|
4aca6e |
From: Phil Sutter <psutter@redhat.com>
|
|
|
4aca6e |
Date: Fri, 17 Mar 2017 13:19:41 +0100
|
|
|
4aca6e |
Subject: [PATCH] make format_host non-reentrant by default
|
|
|
4aca6e |
|
|
|
4aca6e |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629
|
|
|
4aca6e |
Upstream Status: iproute2.git commit a418e451643e7
|
|
|
4aca6e |
Conflicts:
|
|
|
4aca6e |
* Parts applied manually due to big differences in changed code
|
|
|
4aca6e |
between upstream and RHEL.
|
|
|
4aca6e |
* Two calls in misc/ss.c converted manually.
|
|
|
4aca6e |
* Drop iproute_lwtunnel hunks as we don't support it
|
|
|
4aca6e |
|
|
|
4aca6e |
commit a418e451643e77fe36861e53359587ba8aa41873
|
|
|
4aca6e |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
4aca6e |
Date: Tue Mar 22 19:35:15 2016 +0100
|
|
|
4aca6e |
|
|
|
4aca6e |
make format_host non-reentrant by default
|
|
|
4aca6e |
|
|
|
4aca6e |
There are only three users which require it to be reentrant, the rest is
|
|
|
4aca6e |
fine without. Instead, provide a reentrant format_host_r() for users
|
|
|
4aca6e |
which need it.
|
|
|
4aca6e |
|
|
|
4aca6e |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
4aca6e |
---
|
|
|
4aca6e |
bridge/fdb.c | 4 +---
|
|
|
4aca6e |
include/utils.h | 3 ++-
|
|
|
4aca6e |
ip/ip6tunnel.c | 2 +-
|
|
|
4aca6e |
ip/ipaddress.c | 13 ++++---------
|
|
|
4aca6e |
ip/ipaddrlabel.c | 4 +---
|
|
|
4aca6e |
ip/iplink_geneve.c | 5 ++---
|
|
|
4aca6e |
ip/iplink_vxlan.c | 13 ++++++-------
|
|
|
4aca6e |
ip/ipmaddr.c | 5 +----
|
|
|
4aca6e |
ip/ipneigh.c | 4 +---
|
|
|
4aca6e |
ip/iproute.c | 12 ++++--------
|
|
|
4aca6e |
ip/iprule.c | 9 +++------
|
|
|
4aca6e |
ip/iptoken.c | 4 +---
|
|
|
4aca6e |
ip/iptunnel.c | 6 +++---
|
|
|
4aca6e |
ip/link_gre.c | 5 ++---
|
|
|
4aca6e |
ip/link_gre6.c | 5 ++---
|
|
|
4aca6e |
ip/link_iptnl.c | 7 +++----
|
|
|
4aca6e |
ip/link_vti.c | 5 ++---
|
|
|
4aca6e |
ip/link_vti6.c | 5 ++---
|
|
|
4aca6e |
ip/tcp_metrics.c | 4 +---
|
|
|
4aca6e |
lib/utils.c | 9 ++++++++-
|
|
|
4aca6e |
misc/ss.c | 11 ++++-------
|
|
|
4aca6e |
tc/m_nat.c | 4 ++--
|
|
|
4aca6e |
23 files changed, 57 insertions(+), 86 deletions(-)
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/bridge/fdb.c b/bridge/fdb.c
|
|
|
4aca6e |
index d184f7e..4b536f9 100644
|
|
|
4aca6e |
--- a/bridge/fdb.c
|
|
|
4aca6e |
+++ b/bridge/fdb.c
|
|
|
4aca6e |
@@ -110,7 +110,6 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
fprintf(fp, "dev %s ", ll_index_to_name(r->ndm_ifindex));
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[NDA_DST]) {
|
|
|
4aca6e |
- SPRINT_BUF(abuf);
|
|
|
4aca6e |
int family = AF_INET;
|
|
|
4aca6e |
|
|
|
4aca6e |
if (RTA_PAYLOAD(tb[NDA_DST]) == sizeof(struct in6_addr))
|
|
|
4aca6e |
@@ -119,8 +118,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
fprintf(fp, "dst %s ",
|
|
|
4aca6e |
format_host(family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[NDA_DST]),
|
|
|
4aca6e |
- RTA_DATA(tb[NDA_DST]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[NDA_DST])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
if (vid)
|
|
|
4aca6e |
diff --git a/include/utils.h b/include/utils.h
|
|
|
4aca6e |
index 9839d9d..df6ce04 100644
|
|
|
4aca6e |
--- a/include/utils.h
|
|
|
4aca6e |
+++ b/include/utils.h
|
|
|
4aca6e |
@@ -109,8 +109,9 @@ int get_be16(__be16 *val, const char *arg, int base);
|
|
|
4aca6e |
char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen);
|
|
|
4aca6e |
__u8 *hexstring_a2n(const char *str, __u8 *buf, int blen, unsigned int *len);
|
|
|
4aca6e |
|
|
|
4aca6e |
-const char *format_host(int af, int len, const void *addr,
|
|
|
4aca6e |
+const char *format_host_r(int af, int len, const void *addr,
|
|
|
4aca6e |
char *buf, int buflen);
|
|
|
4aca6e |
+const char *format_host(int af, int lne, const void *addr);
|
|
|
4aca6e |
const char *rt_addr_n2a(int af, int len, const void *addr,
|
|
|
4aca6e |
char *buf, int buflen);
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c
|
|
|
4aca6e |
index 97c99e2..ab8603d 100644
|
|
|
4aca6e |
--- a/ip/ip6tunnel.c
|
|
|
4aca6e |
+++ b/ip/ip6tunnel.c
|
|
|
4aca6e |
@@ -78,7 +78,7 @@ static void print_tunnel(struct ip6_tnl_parm2 *p)
|
|
|
4aca6e |
printf("%s: %s/ipv6 remote %s local %s",
|
|
|
4aca6e |
p->name,
|
|
|
4aca6e |
tnl_strproto(p->proto),
|
|
|
4aca6e |
- format_host(AF_INET6, 16, &p->raddr, s1, sizeof(s1)),
|
|
|
4aca6e |
+ format_host_r(AF_INET6, 16, &p->raddr, s1, sizeof(s1)),
|
|
|
4aca6e |
rt_addr_n2a(AF_INET6, 16, &p->laddr, s2, sizeof(s2)));
|
|
|
4aca6e |
if (p->link) {
|
|
|
4aca6e |
const char *n = ll_index_to_name(p->link);
|
|
|
4aca6e |
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
|
|
|
4aca6e |
index 147bcca..5f08cde 100644
|
|
|
4aca6e |
--- a/ip/ipaddress.c
|
|
|
4aca6e |
+++ b/ip/ipaddress.c
|
|
|
4aca6e |
@@ -776,7 +776,6 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
|
|
4aca6e |
/* Use local copy of ifa_flags to not interfere with filtering code */
|
|
|
4aca6e |
unsigned int ifa_flags;
|
|
|
4aca6e |
struct rtattr * rta_tb[IFA_MAX+1];
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
SPRINT_BUF(b1);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (n->nlmsg_type != RTM_NEWADDR && n->nlmsg_type != RTM_DELADDR)
|
|
|
4aca6e |
@@ -866,8 +865,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
|
|
4aca6e |
if (rta_tb[IFA_LOCAL]) {
|
|
|
4aca6e |
fprintf(fp, "%s", format_host(ifa->ifa_family,
|
|
|
4aca6e |
RTA_PAYLOAD(rta_tb[IFA_LOCAL]),
|
|
|
4aca6e |
- RTA_DATA(rta_tb[IFA_LOCAL]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(rta_tb[IFA_LOCAL])));
|
|
|
4aca6e |
|
|
|
4aca6e |
if (rta_tb[IFA_ADDRESS] == NULL ||
|
|
|
4aca6e |
memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]),
|
|
|
4aca6e |
@@ -877,8 +875,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
|
|
4aca6e |
fprintf(fp, " peer %s/%d ",
|
|
|
4aca6e |
format_host(ifa->ifa_family,
|
|
|
4aca6e |
RTA_PAYLOAD(rta_tb[IFA_ADDRESS]),
|
|
|
4aca6e |
- RTA_DATA(rta_tb[IFA_ADDRESS]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)),
|
|
|
4aca6e |
+ RTA_DATA(rta_tb[IFA_ADDRESS])),
|
|
|
4aca6e |
ifa->ifa_prefixlen);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
@@ -887,15 +884,13 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
|
|
4aca6e |
fprintf(fp, "brd %s ",
|
|
|
4aca6e |
format_host(ifa->ifa_family,
|
|
|
4aca6e |
RTA_PAYLOAD(rta_tb[IFA_BROADCAST]),
|
|
|
4aca6e |
- RTA_DATA(rta_tb[IFA_BROADCAST]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(rta_tb[IFA_BROADCAST])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
if (rta_tb[IFA_ANYCAST]) {
|
|
|
4aca6e |
fprintf(fp, "any %s ",
|
|
|
4aca6e |
format_host(ifa->ifa_family,
|
|
|
4aca6e |
RTA_PAYLOAD(rta_tb[IFA_ANYCAST]),
|
|
|
4aca6e |
- RTA_DATA(rta_tb[IFA_ANYCAST]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(rta_tb[IFA_ANYCAST])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
fprintf(fp, "scope %s ", rtnl_rtscope_n2a(ifa->ifa_scope, b1, sizeof(b1)));
|
|
|
4aca6e |
if (ifa_flags & IFA_F_SECONDARY) {
|
|
|
4aca6e |
diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c
|
|
|
4aca6e |
index a0b6e6f..e834a87 100644
|
|
|
4aca6e |
--- a/ip/ipaddrlabel.c
|
|
|
4aca6e |
+++ b/ip/ipaddrlabel.c
|
|
|
4aca6e |
@@ -61,7 +61,6 @@ int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg
|
|
|
4aca6e |
struct ifaddrlblmsg *ifal = NLMSG_DATA(n);
|
|
|
4aca6e |
int len = n->nlmsg_len;
|
|
|
4aca6e |
struct rtattr *tb[IFAL_MAX+1];
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
|
|
|
4aca6e |
if (n->nlmsg_type != RTM_NEWADDRLABEL && n->nlmsg_type != RTM_DELADDRLABEL)
|
|
|
4aca6e |
return 0;
|
|
|
4aca6e |
@@ -79,8 +78,7 @@ int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg
|
|
|
4aca6e |
fprintf(fp, "prefix %s/%u ",
|
|
|
4aca6e |
format_host(ifal->ifal_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[IFAL_ADDRESS]),
|
|
|
4aca6e |
- RTA_DATA(tb[IFAL_ADDRESS]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)),
|
|
|
4aca6e |
+ RTA_DATA(tb[IFAL_ADDRESS])),
|
|
|
4aca6e |
ifal->ifal_prefixlen);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c
|
|
|
4aca6e |
index 905c537..2e15a1d 100644
|
|
|
4aca6e |
--- a/ip/iplink_geneve.c
|
|
|
4aca6e |
+++ b/ip/iplink_geneve.c
|
|
|
4aca6e |
@@ -181,7 +181,6 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
|
|
|
4aca6e |
static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
{
|
|
|
4aca6e |
__u32 vni;
|
|
|
4aca6e |
- char s1[1024];
|
|
|
4aca6e |
__u8 tos;
|
|
|
4aca6e |
|
|
|
4aca6e |
if (!tb)
|
|
|
4aca6e |
@@ -198,14 +197,14 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
__be32 addr = rta_getattr_u32(tb[IFLA_GENEVE_REMOTE]);
|
|
|
4aca6e |
if (addr)
|
|
|
4aca6e |
fprintf(f, "remote %s ",
|
|
|
4aca6e |
- format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET, 4, &addr));
|
|
|
4aca6e |
} else if (tb[IFLA_GENEVE_REMOTE6]) {
|
|
|
4aca6e |
struct in6_addr addr;
|
|
|
4aca6e |
memcpy(&addr, RTA_DATA(tb[IFLA_GENEVE_REMOTE6]), sizeof(struct in6_addr));
|
|
|
4aca6e |
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
|
|
|
4aca6e |
if (!IN6_IS_ADDR_MULTICAST(&addr))
|
|
|
4aca6e |
fprintf(f, "remote %s ",
|
|
|
4aca6e |
- format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
|
|
|
4aca6e |
index 015d7d9..6cae35b 100644
|
|
|
4aca6e |
--- a/ip/iplink_vxlan.c
|
|
|
4aca6e |
+++ b/ip/iplink_vxlan.c
|
|
|
4aca6e |
@@ -282,7 +282,6 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
unsigned link;
|
|
|
4aca6e |
__u8 tos;
|
|
|
4aca6e |
__u32 maxaddr;
|
|
|
4aca6e |
- char s1[1024];
|
|
|
4aca6e |
char s2[64];
|
|
|
4aca6e |
|
|
|
4aca6e |
if (!tb)
|
|
|
4aca6e |
@@ -300,10 +299,10 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
if (addr) {
|
|
|
4aca6e |
if (IN_MULTICAST(ntohl(addr)))
|
|
|
4aca6e |
fprintf(f, "group %s ",
|
|
|
4aca6e |
- format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET, 4, &addr));
|
|
|
4aca6e |
else
|
|
|
4aca6e |
fprintf(f, "remote %s ",
|
|
|
4aca6e |
- format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET, 4, &addr));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
} else if (tb[IFLA_VXLAN_GROUP6]) {
|
|
|
4aca6e |
struct in6_addr addr;
|
|
|
4aca6e |
@@ -311,10 +310,10 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
|
|
|
4aca6e |
if (IN6_IS_ADDR_MULTICAST(&addr))
|
|
|
4aca6e |
fprintf(f, "group %s ",
|
|
|
4aca6e |
- format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
|
|
4aca6e |
else
|
|
|
4aca6e |
fprintf(f, "remote %s ",
|
|
|
4aca6e |
- format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -322,13 +321,13 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_LOCAL]);
|
|
|
4aca6e |
if (addr)
|
|
|
4aca6e |
fprintf(f, "local %s ",
|
|
|
4aca6e |
- format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET, 4, &addr));
|
|
|
4aca6e |
} else if (tb[IFLA_VXLAN_LOCAL6]) {
|
|
|
4aca6e |
struct in6_addr addr;
|
|
|
4aca6e |
memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
|
|
|
4aca6e |
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
|
|
|
4aca6e |
fprintf(f, "local %s ",
|
|
|
4aca6e |
- format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[IFLA_VXLAN_LINK] &&
|
|
|
4aca6e |
diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
|
|
|
4aca6e |
index a77a18f..5c3dc28 100644
|
|
|
4aca6e |
--- a/ip/ipmaddr.c
|
|
|
4aca6e |
+++ b/ip/ipmaddr.c
|
|
|
4aca6e |
@@ -204,7 +204,6 @@ static void print_maddr(FILE *fp, struct ma_info *list)
|
|
|
4aca6e |
list->addr.bytelen, 0,
|
|
|
4aca6e |
b1, sizeof(b1)));
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
switch(list->addr.family) {
|
|
|
4aca6e |
case AF_INET:
|
|
|
4aca6e |
fprintf(fp, "inet ");
|
|
|
4aca6e |
@@ -218,9 +217,7 @@ static void print_maddr(FILE *fp, struct ma_info *list)
|
|
|
4aca6e |
}
|
|
|
4aca6e |
fprintf(fp, "%s",
|
|
|
4aca6e |
format_host(list->addr.family,
|
|
|
4aca6e |
- -1,
|
|
|
4aca6e |
- list->addr.data,
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ -1, list->addr.data));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
if (list->users != 1)
|
|
|
4aca6e |
fprintf(fp, " users %d", list->users);
|
|
|
4aca6e |
diff --git a/ip/ipneigh.c b/ip/ipneigh.c
|
|
|
4aca6e |
index 472555d..b99a120 100644
|
|
|
4aca6e |
--- a/ip/ipneigh.c
|
|
|
4aca6e |
+++ b/ip/ipneigh.c
|
|
|
4aca6e |
@@ -193,7 +193,6 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
struct ndmsg *r = NLMSG_DATA(n);
|
|
|
4aca6e |
int len = n->nlmsg_len;
|
|
|
4aca6e |
struct rtattr * tb[NDA_MAX+1];
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
|
|
|
4aca6e |
if (n->nlmsg_type != RTM_NEWNEIGH && n->nlmsg_type != RTM_DELNEIGH &&
|
|
|
4aca6e |
n->nlmsg_type != RTM_GETNEIGH) {
|
|
|
4aca6e |
@@ -264,8 +263,7 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
fprintf(fp, "%s ",
|
|
|
4aca6e |
format_host(r->ndm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[NDA_DST]),
|
|
|
4aca6e |
- RTA_DATA(tb[NDA_DST]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[NDA_DST])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
if (!filter.index && r->ndm_ifindex)
|
|
|
4aca6e |
fprintf(fp, "dev %s ", ll_index_to_name(r->ndm_ifindex));
|
|
|
4aca6e |
diff --git a/ip/iproute.c b/ip/iproute.c
|
|
|
4aca6e |
index eb5d145..2bc2041 100644
|
|
|
4aca6e |
--- a/ip/iproute.c
|
|
|
4aca6e |
+++ b/ip/iproute.c
|
|
|
4aca6e |
@@ -366,8 +366,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
fprintf(fp, "%s ", format_host(r->rtm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[RTA_DST]),
|
|
|
4aca6e |
- RTA_DATA(tb[RTA_DST]),
|
|
|
4aca6e |
- abuf, sizeof(abuf))
|
|
|
4aca6e |
+ RTA_DATA(tb[RTA_DST]))
|
|
|
4aca6e |
);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
} else if (r->rtm_dst_len) {
|
|
|
4aca6e |
@@ -386,8 +385,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
fprintf(fp, "from %s ", format_host(r->rtm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[RTA_SRC]),
|
|
|
4aca6e |
- RTA_DATA(tb[RTA_SRC]),
|
|
|
4aca6e |
- abuf, sizeof(abuf))
|
|
|
4aca6e |
+ RTA_DATA(tb[RTA_SRC]))
|
|
|
4aca6e |
);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
} else if (r->rtm_src_len) {
|
|
|
4aca6e |
@@ -406,8 +404,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
fprintf(fp, "via %s ",
|
|
|
4aca6e |
format_host(r->rtm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[RTA_GATEWAY]),
|
|
|
4aca6e |
- RTA_DATA(tb[RTA_GATEWAY]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[RTA_GATEWAY])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
if (tb[RTA_OIF] && filter.oifmask != -1)
|
|
|
4aca6e |
fprintf(fp, "dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF])));
|
|
|
4aca6e |
@@ -629,8 +626,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
fprintf(fp, " via %s ",
|
|
|
4aca6e |
format_host(r->rtm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[RTA_GATEWAY]),
|
|
|
4aca6e |
- RTA_DATA(tb[RTA_GATEWAY]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[RTA_GATEWAY])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
if (tb[RTA_FLOW]) {
|
|
|
4aca6e |
__u32 to = rta_getattr_u32(tb[RTA_FLOW]);
|
|
|
4aca6e |
diff --git a/ip/iprule.c b/ip/iprule.c
|
|
|
4aca6e |
index 63d7fcc..14eb852 100644
|
|
|
4aca6e |
--- a/ip/iprule.c
|
|
|
4aca6e |
+++ b/ip/iprule.c
|
|
|
4aca6e |
@@ -96,8 +96,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
fprintf(fp, "from %s ", format_host(r->rtm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[FRA_SRC]),
|
|
|
4aca6e |
- RTA_DATA(tb[FRA_SRC]),
|
|
|
4aca6e |
- abuf, sizeof(abuf))
|
|
|
4aca6e |
+ RTA_DATA(tb[FRA_SRC]))
|
|
|
4aca6e |
);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
} else if (r->rtm_src_len) {
|
|
|
4aca6e |
@@ -117,8 +116,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
fprintf(fp, "to %s ", format_host(r->rtm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[FRA_DST]),
|
|
|
4aca6e |
- RTA_DATA(tb[FRA_DST]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[FRA_DST])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
} else if (r->rtm_dst_len) {
|
|
|
4aca6e |
fprintf(fp, "to 0/%d ", r->rtm_dst_len);
|
|
|
4aca6e |
@@ -175,8 +173,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
fprintf(fp, "map-to %s ",
|
|
|
4aca6e |
format_host(r->rtm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[RTA_GATEWAY]),
|
|
|
4aca6e |
- RTA_DATA(tb[RTA_GATEWAY]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[RTA_GATEWAY])));
|
|
|
4aca6e |
} else
|
|
|
4aca6e |
fprintf(fp, "masquerade");
|
|
|
4aca6e |
} else if (r->rtm_type == FR_ACT_GOTO) {
|
|
|
4aca6e |
diff --git a/ip/iptoken.c b/ip/iptoken.c
|
|
|
4aca6e |
index 0d265e6..b8b0df0 100644
|
|
|
4aca6e |
--- a/ip/iptoken.c
|
|
|
4aca6e |
+++ b/ip/iptoken.c
|
|
|
4aca6e |
@@ -51,7 +51,6 @@ static int print_token(const struct sockaddr_nl *who, struct nlmsghdr *n, void *
|
|
|
4aca6e |
int len = n->nlmsg_len;
|
|
|
4aca6e |
struct rtattr *tb[IFLA_MAX + 1];
|
|
|
4aca6e |
struct rtattr *ltb[IFLA_INET6_MAX + 1];
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
|
|
|
4aca6e |
if (n->nlmsg_type != RTM_NEWLINK)
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
@@ -82,8 +81,7 @@ static int print_token(const struct sockaddr_nl *who, struct nlmsghdr *n, void *
|
|
|
4aca6e |
fprintf(fp, "token %s ",
|
|
|
4aca6e |
format_host(ifi->ifi_family,
|
|
|
4aca6e |
RTA_PAYLOAD(ltb[IFLA_INET6_TOKEN]),
|
|
|
4aca6e |
- RTA_DATA(ltb[IFLA_INET6_TOKEN]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(ltb[IFLA_INET6_TOKEN])));
|
|
|
4aca6e |
fprintf(fp, "dev %s ", ll_index_to_name(ifi->ifi_index));
|
|
|
4aca6e |
fprintf(fp, "\n");
|
|
|
4aca6e |
fflush(fp);
|
|
|
4aca6e |
diff --git a/ip/iptunnel.c b/ip/iptunnel.c
|
|
|
4aca6e |
index b9b24e8..17b377c 100644
|
|
|
4aca6e |
--- a/ip/iptunnel.c
|
|
|
4aca6e |
+++ b/ip/iptunnel.c
|
|
|
4aca6e |
@@ -346,7 +346,7 @@ static void print_tunnel(struct ip_tunnel_parm *p)
|
|
|
4aca6e |
printf("%s: %s/ip remote %s local %s ",
|
|
|
4aca6e |
p->name,
|
|
|
4aca6e |
tnl_strproto(p->iph.protocol),
|
|
|
4aca6e |
- p->iph.daddr ? format_host(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1)) : "any",
|
|
|
4aca6e |
+ p->iph.daddr ? format_host_r(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1)) : "any",
|
|
|
4aca6e |
p->iph.saddr ? rt_addr_n2a(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any");
|
|
|
4aca6e |
|
|
|
4aca6e |
if (p->iph.protocol == IPPROTO_IPV6 && (p->i_flags & SIT_ISATAP)) {
|
|
|
4aca6e |
@@ -363,7 +363,7 @@ static void print_tunnel(struct ip_tunnel_parm *p)
|
|
|
4aca6e |
if (prl[i].addr != htonl(INADDR_ANY)) {
|
|
|
4aca6e |
printf(" %s %s ",
|
|
|
4aca6e |
(prl[i].flags & PRL_DEFAULT) ? "pdr" : "pr",
|
|
|
4aca6e |
- format_host(AF_INET, 4, &prl[i].addr, s1, sizeof(s1)));
|
|
|
4aca6e |
+ format_host(AF_INET, 4, &prl[i].addr));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
@@ -398,7 +398,7 @@ static void print_tunnel(struct ip_tunnel_parm *p)
|
|
|
4aca6e |
ip6rd.prefixlen);
|
|
|
4aca6e |
if (ip6rd.relay_prefix) {
|
|
|
4aca6e |
printf("6rd-relay_prefix %s/%u ",
|
|
|
4aca6e |
- format_host(AF_INET, 4, &ip6rd.relay_prefix, s1, sizeof(s1)),
|
|
|
4aca6e |
+ format_host(AF_INET, 4, &ip6rd.relay_prefix),
|
|
|
4aca6e |
ip6rd.relay_prefixlen);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
diff --git a/ip/link_gre.c b/ip/link_gre.c
|
|
|
4aca6e |
index 62acf46..25a4047 100644
|
|
|
4aca6e |
--- a/ip/link_gre.c
|
|
|
4aca6e |
+++ b/ip/link_gre.c
|
|
|
4aca6e |
@@ -276,7 +276,6 @@ get_failed:
|
|
|
4aca6e |
|
|
|
4aca6e |
static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char s1[1024];
|
|
|
4aca6e |
char s2[64];
|
|
|
4aca6e |
const char *local = "any";
|
|
|
4aca6e |
const char *remote = "any";
|
|
|
4aca6e |
@@ -290,7 +289,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
unsigned addr = rta_getattr_u32(tb[IFLA_GRE_REMOTE]);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (addr)
|
|
|
4aca6e |
- remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
|
|
|
4aca6e |
+ remote = format_host(AF_INET, 4, &addr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "remote %s ", remote);
|
|
|
4aca6e |
@@ -299,7 +298,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
unsigned addr = rta_getattr_u32(tb[IFLA_GRE_LOCAL]);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (addr)
|
|
|
4aca6e |
- local = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
|
|
|
4aca6e |
+ local = format_host(AF_INET, 4, &addr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "local %s ", local);
|
|
|
4aca6e |
diff --git a/ip/link_gre6.c b/ip/link_gre6.c
|
|
|
4aca6e |
index e00ea09..e07a0ad 100644
|
|
|
4aca6e |
--- a/ip/link_gre6.c
|
|
|
4aca6e |
+++ b/ip/link_gre6.c
|
|
|
4aca6e |
@@ -297,7 +297,6 @@ get_failed:
|
|
|
4aca6e |
|
|
|
4aca6e |
static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char s1[1024];
|
|
|
4aca6e |
char s2[64];
|
|
|
4aca6e |
const char *local = "any";
|
|
|
4aca6e |
const char *remote = "any";
|
|
|
4aca6e |
@@ -321,7 +320,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
memcpy(&addr, RTA_DATA(tb[IFLA_GRE_REMOTE]), sizeof(addr));
|
|
|
4aca6e |
|
|
|
4aca6e |
if (memcmp(&addr, &in6_addr_any, sizeof(addr)))
|
|
|
4aca6e |
- remote = format_host(AF_INET6, sizeof(addr), &addr, s1, sizeof(s1));
|
|
|
4aca6e |
+ remote = format_host(AF_INET6, sizeof(addr), &addr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "remote %s ", remote);
|
|
|
4aca6e |
@@ -331,7 +330,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
memcpy(&addr, RTA_DATA(tb[IFLA_GRE_LOCAL]), sizeof(addr));
|
|
|
4aca6e |
|
|
|
4aca6e |
if (memcmp(&addr, &in6_addr_any, sizeof(addr)))
|
|
|
4aca6e |
- local = format_host(AF_INET6, sizeof(addr), &addr, s1, sizeof(s1));
|
|
|
4aca6e |
+ local = format_host(AF_INET6, sizeof(addr), &addr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "local %s ", local);
|
|
|
4aca6e |
diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c
|
|
|
4aca6e |
index 4d5422b..0d83310 100644
|
|
|
4aca6e |
--- a/ip/link_iptnl.c
|
|
|
4aca6e |
+++ b/ip/link_iptnl.c
|
|
|
4aca6e |
@@ -258,7 +258,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
|
|
|
4aca6e |
unsigned addr = rta_getattr_u32(tb[IFLA_IPTUN_REMOTE]);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (addr)
|
|
|
4aca6e |
- remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
|
|
|
4aca6e |
+ remote = format_host(AF_INET, 4, &addr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "remote %s ", remote);
|
|
|
4aca6e |
@@ -267,7 +267,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
|
|
|
4aca6e |
unsigned addr = rta_getattr_u32(tb[IFLA_IPTUN_LOCAL]);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (addr)
|
|
|
4aca6e |
- local = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
|
|
|
4aca6e |
+ local = format_host(AF_INET, 4, &addr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "local %s ", local);
|
|
|
4aca6e |
@@ -323,8 +323,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
|
|
|
4aca6e |
prefixlen);
|
|
|
4aca6e |
if (relayprefix) {
|
|
|
4aca6e |
printf("6rd-relay_prefix %s/%u ",
|
|
|
4aca6e |
- format_host(AF_INET, 4, &relayprefix, s1,
|
|
|
4aca6e |
- sizeof(s1)),
|
|
|
4aca6e |
+ format_host(AF_INET, 4, &relayprefix),
|
|
|
4aca6e |
relayprefixlen);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
diff --git a/ip/link_vti.c b/ip/link_vti.c
|
|
|
4aca6e |
index f3fea33..83d6187 100644
|
|
|
4aca6e |
--- a/ip/link_vti.c
|
|
|
4aca6e |
+++ b/ip/link_vti.c
|
|
|
4aca6e |
@@ -198,7 +198,6 @@ get_failed:
|
|
|
4aca6e |
|
|
|
4aca6e |
static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char s1[1024];
|
|
|
4aca6e |
char s2[64];
|
|
|
4aca6e |
const char *local = "any";
|
|
|
4aca6e |
const char *remote = "any";
|
|
|
4aca6e |
@@ -210,7 +209,7 @@ static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
unsigned addr = *(__u32 *)RTA_DATA(tb[IFLA_VTI_REMOTE]);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (addr)
|
|
|
4aca6e |
- remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
|
|
|
4aca6e |
+ remote = format_host(AF_INET, 4, &addr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "remote %s ", remote);
|
|
|
4aca6e |
@@ -219,7 +218,7 @@ static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
unsigned addr = *(__u32 *)RTA_DATA(tb[IFLA_VTI_LOCAL]);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (addr)
|
|
|
4aca6e |
- local = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
|
|
|
4aca6e |
+ local = format_host(AF_INET, 4, &addr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "local %s ", local);
|
|
|
4aca6e |
diff --git a/ip/link_vti6.c b/ip/link_vti6.c
|
|
|
4aca6e |
index c146f79..699a6ab 100644
|
|
|
4aca6e |
--- a/ip/link_vti6.c
|
|
|
4aca6e |
+++ b/ip/link_vti6.c
|
|
|
4aca6e |
@@ -195,7 +195,6 @@ get_failed:
|
|
|
4aca6e |
|
|
|
4aca6e |
static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char s1[1024];
|
|
|
4aca6e |
char s2[64];
|
|
|
4aca6e |
const char *local = "any";
|
|
|
4aca6e |
const char *remote = "any";
|
|
|
4aca6e |
@@ -208,7 +207,7 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
if (tb[IFLA_VTI_REMOTE]) {
|
|
|
4aca6e |
memcpy(&daddr, RTA_DATA(tb[IFLA_VTI_REMOTE]), sizeof(daddr));
|
|
|
4aca6e |
|
|
|
4aca6e |
- remote = format_host(AF_INET6, 16, &daddr, s1, sizeof(s1));
|
|
|
4aca6e |
+ remote = format_host(AF_INET6, 16, &daddr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "remote %s ", remote);
|
|
|
4aca6e |
@@ -216,7 +215,7 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
if (tb[IFLA_VTI_LOCAL]) {
|
|
|
4aca6e |
memcpy(&saddr, RTA_DATA(tb[IFLA_VTI_LOCAL]), sizeof(saddr));
|
|
|
4aca6e |
|
|
|
4aca6e |
- local = format_host(AF_INET6, 16, &saddr, s1, sizeof(s1));
|
|
|
4aca6e |
+ local = format_host(AF_INET6, 16, &saddr);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, "local %s ", local);
|
|
|
4aca6e |
diff --git a/ip/tcp_metrics.c b/ip/tcp_metrics.c
|
|
|
4aca6e |
index 7e7cf27..c55d9ad 100644
|
|
|
4aca6e |
--- a/ip/tcp_metrics.c
|
|
|
4aca6e |
+++ b/ip/tcp_metrics.c
|
|
|
4aca6e |
@@ -94,7 +94,6 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
|
|
4aca6e |
struct genlmsghdr *ghdr;
|
|
|
4aca6e |
struct rtattr *attrs[TCP_METRICS_ATTR_MAX + 1], *a;
|
|
|
4aca6e |
int len = n->nlmsg_len;
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
inet_prefix addr;
|
|
|
4aca6e |
int family, i, atype;
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -161,8 +160,7 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
|
|
4aca6e |
fprintf(fp, "Deleted ");
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(fp, "%s",
|
|
|
4aca6e |
- format_host(family, RTA_PAYLOAD(a), &addr.data,
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ format_host(family, RTA_PAYLOAD(a), &addr.data));
|
|
|
4aca6e |
|
|
|
4aca6e |
a = attrs[TCP_METRICS_ATTR_AGE];
|
|
|
4aca6e |
if (a) {
|
|
|
4aca6e |
diff --git a/lib/utils.c b/lib/utils.c
|
|
|
4aca6e |
index d3ed875..9764d75 100644
|
|
|
4aca6e |
--- a/lib/utils.c
|
|
|
4aca6e |
+++ b/lib/utils.c
|
|
|
4aca6e |
@@ -780,7 +780,7 @@ static const char *resolve_address(const void *addr, int len, int af)
|
|
|
4aca6e |
#endif
|
|
|
4aca6e |
|
|
|
4aca6e |
|
|
|
4aca6e |
-const char *format_host(int af, int len, const void *addr,
|
|
|
4aca6e |
+const char *format_host_r(int af, int len, const void *addr,
|
|
|
4aca6e |
char *buf, int buflen)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
#ifdef RESOLVE_HOSTNAMES
|
|
|
4aca6e |
@@ -816,6 +816,13 @@ const char *format_host(int af, int len, const void *addr,
|
|
|
4aca6e |
return rt_addr_n2a(af, len, addr, buf, buflen);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
+const char *format_host(int af, int len, const void *addr)
|
|
|
4aca6e |
+{
|
|
|
4aca6e |
+ static char buf[256];
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ return format_host_r(af, len, addr, buf, 256);
|
|
|
4aca6e |
+}
|
|
|
4aca6e |
+
|
|
|
4aca6e |
|
|
|
4aca6e |
char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
diff --git a/misc/ss.c b/misc/ss.c
|
|
|
4aca6e |
index d438428..46b0925 100644
|
|
|
4aca6e |
--- a/misc/ss.c
|
|
|
4aca6e |
+++ b/misc/ss.c
|
|
|
4aca6e |
@@ -1074,10 +1074,10 @@ static void inet_addr_print(const inet_prefix *a, int port, unsigned int ifindex
|
|
|
4aca6e |
buf[0] = '*';
|
|
|
4aca6e |
buf[1] = 0;
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
- ap = format_host(AF_INET, 4, a->data, buf, sizeof(buf));
|
|
|
4aca6e |
+ ap = format_host(AF_INET, 4, a->data);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
- ap = format_host(a->family, 16, a->data, buf, sizeof(buf));
|
|
|
4aca6e |
+ ap = format_host(a->family, 16, a->data);
|
|
|
4aca6e |
est_len = strlen(ap);
|
|
|
4aca6e |
if (est_len <= addr_width)
|
|
|
4aca6e |
est_len = addr_width;
|
|
|
4aca6e |
@@ -2119,7 +2119,6 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
|
|
|
4aca6e |
|
|
|
4aca6e |
static const char *format_host_sa(struct sockaddr_storage *sa)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char buf[1024];
|
|
|
4aca6e |
union {
|
|
|
4aca6e |
struct sockaddr_in sin;
|
|
|
4aca6e |
struct sockaddr_in6 sin6;
|
|
|
4aca6e |
@@ -2127,11 +2126,9 @@ static const char *format_host_sa(struct sockaddr_storage *sa)
|
|
|
4aca6e |
|
|
|
4aca6e |
switch (sa->ss_family) {
|
|
|
4aca6e |
case AF_INET:
|
|
|
4aca6e |
- return format_host(AF_INET, 4, &saddr->sin.sin_addr,
|
|
|
4aca6e |
- buf, sizeof(buf));
|
|
|
4aca6e |
+ return format_host(AF_INET, 4, &saddr->sin.sin_addr);
|
|
|
4aca6e |
case AF_INET6:
|
|
|
4aca6e |
- return format_host(AF_INET6, 16, &saddr->sin6.sin6_addr,
|
|
|
4aca6e |
- buf, sizeof(buf));
|
|
|
4aca6e |
+ return format_host(AF_INET6, 16, &saddr->sin6.sin6_addr);
|
|
|
4aca6e |
default:
|
|
|
4aca6e |
return "";
|
|
|
4aca6e |
}
|
|
|
4aca6e |
diff --git a/tc/m_nat.c b/tc/m_nat.c
|
|
|
4aca6e |
index 01ec032..df5c911 100644
|
|
|
4aca6e |
--- a/tc/m_nat.c
|
|
|
4aca6e |
+++ b/tc/m_nat.c
|
|
|
4aca6e |
@@ -190,9 +190,9 @@ print_nat(struct action_util *au,FILE * f, struct rtattr *arg)
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(f, " nat %s %s/%d %s %s", sel->flags & TCA_NAT_FLAG_EGRESS ?
|
|
|
4aca6e |
"egress" : "ingress",
|
|
|
4aca6e |
- format_host(AF_INET, 4, &sel->old_addr, buf1, sizeof(buf1)),
|
|
|
4aca6e |
+ format_host_r(AF_INET, 4, &sel->old_addr, buf1, sizeof(buf1)),
|
|
|
4aca6e |
len,
|
|
|
4aca6e |
- format_host(AF_INET, 4, &sel->new_addr, buf2, sizeof(buf2)),
|
|
|
4aca6e |
+ format_host_r(AF_INET, 4, &sel->new_addr, buf2, sizeof(buf2)),
|
|
|
4aca6e |
action_n2a(sel->action, buf3, sizeof (buf3)));
|
|
|
4aca6e |
|
|
|
4aca6e |
if (show_stats) {
|
|
|
4aca6e |
--
|
|
|
4aca6e |
1.8.3.1
|
|
|
4aca6e |
|