diff options
author | ajs <ajs> | 2005-10-01 17:38:06 +0000 |
---|---|---|
committer | ajs <ajs> | 2005-10-01 17:38:06 +0000 |
commit | f52d13cb2e8e7197934d5f241f88647f9b9d78b8 (patch) | |
tree | b0aa01befc07f57ed47e83ac7dfb383284c49d26 /ripd | |
parent | c05612b9a702d0f49c379c92deb6daab55372aea (diff) |
2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* zebra.h: Declare new functions zebra_route_string() and
zebra_route_char().
* log.c: (zroute_lookup,zebra_route_string,zebra_route_char) New
functions to map zebra route numbers to strings.
* zebra_vty.c: (route_type_str) Remove obsolete function: use new
library function zebra_route_string() instead. Note that there
are a few differences: for IPv6 routes, we now get "ripng" and
"ospf6" instead of the old behavior ("rip" and "ospf").
(route_type_char) Remove obsolete function: ues new library function
zebra_route_char() instead. Note that there is one difference:
the old function returned 'S' for a ZEBRA_ROUTE_SYSTEM route,
whereas the new one returns 'X'.
(vty_show_ip_route_detail,vty_show_ipv6_route_detail) Replace
route_type_str() with zebra_route_string().
(vty_show_ip_route,vty_show_ipv6_route) Replace route_type_char()
with zebra_route_char().
* bgp_vty.c: (bgp_config_write_redistribute) Use new library function
zebra_route_string instead of a local hard-coded table.
* ospf6_asbr.c: Remove local hard-coded tables zroute_name and
zroute_abname. Change the ZROUTE_NAME macro to use new library
function zebra_route_string(). Remove the ZROUTE_ABNAME macro.
(ospf6_asbr_external_route_show): Replace ZROUTE_ABNAME() with
a call to zebra_route_char(), and be sure to fix the format string,
since we now have a char instead of a char *.
* ospf6_zebra.c: Remove local hard-coded tables zebra_route_name and
zebra_route_abname. Note that the zebra_route_name[] table
contained mixed-case strings, whereas the zebra_route_string()
function returns lower-case strings.
(ospf6_zebra_read_ipv6): Change debug message to use new library
function zebra_route_string() instead of zebra_route_name[].
(show_zebra): Use new library function zebra_route_string() instead
of zebra_route_name[].
* 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).
* rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded
table str[]. Replace str[] with calls to new library function
zebra_route_string().
* ripd.c: Remove local hard-coded table route_info[].
(show_ip_rip) Replace uses of str[] with calls to new library
functions zebra_route_char and zebra_route_string.
* ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded
table str[]. Replace str[i] with new library function
zebra_route_string(i).
* ripngd.c: Remove local hard-coded table route_info[].
(show_ipv6_ripng) Use new library function zebra_route_char() instead
of table route_info[].
Diffstat (limited to 'ripd')
-rw-r--r-- | ripd/ChangeLog | 9 | ||||
-rw-r--r-- | ripd/rip_zebra.c | 12 | ||||
-rw-r--r-- | ripd/ripd.c | 26 |
3 files changed, 17 insertions, 30 deletions
diff --git a/ripd/ChangeLog b/ripd/ChangeLog index 6aecebd4..0e19ef3c 100644 --- a/ripd/ChangeLog +++ b/ripd/ChangeLog @@ -1,3 +1,12 @@ +2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded + table str[]. Replace str[] with calls to new library function + zebra_route_string(). + * ripd.c: Remove local hard-coded table route_info[]. + (show_ip_rip) Replace uses of str[] with calls to new library + functions zebra_route_char and zebra_route_string. + 2005-09-29 Alain Ritoux <alain.ritoux@6wind.com> * rip_snmp.c: rip2IfConfReceive() sends values in conformance diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 570b5281..d810a6b9 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -653,8 +653,6 @@ int config_write_rip_redistribute (struct vty *vty, int config_mode) { int i; - const char *str[] = { "system", "kernel", "connected", "static", "rip", - "ripng", "ospf", "ospf6", "isis", "bgp"}; for (i = 0; i < ZEBRA_ROUTE_MAX; i++) if (i != zclient->redist_default && zclient->redist[i]) @@ -665,27 +663,27 @@ config_write_rip_redistribute (struct vty *vty, int config_mode) { if (rip->route_map[i].name) vty_out (vty, " redistribute %s metric %d route-map %s%s", - str[i], rip->route_map[i].metric, + zebra_route_string(i), rip->route_map[i].metric, rip->route_map[i].name, VTY_NEWLINE); else vty_out (vty, " redistribute %s metric %d%s", - str[i], rip->route_map[i].metric, + zebra_route_string(i), rip->route_map[i].metric, VTY_NEWLINE); } else { if (rip->route_map[i].name) vty_out (vty, " redistribute %s route-map %s%s", - str[i], rip->route_map[i].name, + zebra_route_string(i), rip->route_map[i].name, VTY_NEWLINE); else - vty_out (vty, " redistribute %s%s", str[i], + vty_out (vty, " redistribute %s%s", zebra_route_string(i), VTY_NEWLINE); } } else - vty_out (vty, " %s", str[i]); + vty_out (vty, " %s", zebra_route_string(i)); } return 0; } diff --git a/ripd/ripd.c b/ripd/ripd.c index 13cf9b9b..fd1f2da6 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -85,26 +85,6 @@ struct message rip_msg[] = {RIP_POLL_ENTRY, "POLL ENTRY"}, {0, NULL} }; - -/* Each route type's strings and default preference. */ -struct -{ - int key; - const char *str; - const char *str_long; -} route_info[] = -{ - { ZEBRA_ROUTE_SYSTEM, "X", "system"}, - { ZEBRA_ROUTE_KERNEL, "K", "kernel"}, - { ZEBRA_ROUTE_CONNECT, "C", "connected"}, - { ZEBRA_ROUTE_STATIC, "S", "static"}, - { ZEBRA_ROUTE_RIP, "R", "rip"}, - { ZEBRA_ROUTE_RIPNG, "R", "ripng"}, - { ZEBRA_ROUTE_OSPF, "O", "ospf"}, - { ZEBRA_ROUTE_OSPF6, "O", "ospf6"}, - { ZEBRA_ROUTE_ISIS, "I", "isis"}, - { ZEBRA_ROUTE_BGP, "B", "bgp"} -}; /* Utility function to set boradcast option to the socket. */ int @@ -3478,9 +3458,9 @@ DEFUN (show_ip_rip, { int len; - len = vty_out (vty, "%s(%s) %s/%d", + len = vty_out (vty, "%c(%s) %s/%d", /* np->lock, For debugging. */ - route_info[rinfo->type].str, + zebra_route_char(rinfo->type), rip_route_type_print (rinfo->sub_type), inet_ntoa (np->p.u.prefix4), np->p.prefixlen); @@ -3514,7 +3494,7 @@ DEFUN (show_ip_rip, if (rinfo->external_metric) { len = vty_out (vty, "self (%s:%d)", - route_info[rinfo->type].str_long, + zebra_route_string(rinfo->type), rinfo->external_metric); len = 16 - len; if (len > 0) |