diff options
author | Thomas Haller <thaller@redhat.com> | 2016-03-31 13:44:56 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-04-15 14:24:15 (GMT) |
commit | 00034104fc9fdc70440ba8f1cf4718d4139c2893 (patch) | |
tree | 2cd687428b0aee10f1a28514b96983223c5575ba | |
parent | 941c187bc9051673fbcebbba952cf6ec75aa7a2b (diff) | |
download | libnl-00034104fc9fdc70440ba8f1cf4718d4139c2893.zip libnl-00034104fc9fdc70440ba8f1cf4718d4139c2893.tar.gz libnl-00034104fc9fdc70440ba8f1cf4718d4139c2893.tar.bz2 |
sit: don't print ip6rd_prefix as integer in sit_dump_details()
First of all, inet_ntop() has no reason to fail (ever). As long
as the input arguments point to valid data and family is not bogus.
But when it fails, we cannot pass a 'struct in6_addr' to "%x"
either, so just don't do that.
Same for printing ip6rd_relay_prefix as AF_INET. If our addr-to-str
method fails, we don't want to come up with something fancy. Otherwise,
we'd just implement a inet_ntop() that does not fail.
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | lib/route/link/sit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/route/link/sit.c b/lib/route/link/sit.c index 81b84a1..fc0fd75 100644 --- a/lib/route/link/sit.c +++ b/lib/route/link/sit.c @@ -306,7 +306,7 @@ static void sit_dump_details(struct rtnl_link *link, struct nl_dump_params *p) if(inet_ntop(AF_INET6, &sit->ip6rd_prefix, addr6, INET6_ADDRSTRLEN)) nl_dump_line(p, "%s\n", addr6); else - nl_dump_line(p, "%#x\n", sit->ip6rd_prefix); + nl_dump_line(p, "[unknown]\n"); } if (sit->sit_mask & SIT_ATTR_6RD_RELAY_PREFIX) { @@ -314,7 +314,7 @@ static void sit_dump_details(struct rtnl_link *link, struct nl_dump_params *p) if(inet_ntop(AF_INET, &sit->ip6rd_relay_prefix, addr, sizeof(addr))) nl_dump_line(p, "%s\n", addr); else - nl_dump_line(p, "%#x\n", ntohs(sit->ip6rd_relay_prefix)); + nl_dump_line(p, "[unknown]\n"); } if (sit->sit_mask & SIT_ATTR_6RD_PREFIXLEN) { |