summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-11-23 21:44:34 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-11-23 22:31:11 +0100
commit4690c7d74c8d3f08ac3c4c73918c847a9dd862b4 (patch)
tree55e97b177d0b5c153f8390342660a412d5e33a19 /isisd
parentQuagga: Fixup some compile warnings (diff)
downloadfrr-4690c7d74c8d3f08ac3c4c73918c847a9dd862b4.tar.xz
frr-4690c7d74c8d3f08ac3c4c73918c847a9dd862b4.zip
Quagga: prefix2str fixup
During CR for nexthop upstream it was noticed that usage of prefix2str was not consistent. This fixes this problem Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'isisd')
-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
4 files changed, 35 insertions, 51 deletions
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);