diff options
author | Andrew J. Schorr <ajschorr@alumni.princeton.edu> | 2007-03-14 20:21:43 +0000 |
---|---|---|
committer | Andrew J. Schorr <ajschorr@alumni.princeton.edu> | 2007-03-14 20:21:43 +0000 |
commit | 56b3ea09bb613b066824c03290a58f8f2dfae9fd (patch) | |
tree | 26e0c5c3bbadfc48cba91584c21e06c971e68d31 /ospfd/ospf_zebra.c | |
parent | c136d24406b62510a8c7a3c89e7716d0819e8fc2 (diff) |
[ospfd] Fix two debug messages that used inet_ntoa more than once
2007-03-14 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_zebra.c: (ospf_zebra_add, ospf_zebra_delete) Fix bug
where inet_ntoa was used twice in the same debug message,
which doesn't work because there's a single shared buffer
for the returned string. The fix is to use inet_ntop.
Diffstat (limited to 'ospfd/ospf_zebra.c')
-rw-r--r-- | ospfd/ospf_zebra.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index bdd01424..f302d28d 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -396,9 +396,13 @@ ospf_zebra_add (struct prefix_ipv4 *p, struct ospf_route *or) if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE)) { - zlog_debug ("Zebra: Route add %s/%d nexthop %s", - inet_ntoa (p->prefix), - p->prefixlen, inet_ntoa (path->nexthop)); + char buf[2][INET_ADDRSTRLEN]; + zlog_debug("Zebra: Route add %s/%d nexthop %s", + inet_ntop(AF_INET, &p->prefix, + buf[0], sizeof(buf[0])), + p->prefixlen, + inet_ntop(AF_INET, &path->nexthop, + buf[1], sizeof(buf[1]))); } } @@ -462,9 +466,12 @@ ospf_zebra_delete (struct prefix_ipv4 *p, struct ospf_route *or) if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE) && api.nexthop_num) { - zlog_debug ("Zebra: Route delete %s/%d nexthop %s", - inet_ntoa (p->prefix), - p->prefixlen, inet_ntoa (**api.nexthop)); + char buf[2][INET_ADDRSTRLEN]; + zlog_debug("Zebra: Route delete %s/%d nexthop %s", + inet_ntop(AF_INET, &p->prefix, buf[0], sizeof(buf[0])), + p->prefixlen, + inet_ntop(AF_INET, *api.nexthop, + buf[1], sizeof(buf[1]))); } if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE) && api.ifindex_num) { |