|
|
4aca6e |
From 397fcc28438965bdd9c175ebe230c47a9564527e Mon Sep 17 00:00:00 2001
|
|
|
4aca6e |
From: Phil Sutter <psutter@redhat.com>
|
|
|
4aca6e |
Date: Fri, 17 Mar 2017 13:20:23 +0100
|
|
|
4aca6e |
Subject: [PATCH] utils: make rt_addr_n2a() non-reentrant by default
|
|
|
4aca6e |
|
|
|
4aca6e |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629
|
|
|
4aca6e |
Upstream Status: iproute2.git commit 2e96d2ccd03a2
|
|
|
4aca6e |
Conflicts: Context changes due to not backported whitespace cleanup from
|
|
|
4aca6e |
upstream.
|
|
|
4aca6e |
* Drop iproute_lwtunnel hunks as we don't support it
|
|
|
4aca6e |
|
|
|
4aca6e |
commit 2e96d2ccd03a29896fc8a2c6ee6b769c512501df
|
|
|
4aca6e |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
4aca6e |
Date: Tue Mar 22 19:35:16 2016 +0100
|
|
|
4aca6e |
|
|
|
4aca6e |
utils: make rt_addr_n2a() non-reentrant by default
|
|
|
4aca6e |
|
|
|
4aca6e |
There is only a single user who needs it to be reentrant (not really,
|
|
|
4aca6e |
but it's safer like this), add rt_addr_n2a_r() for it to use.
|
|
|
4aca6e |
|
|
|
4aca6e |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
4aca6e |
---
|
|
|
4aca6e |
include/utils.h | 3 ++-
|
|
|
4aca6e |
ip/ip6tunnel.c | 2 +-
|
|
|
4aca6e |
ip/iplink_bond.c | 5 +----
|
|
|
4aca6e |
ip/ipmroute.c | 7 ++-----
|
|
|
4aca6e |
ip/ipprefix.c | 5 +----
|
|
|
4aca6e |
ip/iproute.c | 10 +++-------
|
|
|
4aca6e |
ip/iprule.c | 7 ++-----
|
|
|
4aca6e |
ip/iptunnel.c | 2 +-
|
|
|
4aca6e |
ip/ipxfrm.c | 29 ++++++-----------------------
|
|
|
4aca6e |
ip/link_ip6tnl.c | 7 ++-----
|
|
|
4aca6e |
ip/xfrm_monitor.c | 16 +++-------------
|
|
|
4aca6e |
lib/utils.c | 11 +++++++++--
|
|
|
4aca6e |
tc/f_flower.c | 7 ++-----
|
|
|
4aca6e |
14 files changed, 37 insertions(+), 81 deletions(-)
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/include/utils.h b/include/utils.h
|
|
|
4aca6e |
index df6ce04..28684c5 100644
|
|
|
4aca6e |
--- a/include/utils.h
|
|
|
4aca6e |
+++ b/include/utils.h
|
|
|
4aca6e |
@@ -112,8 +112,9 @@ __u8 *hexstring_a2n(const char *str, __u8 *buf, int blen, unsigned int *len);
|
|
|
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 |
+const char *rt_addr_n2a_r(int af, int len, const void *addr,
|
|
|
4aca6e |
char *buf, int buflen);
|
|
|
4aca6e |
+const char *rt_addr_n2a(int af, int len, const void *addr);
|
|
|
4aca6e |
|
|
|
4aca6e |
int read_family(const char *name);
|
|
|
4aca6e |
const char *family_name(int family);
|
|
|
4aca6e |
diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c
|
|
|
4aca6e |
index ab8603d..e99a851 100644
|
|
|
4aca6e |
--- a/ip/ip6tunnel.c
|
|
|
4aca6e |
+++ b/ip/ip6tunnel.c
|
|
|
4aca6e |
@@ -79,7 +79,7 @@ static void print_tunnel(struct ip6_tnl_parm2 *p)
|
|
|
4aca6e |
p->name,
|
|
|
4aca6e |
tnl_strproto(p->proto),
|
|
|
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 |
+ rt_addr_n2a_r(AF_INET6, 16, &p->laddr, s2, sizeof(s2)));
|
|
|
4aca6e |
if (p->link) {
|
|
|
4aca6e |
const char *n = ll_index_to_name(p->link);
|
|
|
4aca6e |
if (n)
|
|
|
4aca6e |
diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c
|
|
|
4aca6e |
index cb2f045..6881eda 100644
|
|
|
4aca6e |
--- a/ip/iplink_bond.c
|
|
|
4aca6e |
+++ b/ip/iplink_bond.c
|
|
|
4aca6e |
@@ -410,7 +410,6 @@ static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[IFLA_BOND_ARP_IP_TARGET]) {
|
|
|
4aca6e |
struct rtattr *iptb[BOND_MAX_ARP_TARGETS + 1];
|
|
|
4aca6e |
- char buf[INET_ADDRSTRLEN];
|
|
|
4aca6e |
int i;
|
|
|
4aca6e |
|
|
|
4aca6e |
parse_rtattr_nested(iptb, BOND_MAX_ARP_TARGETS,
|
|
|
4aca6e |
@@ -424,9 +423,7 @@ static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
fprintf(f, "%s",
|
|
|
4aca6e |
rt_addr_n2a(AF_INET,
|
|
|
4aca6e |
RTA_PAYLOAD(iptb[i]),
|
|
|
4aca6e |
- RTA_DATA(iptb[i]),
|
|
|
4aca6e |
- buf,
|
|
|
4aca6e |
- INET_ADDRSTRLEN));
|
|
|
4aca6e |
+ RTA_DATA(iptb[i])));
|
|
|
4aca6e |
if (i < BOND_MAX_ARP_TARGETS-1 && iptb[i+1])
|
|
|
4aca6e |
fprintf(f, ",");
|
|
|
4aca6e |
}
|
|
|
4aca6e |
diff --git a/ip/ipmroute.c b/ip/ipmroute.c
|
|
|
4aca6e |
index 2c08fee..2daecc0 100644
|
|
|
4aca6e |
--- a/ip/ipmroute.c
|
|
|
4aca6e |
+++ b/ip/ipmroute.c
|
|
|
4aca6e |
@@ -59,7 +59,6 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
struct rtmsg *r = NLMSG_DATA(n);
|
|
|
4aca6e |
int len = n->nlmsg_len;
|
|
|
4aca6e |
struct rtattr * tb[RTA_MAX+1];
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
char obuf[256];
|
|
|
4aca6e |
SPRINT_BUF(b1);
|
|
|
4aca6e |
__u32 table;
|
|
|
4aca6e |
@@ -117,16 +116,14 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
len = snprintf(obuf, sizeof(obuf),
|
|
|
4aca6e |
"(%s, ", rt_addr_n2a(family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[RTA_SRC]),
|
|
|
4aca6e |
- RTA_DATA(tb[RTA_SRC]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[RTA_SRC])));
|
|
|
4aca6e |
else
|
|
|
4aca6e |
len = sprintf(obuf, "(unknown, ");
|
|
|
4aca6e |
if (tb[RTA_DST])
|
|
|
4aca6e |
snprintf(obuf + len, sizeof(obuf) - len,
|
|
|
4aca6e |
"%s)", rt_addr_n2a(family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[RTA_DST]),
|
|
|
4aca6e |
- RTA_DATA(tb[RTA_DST]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[RTA_DST])));
|
|
|
4aca6e |
else
|
|
|
4aca6e |
snprintf(obuf + len, sizeof(obuf) - len, "unknown) ");
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/ip/ipprefix.c b/ip/ipprefix.c
|
|
|
4aca6e |
index 286c09b..7b0a762 100644
|
|
|
4aca6e |
--- a/ip/ipprefix.c
|
|
|
4aca6e |
+++ b/ip/ipprefix.c
|
|
|
4aca6e |
@@ -76,15 +76,12 @@ int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[PREFIX_ADDRESS]) {
|
|
|
4aca6e |
struct in6_addr *pfx;
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
|
|
|
4aca6e |
pfx = (struct in6_addr *)RTA_DATA(tb[PREFIX_ADDRESS]);
|
|
|
4aca6e |
|
|
|
4aca6e |
- memset(abuf, '\0', sizeof(abuf));
|
|
|
4aca6e |
fprintf(fp, "%s", rt_addr_n2a(family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[PREFIX_ADDRESS]),
|
|
|
4aca6e |
- pfx,
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ pfx));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
fprintf(fp, "/%u ", prefix->prefix_len);
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/ip/iproute.c b/ip/iproute.c
|
|
|
4aca6e |
index 2bc2041..c3006e4 100644
|
|
|
4aca6e |
--- a/ip/iproute.c
|
|
|
4aca6e |
+++ b/ip/iproute.c
|
|
|
4aca6e |
@@ -306,7 +306,6 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
struct rtmsg *r = NLMSG_DATA(n);
|
|
|
4aca6e |
int len = n->nlmsg_len;
|
|
|
4aca6e |
struct rtattr * tb[RTA_MAX+1];
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
int host_len = -1;
|
|
|
4aca6e |
__u32 table;
|
|
|
4aca6e |
SPRINT_BUF(b1);
|
|
|
4aca6e |
@@ -359,8 +358,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
if (r->rtm_dst_len != host_len) {
|
|
|
4aca6e |
fprintf(fp, "%s/%u ", rt_addr_n2a(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 |
r->rtm_dst_len
|
|
|
4aca6e |
);
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
@@ -378,8 +376,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
if (r->rtm_src_len != host_len) {
|
|
|
4aca6e |
fprintf(fp, "from %s/%u ", rt_addr_n2a(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 |
r->rtm_src_len
|
|
|
4aca6e |
);
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
@@ -424,8 +421,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
fprintf(fp, "src %s ",
|
|
|
4aca6e |
rt_addr_n2a(r->rtm_family,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[RTA_PREFSRC]),
|
|
|
4aca6e |
- RTA_DATA(tb[RTA_PREFSRC]),
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ RTA_DATA(tb[RTA_PREFSRC])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
if (tb[RTA_PRIORITY])
|
|
|
4aca6e |
fprintf(fp, "metric %u ", rta_getattr_u32(tb[RTA_PRIORITY]));
|
|
|
4aca6e |
diff --git a/ip/iprule.c b/ip/iprule.c
|
|
|
4aca6e |
index 14eb852..87adb3b 100644
|
|
|
4aca6e |
--- a/ip/iprule.c
|
|
|
4aca6e |
+++ b/ip/iprule.c
|
|
|
4aca6e |
@@ -53,7 +53,6 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
int host_len = -1;
|
|
|
4aca6e |
__u32 table;
|
|
|
4aca6e |
struct rtattr * tb[FRA_MAX+1];
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
SPRINT_BUF(b1);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (n->nlmsg_type != RTM_NEWRULE && n->nlmsg_type != RTM_DELRULE)
|
|
|
4aca6e |
@@ -89,8 +88,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
if (r->rtm_src_len != host_len) {
|
|
|
4aca6e |
fprintf(fp, "from %s/%u ", rt_addr_n2a(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 |
r->rtm_src_len
|
|
|
4aca6e |
);
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
@@ -109,8 +107,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
if (r->rtm_dst_len != host_len) {
|
|
|
4aca6e |
fprintf(fp, "to %s/%u ", rt_addr_n2a(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 |
r->rtm_dst_len
|
|
|
4aca6e |
);
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
diff --git a/ip/iptunnel.c b/ip/iptunnel.c
|
|
|
4aca6e |
index 17b377c..c78c7f5 100644
|
|
|
4aca6e |
--- a/ip/iptunnel.c
|
|
|
4aca6e |
+++ b/ip/iptunnel.c
|
|
|
4aca6e |
@@ -347,7 +347,7 @@ static void print_tunnel(struct ip_tunnel_parm *p)
|
|
|
4aca6e |
p->name,
|
|
|
4aca6e |
tnl_strproto(p->iph.protocol),
|
|
|
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 |
+ p->iph.saddr ? rt_addr_n2a_r(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any");
|
|
|
4aca6e |
|
|
|
4aca6e |
if (p->iph.protocol == IPPROTO_IPV6 && (p->i_flags & SIT_ISATAP)) {
|
|
|
4aca6e |
struct ip_tunnel_prl prl[16];
|
|
|
4aca6e |
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
|
|
|
4aca6e |
index 0344355..899ec9d 100644
|
|
|
4aca6e |
--- a/ip/ipxfrm.c
|
|
|
4aca6e |
+++ b/ip/ipxfrm.c
|
|
|
4aca6e |
@@ -283,17 +283,11 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
|
|
|
4aca6e |
__u8 mode, __u32 reqid, __u16 family, int force_spi,
|
|
|
4aca6e |
FILE *fp, const char *prefix, const char *title)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
-
|
|
|
4aca6e |
if (title)
|
|
|
4aca6e |
fputs(title, fp);
|
|
|
4aca6e |
|
|
|
4aca6e |
- memset(abuf, '\0', sizeof(abuf));
|
|
|
4aca6e |
- fprintf(fp, "src %s ", rt_addr_n2a(family, sizeof(*saddr),
|
|
|
4aca6e |
- saddr, abuf, sizeof(abuf)));
|
|
|
4aca6e |
- memset(abuf, '\0', sizeof(abuf));
|
|
|
4aca6e |
- fprintf(fp, "dst %s", rt_addr_n2a(family, sizeof(id->daddr),
|
|
|
4aca6e |
- &id->daddr, abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ fprintf(fp, "src %s ", rt_addr_n2a(family, sizeof(*saddr), saddr));
|
|
|
4aca6e |
+ fprintf(fp, "dst %s", rt_addr_n2a(family, sizeof(id->daddr), &id->daddr));
|
|
|
4aca6e |
fprintf(fp, "%s", _SL_);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (prefix)
|
|
|
4aca6e |
@@ -443,7 +437,6 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
|
|
|
4aca6e |
void xfrm_selector_print(struct xfrm_selector *sel, __u16 family,
|
|
|
4aca6e |
FILE *fp, const char *prefix)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
__u16 f;
|
|
|
4aca6e |
|
|
|
4aca6e |
f = sel->family;
|
|
|
4aca6e |
@@ -455,16 +448,12 @@ void xfrm_selector_print(struct xfrm_selector *sel, __u16 family,
|
|
|
4aca6e |
if (prefix)
|
|
|
4aca6e |
fputs(prefix, fp);
|
|
|
4aca6e |
|
|
|
4aca6e |
- memset(abuf, '\0', sizeof(abuf));
|
|
|
4aca6e |
fprintf(fp, "src %s/%u ",
|
|
|
4aca6e |
- rt_addr_n2a(f, sizeof(sel->saddr), &sel->saddr,
|
|
|
4aca6e |
- abuf, sizeof(abuf)),
|
|
|
4aca6e |
+ rt_addr_n2a(f, sizeof(sel->saddr), &sel->saddr),
|
|
|
4aca6e |
sel->prefixlen_s);
|
|
|
4aca6e |
|
|
|
4aca6e |
- memset(abuf, '\0', sizeof(abuf));
|
|
|
4aca6e |
fprintf(fp, "dst %s/%u ",
|
|
|
4aca6e |
- rt_addr_n2a(f, sizeof(sel->daddr), &sel->daddr,
|
|
|
4aca6e |
- abuf, sizeof(abuf)),
|
|
|
4aca6e |
+ rt_addr_n2a(f, sizeof(sel->daddr), &sel->daddr),
|
|
|
4aca6e |
sel->prefixlen_d);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (sel->proto)
|
|
|
4aca6e |
@@ -729,7 +718,6 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[XFRMA_ENCAP]) {
|
|
|
4aca6e |
struct xfrm_encap_tmpl *e;
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
|
|
|
4aca6e |
if (prefix)
|
|
|
4aca6e |
fputs(prefix, fp);
|
|
|
4aca6e |
@@ -757,10 +745,8 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
|
|
|
4aca6e |
fprintf(fp, "sport %u ", ntohs(e->encap_sport));
|
|
|
4aca6e |
fprintf(fp, "dport %u ", ntohs(e->encap_dport));
|
|
|
4aca6e |
|
|
|
4aca6e |
- memset(abuf, '\0', sizeof(abuf));
|
|
|
4aca6e |
fprintf(fp, "addr %s",
|
|
|
4aca6e |
- rt_addr_n2a(family, sizeof(e->encap_oa), &e->encap_oa,
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ rt_addr_n2a(family, sizeof(e->encap_oa), &e->encap_oa));
|
|
|
4aca6e |
fprintf(fp, "%s", _SL_);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -771,7 +757,6 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[XFRMA_COADDR]) {
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
xfrm_address_t *coa;
|
|
|
4aca6e |
|
|
|
4aca6e |
if (prefix)
|
|
|
4aca6e |
@@ -786,10 +771,8 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
|
|
|
4aca6e |
return;
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
- memset(abuf, '\0', sizeof(abuf));
|
|
|
4aca6e |
fprintf(fp, "%s",
|
|
|
4aca6e |
- rt_addr_n2a(family, sizeof(*coa), coa,
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ rt_addr_n2a(family, sizeof(*coa), coa));
|
|
|
4aca6e |
fprintf(fp, "%s", _SL_);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c
|
|
|
4aca6e |
index f771c75..8cd9095 100644
|
|
|
4aca6e |
--- a/ip/link_ip6tnl.c
|
|
|
4aca6e |
+++ b/ip/link_ip6tnl.c
|
|
|
4aca6e |
@@ -254,7 +254,6 @@ get_failed:
|
|
|
4aca6e |
|
|
|
4aca6e |
static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char s1[256];
|
|
|
4aca6e |
char s2[64];
|
|
|
4aca6e |
int flags = 0;
|
|
|
4aca6e |
__u32 flowinfo = 0;
|
|
|
4aca6e |
@@ -286,16 +285,14 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb
|
|
|
4aca6e |
fprintf(f, "remote %s ",
|
|
|
4aca6e |
rt_addr_n2a(AF_INET6,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[IFLA_IPTUN_REMOTE]),
|
|
|
4aca6e |
- RTA_DATA(tb[IFLA_IPTUN_REMOTE]),
|
|
|
4aca6e |
- s1, sizeof(s1)));
|
|
|
4aca6e |
+ RTA_DATA(tb[IFLA_IPTUN_REMOTE])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[IFLA_IPTUN_LOCAL]) {
|
|
|
4aca6e |
fprintf(f, "local %s ",
|
|
|
4aca6e |
rt_addr_n2a(AF_INET6,
|
|
|
4aca6e |
RTA_PAYLOAD(tb[IFLA_IPTUN_LOCAL]),
|
|
|
4aca6e |
- RTA_DATA(tb[IFLA_IPTUN_LOCAL]),
|
|
|
4aca6e |
- s1, sizeof(s1)));
|
|
|
4aca6e |
+ RTA_DATA(tb[IFLA_IPTUN_LOCAL])));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[IFLA_IPTUN_LINK] && rta_getattr_u32(tb[IFLA_IPTUN_LINK])) {
|
|
|
4aca6e |
diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c
|
|
|
4aca6e |
index 34bd9f4..9c588f6 100644
|
|
|
4aca6e |
--- a/ip/xfrm_monitor.c
|
|
|
4aca6e |
+++ b/ip/xfrm_monitor.c
|
|
|
4aca6e |
@@ -227,12 +227,8 @@ static void xfrm_ae_flags_print(__u32 flags, void *arg)
|
|
|
4aca6e |
|
|
|
4aca6e |
static void xfrm_usersa_print(const struct xfrm_usersa_id *sa_id, __u32 reqid, FILE *fp)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char buf[256];
|
|
|
4aca6e |
-
|
|
|
4aca6e |
- buf[0] = 0;
|
|
|
4aca6e |
fprintf(fp, "dst %s ",
|
|
|
4aca6e |
- rt_addr_n2a(sa_id->family, sizeof(sa_id->daddr), &sa_id->daddr,
|
|
|
4aca6e |
- buf, sizeof(buf)));
|
|
|
4aca6e |
+ rt_addr_n2a(sa_id->family, sizeof(sa_id->daddr), &sa_id->daddr));
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(fp, " reqid 0x%x", reqid);
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -245,15 +241,12 @@ static int xfrm_ae_print(const struct sockaddr_nl *who,
|
|
|
4aca6e |
{
|
|
|
4aca6e |
FILE *fp = (FILE*)arg;
|
|
|
4aca6e |
struct xfrm_aevent_id *id = NLMSG_DATA(n);
|
|
|
4aca6e |
- char abuf[256];
|
|
|
4aca6e |
|
|
|
4aca6e |
fprintf(fp, "Async event ");
|
|
|
4aca6e |
xfrm_ae_flags_print(id->flags, arg);
|
|
|
4aca6e |
fprintf(fp,"\n\t");
|
|
|
4aca6e |
- memset(abuf, '\0', sizeof(abuf));
|
|
|
4aca6e |
fprintf(fp, "src %s ", rt_addr_n2a(id->sa_id.family,
|
|
|
4aca6e |
- sizeof(id->saddr), &id->saddr,
|
|
|
4aca6e |
- abuf, sizeof(abuf)));
|
|
|
4aca6e |
+ sizeof(id->saddr), &id->saddr));
|
|
|
4aca6e |
|
|
|
4aca6e |
xfrm_usersa_print(&id->sa_id, id->reqid, fp);
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -265,10 +258,7 @@ static int xfrm_ae_print(const struct sockaddr_nl *who,
|
|
|
4aca6e |
|
|
|
4aca6e |
static void xfrm_print_addr(FILE *fp, int family, xfrm_address_t *a)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- char buf[256];
|
|
|
4aca6e |
-
|
|
|
4aca6e |
- buf[0] = 0;
|
|
|
4aca6e |
- fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*a), a, buf, sizeof(buf)));
|
|
|
4aca6e |
+ fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*a), a));
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
static int xfrm_mapping_print(const struct sockaddr_nl *who,
|
|
|
4aca6e |
diff --git a/lib/utils.c b/lib/utils.c
|
|
|
4aca6e |
index 9764d75..465f254 100644
|
|
|
4aca6e |
--- a/lib/utils.c
|
|
|
4aca6e |
+++ b/lib/utils.c
|
|
|
4aca6e |
@@ -671,7 +671,7 @@ int __get_user_hz(void)
|
|
|
4aca6e |
return sysconf(_SC_CLK_TCK);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
-const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen)
|
|
|
4aca6e |
+const char *rt_addr_n2a_r(int af, int len, const void *addr, char *buf, int buflen)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
switch (af) {
|
|
|
4aca6e |
case AF_INET:
|
|
|
4aca6e |
@@ -690,6 +690,13 @@ const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
+const char *rt_addr_n2a(int af, int len, const void *addr)
|
|
|
4aca6e |
+{
|
|
|
4aca6e |
+ static char buf[256];
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ return rt_addr_n2a_r(af, len, addr, buf, 256);
|
|
|
4aca6e |
+}
|
|
|
4aca6e |
+
|
|
|
4aca6e |
int read_family(const char *name)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
int family = AF_UNSPEC;
|
|
|
4aca6e |
@@ -813,7 +820,7 @@ const char *format_host_r(int af, int len, const void *addr,
|
|
|
4aca6e |
return n;
|
|
|
4aca6e |
}
|
|
|
4aca6e |
#endif
|
|
|
4aca6e |
- return rt_addr_n2a(af, len, addr, buf, buflen);
|
|
|
4aca6e |
+ return rt_addr_n2a_r(af, len, addr, buf, buflen);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
const char *format_host(int af, int len, const void *addr)
|
|
|
4aca6e |
diff --git a/tc/f_flower.c b/tc/f_flower.c
|
|
|
4aca6e |
index db9cc29..5e2dc0d 100644
|
|
|
4aca6e |
--- a/tc/f_flower.c
|
|
|
4aca6e |
+++ b/tc/f_flower.c
|
|
|
4aca6e |
@@ -394,7 +394,6 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type,
|
|
|
4aca6e |
struct rtattr *addr6_attr,
|
|
|
4aca6e |
struct rtattr *mask6_attr)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- SPRINT_BUF(b1);
|
|
|
4aca6e |
struct rtattr *addr_attr;
|
|
|
4aca6e |
struct rtattr *mask_attr;
|
|
|
4aca6e |
int family;
|
|
|
4aca6e |
@@ -418,16 +417,14 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type,
|
|
|
4aca6e |
return;
|
|
|
4aca6e |
fprintf(f, "\n %s %s", name, rt_addr_n2a(family,
|
|
|
4aca6e |
RTA_PAYLOAD(addr_attr),
|
|
|
4aca6e |
- RTA_DATA(addr_attr),
|
|
|
4aca6e |
- b1, sizeof(b1)));
|
|
|
4aca6e |
+ RTA_DATA(addr_attr)));
|
|
|
4aca6e |
if (!mask_attr || RTA_PAYLOAD(mask_attr) != len)
|
|
|
4aca6e |
return;
|
|
|
4aca6e |
bits = __mask_bits(RTA_DATA(mask_attr), len);
|
|
|
4aca6e |
if (bits < 0)
|
|
|
4aca6e |
fprintf(f, "/%s", rt_addr_n2a(family,
|
|
|
4aca6e |
RTA_PAYLOAD(mask_attr),
|
|
|
4aca6e |
- RTA_DATA(mask_attr),
|
|
|
4aca6e |
- b1, sizeof(b1)));
|
|
|
4aca6e |
+ RTA_DATA(mask_attr)));
|
|
|
4aca6e |
else if (bits < len * 8)
|
|
|
4aca6e |
fprintf(f, "/%d", bits);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
--
|
|
|
4aca6e |
1.8.3.1
|
|
|
4aca6e |
|