summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ChangeLog22
-rw-r--r--ospfd/ospf_asbr.c4
-rw-r--r--ospfd/ospf_dump.c23
-rw-r--r--ospfd/ospf_vty.c6
-rw-r--r--ospfd/ospf_zebra.c12
-rw-r--r--ospfd/ospfd.h2
6 files changed, 41 insertions, 28 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index 2e288a7d..7d56bfe8 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,25 @@
+2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+ * ospf_dump.c: Remove local hard-coded table ospf_redistributed_proto.
+ (ospf_redist_string) New function implemented using new library
+ function zebra_route_string(). Note that there are a few differences
+ in the output that will result: the new function returns strings
+ that are lower-case, whereas the old table was mixed case. Also,
+ the old table mapped ZEBRA_ROUTE_OSPF6 to "OSPFv3", whereas the
+ new function returns "ospf6".
+ * ospfd.h: Remove extern struct message ospf_redistributed_proto[],
+ and add extern const char *ospf_redist_string(u_int route_type)
+ instead.
+ * ospf_asbr.c: (ospf_external_info_add) In two messages, use
+ ospf_redist_string instead of LOOKUP(ospf_redistributed_proto).
+ * ospf_vty.c: Remove local hard-coded table distribute_str.
+ (config_write_ospf_redistribute,config_write_ospf_distribute): Use
+ new library function zebra_route_string() instead of distribute_str[].
+ * ospf_zebra.c: (ospf_redistribute_set,ospf_redistribute_unset,
+ ospf_redistribute_default_set,ospf_redistribute_check)
+ In debug messages, use ospf_redist_string() instead of
+ LOOKUP(ospf_redistributed_proto).
+
2005-09-30 Vincent Jardin <vincent.jardin@6wind.com>
* ospf_dump.c, ospf_ia.c, ospf_spf.c, ospf_ase.c:
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index 2eb01d0e..426fac49 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -152,7 +152,7 @@ ospf_external_info_add (u_char type, struct prefix_ipv4 p,
{
route_unlock_node (rn);
zlog_warn ("Redistribute[%s]: %s/%d already exists, discard.",
- LOOKUP (ospf_redistributed_proto, type),
+ ospf_redist_string(type),
inet_ntoa (p.prefix), p.prefixlen);
/* XFREE (MTYPE_OSPF_TMP, rn->info); */
return rn->info;
@@ -169,7 +169,7 @@ ospf_external_info_add (u_char type, struct prefix_ipv4 p,
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("Redistribute[%s]: %s/%d external info created.",
- LOOKUP (ospf_redistributed_proto, type),
+ ospf_redist_string(type),
inet_ntoa (p.prefix), p.prefixlen);
return new;
}
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index 4ace02bd..ac742692 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -103,21 +103,6 @@ struct message ospf_link_state_id_type_msg[] =
};
int ospf_link_state_id_type_msg_max = OSPF_MAX_LSA;
-struct message ospf_redistributed_proto[] =
-{
- { ZEBRA_ROUTE_SYSTEM, "System" },
- { ZEBRA_ROUTE_KERNEL, "Kernel" },
- { ZEBRA_ROUTE_CONNECT, "Connected" },
- { ZEBRA_ROUTE_STATIC, "Static" },
- { ZEBRA_ROUTE_RIP, "RIP" },
- { ZEBRA_ROUTE_RIPNG, "RIPng" },
- { ZEBRA_ROUTE_OSPF, "OSPF" },
- { ZEBRA_ROUTE_OSPF6, "OSPFv3" },
- { ZEBRA_ROUTE_BGP, "BGP" },
- { ZEBRA_ROUTE_MAX, "Default" },
-};
-int ospf_redistributed_proto_max = ZEBRA_ROUTE_MAX + 1;
-
struct message ospf_network_type_msg[] =
{
{ OSPF_IFTYPE_NONE, "NONE" },
@@ -148,6 +133,14 @@ unsigned long term_debug_ospf_zebra = 0;
unsigned long term_debug_ospf_nssa = 0;
+
+const char *
+ospf_redist_string(u_int route_type)
+{
+ return (route_type == ZEBRA_ROUTE_MAX) ?
+ "Default" : zebra_route_string(route_type);
+}
+
#define OSPF_AREA_STRING_MAXLEN 16
const char *
ospf_area_name_string (struct ospf_area *area)
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 1a2afacc..a47eca18 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -7288,8 +7288,6 @@ config_write_virtual_link (struct vty *vty, struct ospf *ospf)
}
-const char *distribute_str[] = { "system", "kernel", "connected", "static",
- "rip", "ripng", "ospf", "ospf6", "isis", "bgp"};
static int
config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
{
@@ -7299,7 +7297,7 @@ config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
if (type != zclient->redist_default && zclient->redist[type])
{
- vty_out (vty, " redistribute %s", distribute_str[type]);
+ vty_out (vty, " redistribute %s", zebra_route_string(type));
if (ospf->dmetric[type].value >= 0)
vty_out (vty, " metric %d", ospf->dmetric[type].value);
@@ -7336,7 +7334,7 @@ config_write_ospf_distribute (struct vty *vty, struct ospf *ospf)
if (ospf->dlist[type].name)
vty_out (vty, " distribute-list %s out %s%s",
ospf->dlist[type].name,
- distribute_str[type], VTY_NEWLINE);
+ zebra_route_string(type), VTY_NEWLINE);
/* default-information print. */
if (ospf->default_originate != DEFAULT_ORIGINATE_NONE)
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 2072b177..0d98008d 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -527,7 +527,7 @@ ospf_redistribute_set (struct ospf *ospf, int type, int mtype, int mvalue)
if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
- LOOKUP (ospf_redistributed_proto, type),
+ ospf_redist_string(type),
metric_type (ospf, type), metric_value (ospf, type));
return CMD_SUCCESS;
@@ -540,7 +540,7 @@ ospf_redistribute_set (struct ospf *ospf, int type, int mtype, int mvalue)
if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
- LOOKUP (ospf_redistributed_proto, type),
+ ospf_redist_string(type),
metric_type (ospf, type), metric_value (ospf, type));
ospf_asbr_status_update (ospf, ++ospf->redistribute);
@@ -561,7 +561,7 @@ ospf_redistribute_unset (struct ospf *ospf, int type)
if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
zlog_debug ("Redistribute[%s]: Stop",
- LOOKUP (ospf_redistributed_proto, type));
+ ospf_redist_string(type));
ospf->dmetric[type].type = -1;
ospf->dmetric[type].value = -1;
@@ -597,7 +597,7 @@ ospf_redistribute_default_set (struct ospf *ospf, int originate,
if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
- LOOKUP (ospf_redistributed_proto, DEFAULT_ROUTE),
+ ospf_redist_string(DEFAULT_ROUTE),
metric_type (ospf, DEFAULT_ROUTE),
metric_value (ospf, DEFAULT_ROUTE));
return CMD_SUCCESS;
@@ -713,7 +713,7 @@ ospf_redistribute_check (struct ospf *ospf,
{
if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
zlog_debug ("Redistribute[%s]: %s/%d filtered by ditribute-list.",
- LOOKUP (ospf_redistributed_proto, type),
+ ospf_redist_string(type),
inet_ntoa (p->prefix), p->prefixlen);
return 0;
}
@@ -734,7 +734,7 @@ ospf_redistribute_check (struct ospf *ospf,
ei->route_map_set = save_values;
if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
zlog_debug ("Redistribute[%s]: %s/%d filtered by route-map.",
- LOOKUP (ospf_redistributed_proto, type),
+ ospf_redist_string(type),
inet_ntoa (p->prefix), p->prefixlen);
return 0;
}
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index 95e4751d..7a2649f6 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -516,7 +516,6 @@ extern struct message ospf_ism_state_msg[];
extern struct message ospf_nsm_state_msg[];
extern struct message ospf_lsa_type_msg[];
extern struct message ospf_link_state_id_type_msg[];
-extern struct message ospf_redistributed_proto[];
extern struct message ospf_network_type_msg[];
extern int ospf_ism_state_msg_max;
extern int ospf_nsm_state_msg_max;
@@ -529,6 +528,7 @@ extern struct thread_master *master;
extern int ospf_zlog;
/* Prototypes. */
+extern const char *ospf_redist_string(u_int route_type);
extern struct ospf *ospf_lookup (void);
extern struct ospf *ospf_get (void);
extern void ospf_finish (struct ospf *);