summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_bfd.c2
-rw-r--r--bgpd/bgp_mpath.c2
-rw-r--r--bgpd/bgp_nht.c16
-rw-r--r--bgpd/bgp_route.c2
-rw-r--r--bgpd/bgp_vty.c6
-rw-r--r--bgpd/bgp_zebra.c10
-rw-r--r--bgpd/bgpd.c6
-rw-r--r--isisd/isis_circuit.c24
-rw-r--r--isisd/isis_route.c12
-rw-r--r--isisd/isis_spf.c42
-rw-r--r--isisd/isis_zebra.c8
-rw-r--r--lib/prefix.c7
-rw-r--r--lib/prefix.h8
-rw-r--r--lib/zclient.c2
-rw-r--r--ospf6d/ospf6_abr.c4
-rw-r--r--ospf6d/ospf6_area.c2
-rw-r--r--ospf6d/ospf6_asbr.c12
-rw-r--r--ospf6d/ospf6_bfd.c2
-rw-r--r--ospf6d/ospf6_interface.c4
-rw-r--r--ospf6d/ospf6_intra.c8
-rw-r--r--ospf6d/ospf6_lsa.h10
-rw-r--r--ospf6d/ospf6_lsdb.c2
-rw-r--r--ospf6d/ospf6_route.c10
-rw-r--r--ospf6d/ospf6_zebra.c4
-rw-r--r--ospfd/ospf_abr.c6
-rw-r--r--ospfd/ospf_bfd.c2
-rw-r--r--ospfd/ospf_zebra.c6
-rw-r--r--tests/table_test.c4
-rw-r--r--zebra/kernel_socket.c2
-rw-r--r--zebra/rt_netlink.c4
-rw-r--r--zebra/zebra_rib.c6
-rw-r--r--zebra/zebra_rnh.c38
-rw-r--r--zebra/zebra_vty.c2
-rw-r--r--zebra/zserv.c4
34 files changed, 136 insertions, 143 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 011ccef94..cc4e61b55 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -236,7 +236,7 @@ bgp_bfd_dest_update (int command, struct zclient *zclient,
if (BGP_DEBUG (zebra, ZEBRA))
{
- char buf[2][128];
+ char buf[2][PREFIX2STR_BUFFER];
prefix2str(&dp, buf[0], sizeof(buf[0]));
if (ifp)
{
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index c0e1a6163..cf92bb151 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -426,7 +426,7 @@ bgp_info_mpath_update (struct bgp_node *rn, struct bgp_info *new_best,
struct listnode *mp_node, *mp_next_node;
struct bgp_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath;
int mpath_changed, debug;
- char pfx_buf[INET6_ADDRSTRLEN], nh_buf[2][INET6_ADDRSTRLEN];
+ char pfx_buf[PREFIX2STR_BUFFER], nh_buf[2][INET6_ADDRSTRLEN];
mpath_changed = 0;
maxpaths = BGP_DEFAULT_MAXPATHS;
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 25969da3d..2828ec357 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -82,9 +82,9 @@ bgp_unlink_nexthop (struct bgp_info *path)
{
if (BGP_DEBUG(nht, NHT))
{
- char buf[INET6_ADDRSTRLEN];
+ char buf[PREFIX2STR_BUFFER];
zlog_debug("bgp_unlink_nexthop: freeing bnc %s",
- bnc_str(bnc, buf, INET6_ADDRSTRLEN));
+ bnc_str(bnc, buf, PREFIX2STR_BUFFER));
}
unregister_zebra_rnh(bnc, CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE));
bnc->node->info = NULL;
@@ -161,10 +161,10 @@ bgp_find_or_add_nexthop (struct bgp *bgp, afi_t afi, struct bgp_info *ri,
bgp_lock_node(rn);
if (BGP_DEBUG(nht, NHT))
{
- char buf[INET6_ADDRSTRLEN];
+ char buf[PREFIX2STR_BUFFER];
zlog_debug("Allocated bnc %s peer %p",
- bnc_str(bnc, buf, INET6_ADDRSTRLEN), peer);
+ bnc_str(bnc, buf, PREFIX2STR_BUFFER), peer);
}
}
@@ -343,8 +343,8 @@ bgp_parse_nexthop_update (int command, vrf_id_t vrf_id)
{
if (BGP_DEBUG(nht, NHT))
{
- char buf[INET6_ADDRSTRLEN];
- prefix2str(&p, buf, INET6_ADDRSTRLEN);
+ char buf[PREFIX2STR_BUFFER];
+ prefix2str(&p, buf, sizeof(buf));
zlog_debug("parse nexthop update(%s): rn not found", buf);
}
if (rn)
@@ -362,8 +362,8 @@ bgp_parse_nexthop_update (int command, vrf_id_t vrf_id)
/* debug print the input */
if (BGP_DEBUG(nht, NHT))
{
- char buf[INET6_ADDRSTRLEN];
- prefix2str(&p, buf, INET6_ADDRSTRLEN);
+ char buf[PREFIX2STR_BUFFER];
+ prefix2str(&p, buf, sizeof (buf));
zlog_debug("parse nexthop update(%s): metric=%d, #nexthop=%d", buf,
metric, nexthop_num);
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index c06d27f35..6ad5ec5c9 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1506,7 +1506,7 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn,
struct bgp_info *nextri = NULL;
int paths_eq, do_mpath, debug;
struct list mp_list;
- char pfx_buf[INET6_ADDRSTRLEN];
+ char pfx_buf[PREFIX2STR_BUFFER];
bgp_mp_list_init (&mp_list);
do_mpath = (mpath_cfg->maxpaths_ebgp > 1 || mpath_cfg->maxpaths_ibgp > 1);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 2c75a6e7e..add8a6684 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -2507,7 +2507,7 @@ bgp_config_write_listen (struct vty *vty, struct bgp *bgp)
struct listnode *node, *nnode, *rnode, *nrnode;
struct prefix *range;
afi_t afi;
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT)
vty_out (vty, " bgp listen limit %d%s",
@@ -9210,7 +9210,7 @@ static void
bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json, json_object *json_neigh)
{
struct bgp *bgp;
- char buf1[BUFSIZ], buf[SU_ADDRSTRLEN];
+ char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN];
char timebuf[BGP_UPTIME_LEN];
char dn_flag[2];
const char *subcode_str;
@@ -11022,7 +11022,7 @@ bgp_show_one_peer_group (struct vty *vty, struct peer_group *group)
struct prefix *range;
struct peer *conf;
struct peer *peer;
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
afi_t afi;
safi_t safi;
const char *peer_status;
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 70d59a3e2..07532d93f 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -103,7 +103,7 @@ bgp_router_id_update (int command, struct zclient *zclient, zebra_size_t length,
if (BGP_DEBUG (zebra, ZEBRA))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(&router_id, buf, sizeof(buf));
zlog_debug("Zebra rcvd: router id update %s", buf);
}
@@ -333,7 +333,7 @@ bgp_interface_address_add (int command, struct zclient *zclient,
if (bgp_debug_zebra(ifc->address))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(ifc->address, buf, sizeof(buf));
zlog_debug("Zebra rcvd: interface %s address add %s",
ifc->ifp->name, buf);
@@ -367,7 +367,7 @@ bgp_interface_address_delete (int command, struct zclient *zclient,
if (bgp_debug_zebra(ifc->address))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(ifc->address, buf, sizeof(buf));
zlog_debug("Zebra rcvd: interface %s address delete %s",
ifc->ifp->name, buf);
@@ -394,7 +394,7 @@ bgp_interface_nbr_address_add (int command, struct zclient *zclient,
if (bgp_debug_zebra(ifc->address))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(ifc->address, buf, sizeof(buf));
zlog_debug("Zebra rcvd: interface %s nbr address add %s",
ifc->ifp->name, buf);
@@ -419,7 +419,7 @@ bgp_interface_nbr_address_delete (int command, struct zclient *zclient,
if (bgp_debug_zebra(ifc->address))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(ifc->address, buf, sizeof(buf));
zlog_debug("Zebra rcvd: interface %s nbr address delete %s",
ifc->ifp->name, buf);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 6ab70e630..e5e7fe726 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2483,7 +2483,7 @@ peer_group_listen_range_del (struct peer_group *group, struct prefix *range)
struct listnode *node, *nnode;
struct peer *peer;
afi_t afi;
- char buf[SU_ADDRSTRLEN];
+ char buf[PREFIX2STR_BUFFER];
afi = family2afi(range->family);
@@ -3229,8 +3229,8 @@ peer_lookup_dynamic_neighbor (struct bgp *bgp, union sockunion *su)
struct prefix *prefix;
struct prefix *listen_range;
int dncount;
- char buf[SU_ADDRSTRLEN];
- char buf1[SU_ADDRSTRLEN];
+ char buf[PREFIX2STR_BUFFER];
+ char buf1[PREFIX2STR_BUFFER];
prefix = sockunion2hostprefix(su);
if (!prefix) {
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 470a86e39..ca8f96484 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -225,12 +225,11 @@ isis_circuit_add_addr (struct isis_circuit *circuit,
{
struct listnode *node;
struct prefix_ipv4 *ipv4;
- u_char buf[BUFSIZ];
-#ifdef HAVE_IPV6
+#if defined(EXTREME_DEBUG)
+ char buf[PREFIX2STR_BUFFER];
+#endif
struct prefix_ipv6 *ipv6;
-#endif /* HAVE_IPV6 */
- memset (&buf, 0, BUFSIZ);
if (connected->address->family == AF_INET)
{
u_int32_t addr = connected->address->u.prefix4.s_addr;
@@ -253,12 +252,11 @@ isis_circuit_add_addr (struct isis_circuit *circuit,
lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
#ifdef EXTREME_DEBUG
- prefix2str (connected->address, buf, BUFSIZ);
+ prefix2str (connected->address, buf, sizeof (buf));
zlog_debug ("Added IP address %s to circuit %d", buf,
circuit->circuit_id);
#endif /* EXTREME_DEBUG */
}
-#ifdef HAVE_IPV6
if (connected->address->family == AF_INET6)
{
if (IN6_IS_ADDR_LOOPBACK(&connected->address->u.prefix6))
@@ -283,12 +281,11 @@ isis_circuit_add_addr (struct isis_circuit *circuit,
lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
#ifdef EXTREME_DEBUG
- prefix2str (connected->address, buf, BUFSIZ);
+ prefix2str (connected->address, buf, sizeof (buf));
zlog_debug ("Added IPv6 address %s to circuit %d", buf,
circuit->circuit_id);
#endif /* EXTREME_DEBUG */
}
-#endif /* HAVE_IPV6 */
return;
}
@@ -298,13 +295,12 @@ isis_circuit_del_addr (struct isis_circuit *circuit,
{
struct prefix_ipv4 *ipv4, *ip = NULL;
struct listnode *node;
- u_char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
#ifdef HAVE_IPV6
struct prefix_ipv6 *ipv6, *ip6 = NULL;
int found = 0;
#endif /* HAVE_IPV6 */
- memset (&buf, 0, BUFSIZ);
if (connected->address->family == AF_INET)
{
ipv4 = prefix_ipv4_new ();
@@ -323,7 +319,7 @@ isis_circuit_del_addr (struct isis_circuit *circuit,
}
else
{
- prefix2str (connected->address, (char *)buf, BUFSIZ);
+ prefix2str (connected->address, buf, sizeof (buf));
zlog_warn ("Nonexitant ip address %s removal attempt from \
circuit %d", buf, circuit->circuit_id);
}
@@ -366,7 +362,7 @@ isis_circuit_del_addr (struct isis_circuit *circuit,
if (!found)
{
- prefix2str (connected->address, (char *)buf, BUFSIZ);
+ prefix2str (connected->address, buf, sizeof (buf));
zlog_warn ("Nonexitant ip address %s removal attempt from \
circuit %d", buf, circuit->circuit_id);
}
@@ -937,11 +933,11 @@ isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
{
struct listnode *node;
struct prefix *ip_addr;
- u_char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
vty_out (vty, " IP Prefix(es):%s", VTY_NEWLINE);
for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip_addr))
{
- prefix2str (ip_addr, (char*)buf, BUFSIZ),
+ prefix2str (ip_addr, buf, sizeof (buf)),
vty_out (vty, " %s%s", buf, VTY_NEWLINE);
}
}
diff --git a/isisd/isis_route.c b/isisd/isis_route.c
index 8ab470cef..0e9225669 100644
--- a/isisd/isis_route.c
+++ b/isisd/isis_route.c
@@ -416,12 +416,12 @@ isis_route_create (struct prefix *prefix, u_int32_t cost, u_int32_t depth,
{
struct route_node *route_node;
struct isis_route_info *rinfo_new, *rinfo_old, *route_info = NULL;
- u_char buff[BUFSIZ];
+ char buff[PREFIX2STR_BUFFER];
u_char family;
family = prefix->family;
/* for debugs */
- prefix2str (prefix, (char *) buff, BUFSIZ);
+ prefix2str (prefix, buff, sizeof (buff));
rinfo_new = isis_route_info_new (prefix, cost, depth, adjacencies);
if (!rinfo_new)
@@ -486,10 +486,10 @@ isis_route_delete (struct prefix *prefix, struct route_table *table)
{
struct route_node *rode;
struct isis_route_info *rinfo;
- char buff[BUFSIZ];
+ char buff[PREFIX2STR_BUFFER];
/* for log */
- prefix2str (prefix, buff, BUFSIZ);
+ prefix2str (prefix, buff, sizeof (buff));
rode = route_node_get (table, prefix);
@@ -521,7 +521,7 @@ isis_route_validate_table (struct isis_area *area, struct route_table *table)
{
struct route_node *rnode, *drnode;
struct isis_route_info *rinfo;
- u_char buff[BUFSIZ];
+ char buff[PREFIX2STR_BUFFER];
for (rnode = route_top (table); rnode; rnode = route_next (rnode))
{
@@ -531,7 +531,7 @@ isis_route_validate_table (struct isis_area *area, struct route_table *table)
if (isis->debugs & DEBUG_RTE_EVENTS)
{
- prefix2str (&rnode->p, (char *) buff, BUFSIZ);
+ prefix2str (&rnode->p, buff, sizeof (buff));
zlog_debug ("ISIS-Rte (%s): route validate: %s %s %s %s",
area->area_tag,
(CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED) ?
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 0d2ebaf3b..81c1f457c 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -154,7 +154,7 @@ vtype2string (enum vertextype vtype)
}
static const char *
-vid2string (struct isis_vertex *vertex, u_char * buff)
+vid2string (struct isis_vertex *vertex, char * buff, int size)
{
switch (vertex->type)
{
@@ -174,7 +174,7 @@ vid2string (struct isis_vertex *vertex, u_char * buff)
case VTYPE_IP6REACH_INTERNAL:
case VTYPE_IP6REACH_EXTERNAL:
#endif /* HAVE_IPV6 */
- prefix2str ((struct prefix *) &vertex->N.prefix, (char *) buff, BUFSIZ);
+ prefix2str ((struct prefix *) &vertex->N.prefix, buff, size);
break;
default:
return "UNKNOWN";
@@ -430,7 +430,7 @@ isis_spf_add_root (struct isis_spftree *spftree, int level, u_char *sysid)
struct isis_vertex *vertex;
struct isis_lsp *lsp;
#ifdef EXTREME_DEBUG
- u_char buff[BUFSIZ];
+ char buff[PREFIX2STR_BUFFER];
#endif /* EXTREME_DEBUG */
lsp = isis_root_system_lsp (spftree->area, level, sysid);
@@ -446,7 +446,7 @@ isis_spf_add_root (struct isis_spftree *spftree, int level, u_char *sysid)
#ifdef EXTREME_DEBUG
zlog_debug ("ISIS-Spf: added this IS %s %s depth %d dist %d to PATHS",
- vtype2string (vertex->type), vid2string (vertex, buff),
+ vtype2string (vertex->type), vid2string (vertex, buff, sizeof (buff)),
vertex->depth, vertex->d_N);
#endif /* EXTREME_DEBUG */
@@ -509,7 +509,7 @@ isis_spf_add2tent (struct isis_spftree *spftree, enum vertextype vtype,
struct listnode *node;
struct isis_adjacency *parent_adj;
#ifdef EXTREME_DEBUG
- u_char buff[BUFSIZ];
+ char buff[PREFIX2STR_BUFFER];
#endif
assert (isis_find_vertex (spftree->paths, id, vtype) == NULL);
@@ -534,7 +534,7 @@ isis_spf_add2tent (struct isis_spftree *spftree, enum vertextype vtype,
#ifdef EXTREME_DEBUG
zlog_debug ("ISIS-Spf: add to TENT %s %s %s depth %d dist %d adjcount %d",
print_sys_hostname (vertex->N.id),
- vtype2string (vertex->type), vid2string (vertex, buff),
+ vtype2string (vertex->type), vid2string (vertex, buff, sizeof (buff)),
vertex->depth, vertex->d_N, listcount(vertex->Adj_N));
#endif /* EXTREME_DEBUG */
@@ -620,7 +620,7 @@ process_N (struct isis_spftree *spftree, enum vertextype vtype, void *id,
{
struct isis_vertex *vertex;
#ifdef EXTREME_DEBUG
- u_char buff[255];
+ char buff[PREFIX2STR_BUFFER];
#endif
assert (spftree && parent);
@@ -645,7 +645,7 @@ process_N (struct isis_spftree *spftree, enum vertextype vtype, void *id,
#ifdef EXTREME_DEBUG
zlog_debug ("ISIS-Spf: process_N %s %s %s dist %d already found from PATH",
print_sys_hostname (vertex->N.id),
- vtype2string (vtype), vid2string (vertex, buff), dist);
+ vtype2string (vtype), vid2string (vertex, buff, sizeof (buff)), dist);
#endif /* EXTREME_DEBUG */
assert (dist >= vertex->d_N);
return;
@@ -659,7 +659,7 @@ process_N (struct isis_spftree *spftree, enum vertextype vtype, void *id,
#ifdef EXTREME_DEBUG
zlog_debug ("ISIS-Spf: process_N %s %s %s dist %d parent %s adjcount %d",
print_sys_hostname (vertex->N.id),
- vtype2string (vtype), vid2string (vertex, buff), dist,
+ vtype2string (vtype), vid2string (vertex, buff, sizeof (buff)), dist,
(parent ? print_sys_hostname (parent->N.id) : "null"),
(parent ? listcount (parent->Adj_N) : 0));
#endif /* EXTREME_DEBUG */
@@ -1132,7 +1132,7 @@ static void
add_to_paths (struct isis_spftree *spftree, struct isis_vertex *vertex,
int level)
{
- u_char buff[BUFSIZ];
+ char buff[PREFIX2STR_BUFFER];
if (isis_find_vertex (spftree->paths, vertex->N.id, vertex->type))
return;
@@ -1141,7 +1141,7 @@ add_to_paths (struct isis_spftree *spftree, struct isis_vertex *vertex,
#ifdef EXTREME_DEBUG
zlog_debug ("ISIS-Spf: added %s %s %s depth %d dist %d to PATHS",
print_sys_hostname (vertex->N.id),
- vtype2string (vertex->type), vid2string (vertex, buff),
+ vtype2string (vertex->type), vid2string (vertex, buff, sizeof (buff)),
vertex->depth, vertex->d_N);
#endif /* EXTREME_DEBUG */
@@ -1152,7 +1152,7 @@ add_to_paths (struct isis_spftree *spftree, struct isis_vertex *vertex,
vertex->depth, vertex->Adj_N, spftree->area, level);
else if (isis->debugs & DEBUG_SPF_EVENTS)
zlog_debug ("ISIS-Spf: no adjacencies do not install route for "
- "%s depth %d dist %d", vid2string (vertex, buff),
+ "%s depth %d dist %d", vid2string (vertex, buff, sizeof (buff)),
vertex->depth, vertex->d_N);
}
@@ -1492,7 +1492,7 @@ isis_print_paths (struct vty *vty, struct list *paths, u_char *root_sysid)
struct listnode *anode;
struct isis_vertex *vertex;
struct isis_adjacency *adj;
- u_char buff[BUFSIZ];
+ char buff[PREFIX2STR_BUFFER];
vty_out (vty, "Vertex Type Metric "
"Next-Hop Interface Parent%s", VTY_NEWLINE);
@@ -1504,7 +1504,7 @@ isis_print_paths (struct vty *vty, struct list *paths, u_char *root_sysid)
vty_out (vty, "%-30s", "");
} else {
int rows = 0;
- vty_out (vty, "%-20s %-12s %-6u ", vid2string (vertex, buff),
+ vty_out (vty, "%-20s %-12s %-6u ", vid2string (vertex, buff, sizeof (buff)),
vtype2string (vertex->type), vertex->d_N);
for (ALL_LIST_ELEMENTS_RO (vertex->Adj_N, anode, adj)) {
if (adj) {
@@ -1533,25 +1533,13 @@ isis_print_paths (struct vty *vty, struct list *paths, u_char *root_sysid)
vty_out (vty, "%-72s", "");
}
vty_out (vty, "%s(%d)",
- vid2string (pvertex, buff), pvertex->type);
+ vid2string (pvertex, buff, sizeof (buff)), pvertex->type);
++rows;
}
} else {
vty_out (vty, " NULL ");
}
-#if 0
- if (listcount (vertex->children) > 0) {
- struct listnode *cnode;
- struct isis_vertex *cvertex;
- for (ALL_LIST_ELEMENTS_RO (vertex->children, cnode, cvertex)) {
- vty_out (vty, "%s", VTY_NEWLINE);
- vty_out (vty, "%-72s", "");
- vty_out (vty, "%s(%d) ",
- vid2string (cvertex, buff), cvertex->type);
- }
- }
-#endif
vty_out (vty, "%s", VTY_NEWLINE);
}
}
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index 27c2c92d0..86e6692e1 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -163,7 +163,7 @@ isis_zebra_if_address_add (int command, struct zclient *zclient,
{
struct connected *c;
struct prefix *p;
- char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD,
zclient->ibuf, vrf_id);
@@ -173,7 +173,7 @@ isis_zebra_if_address_add (int command, struct zclient *zclient,
p = c->address;
- prefix2str (p, buf, BUFSIZ);
+ prefix2str (p, buf, sizeof (buf));
#ifdef EXTREME_DEBUG
if (p->family == AF_INET)
zlog_debug ("connected IP address %s", buf);
@@ -196,7 +196,7 @@ isis_zebra_if_address_del (int command, struct zclient *client,
struct interface *ifp;
#ifdef EXTREME_DEBUG
struct prefix *p;
- u_char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
#endif /* EXTREME_DEBUG */
c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE,
@@ -209,7 +209,7 @@ isis_zebra_if_address_del (int command, struct zclient *client,
#ifdef EXTREME_DEBUG
p = c->address;
- prefix2str (p, buf, BUFSIZ);
+ prefix2str (p, buf, sizeof (buf));
if (p->family == AF_INET)
zlog_debug ("disconnected IP address %s", buf);
diff --git a/lib/prefix.c b/lib/prefix.c
index 43331d155..5f188f09f 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -770,10 +770,11 @@ const char *
prefix2str (union prefix46constptr pu, char *str, int size)
{
const struct prefix *p = pu.p;
- char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
- inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ);
- snprintf (str, size, "%s/%d", buf, p->prefixlen);
+ snprintf (str, size, "%s/%d",
+ inet_ntop (p->family, &p->u.prefix, buf, PREFIX2STR_BUFFER),
+ p->prefixlen);
return str;
}
diff --git a/lib/prefix.h b/lib/prefix.h
index 7fef37e3f..feacc2ae2 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -179,6 +179,14 @@ extern void prefix_free (struct prefix *);
extern const char *prefix_family_str (const struct prefix *);
extern int prefix_blen (const struct prefix *);
extern int str2prefix (const char *, struct prefix *);
+
+/*
+ * 8 groups of 4 bytes of hexadecimal + 7 seperators is 39
+ * /128 = 4 bytes
+ * Null = 1 byte
+ * 39 + 4 + 1 = 44 bytes
+ */
+#define PREFIX2STR_BUFFER 44
extern const char *prefix2str (union prefix46constptr, char *, int);
extern int prefix_match (const struct prefix *, const struct prefix *);
extern int prefix_same (const struct prefix *, const struct prefix *);
diff --git a/lib/zclient.c b/lib/zclient.c
index 512abc24d..351bfa99d 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1022,7 +1022,7 @@ zebra_interface_address_read (int type, struct stream *s, vrf_id_t vrf_id)
else if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER))
{
/* carp interfaces on OpenBSD with 0.0.0.0/0 as "peer" */
- char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
prefix2str (ifc->address, buf, sizeof(buf));
zlog_warn("warning: interface %s address %s "
"with peer flag set, but no peer address!",
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 33299f489..fa3df6856 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -159,7 +159,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route,
struct ospf6_inter_router_lsa *router_lsa;
struct ospf6_route_table *summary_table = NULL;
u_int16_t type;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
int is_debug = 0;
/* Only destination type network, range or ASBR are considered */
@@ -722,7 +722,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
u_int8_t prefix_options = 0;
u_int32_t cost = 0;
u_char router_bits = 0;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
int is_debug = 0;
struct ospf6_inter_prefix_lsa *prefix_lsa = NULL;
struct ospf6_inter_router_lsa *router_lsa = NULL;
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index 71787541e..6cdab1771 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -590,7 +590,7 @@ ospf6_area_config_write (struct vty *vty)
struct listnode *node;
struct ospf6_area *oa;
struct ospf6_route *range;
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
{
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 9f5337cc6..1207419e5 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -62,7 +62,7 @@ ospf6_as_external_lsa_originate (struct ospf6_route *route)
struct ospf6_external_info *info = route->route_option;
struct ospf6_as_external_lsa *as_external_lsa;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
caddr_t p;
if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE (AS_EXTERNAL))
@@ -153,7 +153,7 @@ ospf6_asbr_lsa_add (struct ospf6_lsa *lsa)
struct ospf6_as_external_lsa *external;
struct prefix asbr_id;
struct ospf6_route *asbr_entry, *route;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
external = (struct ospf6_as_external_lsa *)
OSPF6_LSA_HEADER_END (lsa->header);
@@ -239,7 +239,7 @@ ospf6_asbr_lsa_remove (struct ospf6_lsa *lsa)
struct ospf6_as_external_lsa *external;
struct prefix prefix;
struct ospf6_route *route, *nroute;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
external = (struct ospf6_as_external_lsa *)
OSPF6_LSA_HEADER_END (lsa->header);
@@ -436,7 +436,7 @@ ospf6_asbr_redistribute_add (int type, int ifindex, struct prefix *prefix,
struct ospf6_external_info *info;
struct prefix prefix_id;
struct route_node *node;
- char pbuf[64], ibuf[16];
+ char pbuf[PREFIX2STR_BUFFER], ibuf[16];
struct listnode *lnode, *lnnode;
struct ospf6_area *oa;
@@ -582,7 +582,7 @@ ospf6_asbr_redistribute_remove (int type, int ifindex, struct prefix *prefix)
struct route_node *node;
struct ospf6_lsa *lsa;
struct prefix prefix_id;
- char pbuf[64], ibuf[16];
+ char pbuf[PREFIX2STR_BUFFER], ibuf[16];
struct listnode *lnode, *lnnode;
struct ospf6_area *oa;
@@ -1286,7 +1286,7 @@ static void
ospf6_asbr_external_route_show (struct vty *vty, struct ospf6_route *route)
{
struct ospf6_external_info *info = route->route_option;
- char prefix[64], id[16], forwarding[64];
+ char prefix[PREFIX2STR_BUFFER], id[16], forwarding[64];
u_int32_t tmp_id;
prefix2str (&route->prefix, prefix, sizeof (prefix));
diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c
index f2bc52aff..25bacd0d2 100644
--- a/ospf6d/ospf6_bfd.c
+++ b/ospf6d/ospf6_bfd.c
@@ -210,7 +210,7 @@ ospf6_bfd_interface_dest_update (int command, struct zclient *zclient,
if (IS_OSPF6_DEBUG_ZEBRA (RECV))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(&dp, buf, sizeof(buf));
zlog_debug("Zebra: interface %s bfd destination %s %s", ifp->name, buf,
bfd_get_status_str(status));
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 4b7745a62..7c2dcf53f 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -430,7 +430,7 @@ ospf6_interface_connected_route_update (struct interface *ifp)
{
struct prefix_list *plist;
enum prefix_list_type ret;
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str (c->address, buf, sizeof (buf));
plist = prefix_list_lookup (AFI_IP6, oi->plist_name);
@@ -868,7 +868,7 @@ ospf6_interface_show (struct vty *vty, struct interface *ifp)
struct connected *c;
struct prefix *p;
struct listnode *i;
- char strbuf[64], drouter[32], bdrouter[32];
+ char strbuf[PREFIX2STR_BUFFER], drouter[32], bdrouter[32];
const char *updown[3] = {"down", "up", NULL};
const char *type;
struct timeval res, now;
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index 5494c4a32..1e8c6f3d9 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -906,7 +906,7 @@ ospf6_intra_prefix_lsa_originate_stub (struct thread *thread)
struct listnode *i, *j;
int full_count = 0;
unsigned short prefix_num = 0;
- char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
struct ospf6_route_table *route_advertise;
oa = (struct ospf6_area *) THREAD_ARG (thread);
@@ -1059,7 +1059,7 @@ ospf6_intra_prefix_lsa_originate_transit (struct thread *thread)
struct ospf6_link_lsa *link_lsa;
char *start, *end, *current;
u_int16_t type;
- char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
oi = (struct ospf6_interface *) THREAD_ARG (thread);
oi->thread_intra_prefix_lsa = NULL;
@@ -1245,7 +1245,7 @@ ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa)
int prefix_num;
struct ospf6_prefix *op;
char *start, *current, *end;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
struct interface *ifp;
int direct_connect = 0;
@@ -1368,7 +1368,7 @@ ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa)
int prefix_num;
struct ospf6_prefix *op;
char *start, *current, *end;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
zlog_debug ("%s disappearing", lsa->name);
diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h
index 940a0f705..a95891ac5 100644
--- a/ospf6d/ospf6_lsa.h
+++ b/ospf6d/ospf6_lsa.h
@@ -165,7 +165,7 @@ extern vector ospf6_lsa_handler_vector;
#define CONTINUE_IF_ADDRESS_LINKLOCAL(debug,addr) \
if (IN6_IS_ADDR_LINKLOCAL (&(addr)->u.prefix6)) \
{ \
- char buf[64]; \
+ char buf[PREFIX2STR_BUFFER]; \
prefix2str (addr, buf, sizeof (buf)); \
if (debug) \
zlog_debug ("Filter out Linklocal: %s", buf); \
@@ -175,7 +175,7 @@ extern vector ospf6_lsa_handler_vector;
#define CONTINUE_IF_ADDRESS_UNSPECIFIED(debug,addr) \
if (IN6_IS_ADDR_UNSPECIFIED (&(addr)->u.prefix6)) \
{ \
- char buf[64]; \
+ char buf[PREFIX2STR_BUFFER]; \
prefix2str (addr, buf, sizeof (buf)); \
if (debug) \
zlog_debug ("Filter out Unspecified: %s", buf);\
@@ -185,7 +185,7 @@ extern vector ospf6_lsa_handler_vector;
#define CONTINUE_IF_ADDRESS_LOOPBACK(debug,addr) \
if (IN6_IS_ADDR_LOOPBACK (&(addr)->u.prefix6)) \
{ \
- char buf[64]; \
+ char buf[PREFIX2STR_BUFFER]; \
prefix2str (addr, buf, sizeof (buf)); \
if (debug) \
zlog_debug ("Filter out Loopback: %s", buf); \
@@ -195,7 +195,7 @@ extern vector ospf6_lsa_handler_vector;
#define CONTINUE_IF_ADDRESS_V4COMPAT(debug,addr) \
if (IN6_IS_ADDR_V4COMPAT (&(addr)->u.prefix6)) \
{ \
- char buf[64]; \
+ char buf[PREFIX2STR_BUFFER]; \
prefix2str (addr, buf, sizeof (buf)); \
if (debug) \
zlog_debug ("Filter out V4Compat: %s", buf); \
@@ -205,7 +205,7 @@ extern vector ospf6_lsa_handler_vector;
#define CONTINUE_IF_ADDRESS_V4MAPPED(debug,addr) \
if (IN6_IS_ADDR_V4MAPPED (&(addr)->u.prefix6)) \
{ \
- char buf[64]; \
+ char buf[PREFIX2STR_BUFFER]; \
prefix2str (addr, buf, sizeof (buf)); \
if (debug) \
zlog_debug ("Filter out V4Mapped: %s", buf); \
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index 37259d6c7..c73d6923f 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -238,7 +238,7 @@ ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, u_int32_t adv_router,
p = (struct prefix *) &key;
{
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
prefix2str (p, buf, sizeof (buf));
zlog_debug ("lsdb_lookup_next: key: %s", buf);
}
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 38fc0c505..86c908bb3 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -532,7 +532,7 @@ static void
route_table_assert (struct ospf6_route_table *table)
{
struct ospf6_route *prev, *r, *next;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
unsigned int link_error = 0, num = 0;
r = ospf6_route_head (table);
@@ -582,7 +582,7 @@ ospf6_route_add (struct ospf6_route *route,
struct route_node *node, *nextnode, *prevnode;
struct ospf6_route *current = NULL;
struct ospf6_route *prev = NULL, *old = NULL, *next = NULL;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
struct timeval now;
assert (route->rnode == NULL);
@@ -803,7 +803,7 @@ ospf6_route_remove (struct ospf6_route *route,
{
struct route_node *node;
struct ospf6_route *current;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
if (route->type == OSPF6_DEST_TYPE_LINKSTATE)
ospf6_linkstate_prefix2str (&route->prefix, buf, sizeof (buf));
@@ -1009,7 +1009,7 @@ void
ospf6_route_show (struct vty *vty, struct ospf6_route *route)
{
int i;
- char destination[64], nexthop[64];
+ char destination[PREFIX2STR_BUFFER], nexthop[64];
char duration[16], ifname[IFNAMSIZ];
struct timeval now, res;
struct listnode *node;
@@ -1057,7 +1057,7 @@ ospf6_route_show (struct vty *vty, struct ospf6_route *route)
void
ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route)
{
- char destination[64], nexthop[64], ifname[IFNAMSIZ];
+ char destination[PREFIX2STR_BUFFER], nexthop[64], ifname[IFNAMSIZ];
char area_id[16], id[16], adv_router[16], capa[16], options[16];
struct timeval now, res;
char duration[16];
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 7b756d152..3fbc4d9c8 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -256,7 +256,7 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient,
if (IS_OSPF6_DEBUG_ZEBRA (RECV))
{
- char prefixstr[128], nexthopstr[128];
+ char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128];
prefix2str ((struct prefix *)&p, prefixstr, sizeof (prefixstr));
if (nexthop)
inet_ntop (AF_INET6, nexthop, nexthopstr, sizeof (nexthopstr));
@@ -368,7 +368,7 @@ static void
ospf6_zebra_route_update (int type, struct ospf6_route *request)
{
struct zapi_ipv6 api;
- char buf[64];
+ char buf[PREFIX2STR_BUFFER];
int nhcount;
struct in6_addr **nexthops;
unsigned int *ifindexes;
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index ca1af2c4a..3f3f5356d 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -771,7 +771,7 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
if (!lsa)
{
- char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
+ char buf[PREFIX2STR_BUFFER];
prefix2str ((struct prefix *) p, buf, sizeof(buf));
zlog_warn ("%s: Could not refresh %s to %s",
@@ -795,7 +795,7 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
if (!lsa)
{
- char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
+ char buf[PREFIX2STR_BUFFER];
prefix2str ((struct prefix *)p, buf, sizeof(buf));
zlog_warn ("%s: Could not originate %s to %s",
@@ -1162,7 +1162,7 @@ ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost,
lsa = ospf_summary_asbr_lsa_originate (p, cost, area);
if (!lsa)
{
- char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
+ char buf[PREFIX2STR_BUFFER];
prefix2str ((struct prefix *)p, buf, sizeof(buf));
zlog_warn ("%s: Could not refresh/originate %s to %s",
diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c
index 6c0ef37ef..41a2c1392 100644
--- a/ospfd/ospf_bfd.c
+++ b/ospfd/ospf_bfd.c
@@ -221,7 +221,7 @@ ospf_bfd_interface_dest_update (int command, struct zclient *zclient,
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(&p, buf, sizeof(buf));
zlog_debug("Zebra: interface %s bfd destination %s %s", ifp->name, buf,
bfd_get_status_str(status));
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 0d77e8d3a..b5980072a 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -70,7 +70,7 @@ ospf_router_id_update_zebra (int command, struct zclient *zclient,
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(&router_id, buf, sizeof(buf));
zlog_debug("Zebra rcvd: router id update %s", buf);
}
@@ -266,7 +266,7 @@ ospf_interface_address_add (int command, struct zclient *zclient,
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(c->address, buf, sizeof(buf));
zlog_debug("Zebra: interface %s address add %s", c->ifp->name, buf);
}
@@ -297,7 +297,7 @@ ospf_interface_address_delete (int command, struct zclient *zclient,
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
{
- char buf[128];
+ char buf[PREFIX2STR_BUFFER];
prefix2str(c->address, buf, sizeof(buf));
zlog_debug("Zebra: interface %s address delete %s", c->ifp->name, buf);
}
diff --git a/tests/table_test.c b/tests/table_test.c
index fc9cc3dd9..ee8192707 100644
--- a/tests/table_test.c
+++ b/tests/table_test.c
@@ -112,7 +112,7 @@ add_nodes (struct route_table *table, ...)
static void
print_subtree (struct route_node *rn, const char *legend, int indent_level)
{
- char buf[INET_ADDRSTRLEN + 4];
+ char buf[PREFIX2STR_BUFFER];
int i;
/*
@@ -236,7 +236,7 @@ verify_next (struct route_table *table, const char *target, const char *next)
{
struct prefix_ipv4 target_pfx, next_pfx;
struct route_node *rn;
- char result_buf[INET_ADDRSTRLEN + 4];
+ char result_buf[PREFIX2STR_BUFFER];
if (str2prefix_ipv4 (target, &target_pfx) <= 0)
{
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 7b4f70fa8..a7179ff4b 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -868,7 +868,7 @@ rtm_read (struct rt_msghdr *rtm)
*/
if (rtm->rtm_type != RTM_GET && rtm->rtm_pid == pid)
{
- char buf[INET_ADDRSTRLEN], gate_buf[INET_ADDRSTRLEN];
+ char buf[PREFIX2STR_BUFFER], gate_buf[INET_ADDRSTRLEN];
int ret;
if (! IS_ZEBRA_DEBUG_RIB)
return;
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 5640168de..4cfb7f800 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -956,7 +956,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h,
if (IS_ZEBRA_DEBUG_KERNEL)
{
- char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
zlog_debug ("%s %s vrf %u",
h->nlmsg_type == RTM_NEWROUTE ? "RTM_NEWROUTE" : "RTM_DELROUTE",
prefix2str (&p, buf, sizeof(buf)), vrf_id);
@@ -1035,7 +1035,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h,
if (rtm->rtm_family == AF_INET6)
{
struct prefix_ipv6 p;
- char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
p.family = AF_INET6;
memcpy (&p.prefix, dest, 16);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index d1f679361..fd2a2a947 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2267,7 +2267,7 @@ void _rib_dump (const char * func,
union prefix46constptr pp, const struct rib * rib)
{
const struct prefix *p = pp.p;
- char straddr[INET6_ADDRSTRLEN];
+ char straddr[PREFIX2STR_BUFFER];
struct nexthop *nexthop, *tnexthop;
int recursing;
@@ -2518,7 +2518,7 @@ rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p,
struct rib *same = NULL;
struct nexthop *nexthop, *tnexthop;
int recursing;
- char buf1[INET6_ADDRSTRLEN];
+ char buf1[PREFIX2STR_BUFFER];
char buf2[INET6_ADDRSTRLEN];
/* Lookup table. */
@@ -3338,7 +3338,7 @@ rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
struct rib *same = NULL;
struct nexthop *nexthop, *tnexthop;
int recursing;
- char buf1[INET6_ADDRSTRLEN];
+ char buf1[PREFIX2STR_BUFFER];
char buf2[INET6_ADDRSTRLEN];
/* Apply mask. */
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 76b038d1b..1a1f41702 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -105,8 +105,8 @@ zebra_add_rnh (struct prefix *p, vrf_id_t vrfid, rnh_type_t type)
if (IS_ZEBRA_DEBUG_NHT)
{
- char buf[INET6_ADDRSTRLEN];
- prefix2str(p, buf, INET6_ADDRSTRLEN);
+ char buf[PREFIX2STR_BUFFER];
+ prefix2str(p, buf, sizeof (buf));
zlog_debug("add rnh %s in vrf %d", buf, vrfid);
}
table = get_rnh_table(vrfid, PREFIX_FAMILY(p), type);
@@ -168,8 +168,8 @@ zebra_delete_rnh (struct rnh *rnh, rnh_type_t type)
if (IS_ZEBRA_DEBUG_NHT)
{
- char buf[INET6_ADDRSTRLEN];
- zlog_debug("delete rnh %s", rnh_str(rnh, buf, INET6_ADDRSTRLEN));
+ char buf[PREFIX2STR_BUFFER];
+ zlog_debug("delete rnh %s", rnh_str(rnh, buf, sizeof (buf)));
}
rnh->flags |= ZEBRA_NHT_DELETED;
@@ -188,10 +188,10 @@ zebra_add_rnh_client (struct rnh *rnh, struct zserv *client, rnh_type_t type,
{
if (IS_ZEBRA_DEBUG_NHT)
{
- char buf[INET6_ADDRSTRLEN];
+ char buf[PREFIX2STR_BUFFER];
zlog_debug("client %s registers rnh %s",
zebra_route_string(client->proto),
- rnh_str(rnh, buf, INET6_ADDRSTRLEN));
+ rnh_str(rnh, buf, sizeof (buf)));
}
if (!listnode_lookup(rnh->client_list, client))
{
@@ -205,10 +205,10 @@ zebra_remove_rnh_client (struct rnh *rnh, struct zserv *client, rnh_type_t type)
{
if (IS_ZEBRA_DEBUG_NHT)
{
- char buf[INET6_ADDRSTRLEN];
+ char buf[PREFIX2STR_BUFFER];
zlog_debug("client %s unregisters rnh %s",
zebra_route_string(client->proto),
- rnh_str(rnh, buf, INET6_ADDRSTRLEN));
+ rnh_str(rnh, buf, sizeof (buf)));
}
listnode_delete(rnh->client_list, client);
if (list_isempty(rnh->client_list) &&
@@ -289,9 +289,9 @@ zebra_evaluate_rnh (vrf_id_t vrfid, int family, int force, rnh_type_t type,
struct rib *rib, *srib;
int state_changed = 0;
int at_least_one = 0;
- char bufn[INET6_ADDRSTRLEN];
- char bufp[INET6_ADDRSTRLEN];
- char bufs[INET6_ADDRSTRLEN];
+ char bufn[PREFIX2STR_BUFFER];
+ char bufp[PREFIX2STR_BUFFER];
+ char bufs[PREFIX2STR_BUFFER];
struct route_node *static_rn;
struct nexthop *nexthop, *tnexthop;
int recursing;
@@ -389,7 +389,7 @@ zebra_evaluate_rnh (vrf_id_t vrfid, int family, int force, rnh_type_t type,
{
if (IS_ZEBRA_DEBUG_NHT)
{
- prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
+ prefix2str(&nrn->p, bufn, sizeof (bufn));
zlog_debug("rnh import check %s for %s, notifying clients\n",
rnh->state ? "passed" : "failed", bufn);
}
@@ -434,9 +434,9 @@ zebra_evaluate_rnh (vrf_id_t vrfid, int family, int force, rnh_type_t type,
if (IS_ZEBRA_DEBUG_NHT && (state_changed || force))
{
- prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
+ prefix2str(&nrn->p, bufn, sizeof (bufn));
if (prn)
- prefix2str(&prn->p, bufp, INET6_ADDRSTRLEN);
+ prefix2str(&prn->p, bufp, sizeof (bufp));
else
strcpy(bufp, "null");
@@ -498,7 +498,7 @@ zebra_evaluate_rnh (vrf_id_t vrfid, int family, int force, rnh_type_t type,
{
if (IS_ZEBRA_DEBUG_NHT)
{
- prefix2str(&static_rn->p, bufs, INET6_ADDRSTRLEN);
+ prefix2str(&static_rn->p, bufs, sizeof (bufs));
zlog_debug("%s: Unable to find RIB for static route %s, skipping NH resolution",
__FUNCTION__, bufs);
continue;
@@ -593,8 +593,8 @@ zebra_dispatch_rnh_table (vrf_id_t vrf_id, int family, struct zserv *client,
rnh = nrn->info;
if (IS_ZEBRA_DEBUG_NHT)
{
- char bufn[INET6_ADDRSTRLEN];
- prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
+ char bufn[PREFIX2STR_BUFFER];
+ prefix2str(&nrn->p, bufn, sizeof (bufn));
zlog_debug("rnh %s - sending nexthop %s event to client %s", bufn,
rnh->state ? "reachable" : "unreachable",
zebra_route_string(client->proto));
@@ -645,8 +645,8 @@ zebra_cleanup_rnh_client (vrf_id_t vrfid, int family, struct zserv *client,
rnh = nrn->info;
if (IS_ZEBRA_DEBUG_NHT)
{
- char bufn[INET6_ADDRSTRLEN];
- prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
+ char bufn[PREFIX2STR_BUFFER];
+ prefix2str(&nrn->p, bufn, sizeof (bufn));
zlog_debug("rnh %s - cleaning state for client %s", bufn,
zebra_route_string(client->proto));
}
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index d786ae8e8..e85fc1069 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -5130,7 +5130,7 @@ static_config_ipv6 (struct vty *vty)
struct route_node *rn;
struct static_route *si;
int write;
- char buf[BUFSIZ];
+ char buf[PREFIX2STR_BUFFER];
struct route_table *stable;
struct zebra_vrf *zvrf;
vrf_iter_t iter;
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 87fa5ce49..0ef53251c 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -1044,8 +1044,8 @@ zserv_nexthop_num_warn (const char *caller, const struct prefix *p, const u_char
{
if (nexthop_num > MULTIPATH_NUM)
{
- char buff[80];
- prefix2str(p, buff, 80);
+ char buff[PREFIX2STR_BUFFER];
+ prefix2str(p, buff, sizeof (buff));
zlog_warn("%s: Prefix %s has %d nexthops, but we can only use the first %d",
caller, buff, nexthop_num, MULTIPATH_NUM);
}