From fbf5d033041e406ecefd27c2deebf5a4953d1155 Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 29 Sep 2005 11:25:50 +0000 Subject: 2005-09-29 Alain Ritoux * lib/filer.c: show protocol name in filter_show() * lib/plist.c: show protocol name in vty_show_prefix_entry() * routemap.c: show protocol name in vty_show_route_map_entry() * lib/vty.c: in vty_command(), show protocol name if command unknown * zebra/zserv.c: Always provide distance fo route add * ripd/rip_snmp.c: rip2IfConfReceive() sends values in conformance with RFC. Also PeerDomain is now set to a STRING type. * ripd/ripd.h: rip_redistribute_add() API includes metric and distance * ripd/ripd.c: rip_redistribute_add() API i.e. stores metric and distance Now allows a RIP-route to overcome a redistributed route coming from a protocol with worse (higher) administrative distance Metrics from redistribution are shown in show ip rip * ripd/rip_zebra.c: adapt to the rip_redistribute_add() API, i.e. provide distance and metric * ripd/rip_interface.c: adapt to the rip_redistribute_add() API * ripd/rip_routemap.c: no RMAP_COMPILE_ERROR on (metric > 16) usage rather a CMD_WARNING, because set metric ius shared with other protocols using larger values (such as OSPF) The match metric action takes first external metric if present (from redistribution) then RIP metric. --- ripd/rip_routemap.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'ripd/rip_routemap.c') diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index e7692be0..2a2f264f 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -1,4 +1,5 @@ /* RIPv2 routemap. + * Copyright (C) 2005 6WIND * Copyright (C) 1999 Kunihiro Ishiguro * * This file is part of GNU Zebra. @@ -106,8 +107,14 @@ rip_route_set_add (struct vty *vty, struct route_map_index *index, vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; + /* rip, ripng and other protocols share the set metric command + but only values from 0 to 16 are valid for rip and ripng + if metric is out of range for rip and ripng, it is not for + other protocols. Do not return an error */ + if (strcmp(command, "metric")) { + vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); + return CMD_WARNING; + } } } return CMD_SUCCESS; @@ -161,6 +168,7 @@ route_match_metric (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { u_int32_t *metric; + u_int32_t check; struct rip_info *rinfo; if (type == RMAP_RIP) @@ -168,7 +176,11 @@ route_match_metric (void *rule, struct prefix *prefix, metric = rule; rinfo = object; - if (rinfo->metric == *metric) + /* If external metric is available, the route-map should + work on this one (for redistribute purpose) */ + check = (rinfo->external_metric) ? rinfo->external_metric : + rinfo->metric; + if (check == *metric) return RMAP_MATCH; else return RMAP_NOMATCH; -- cgit v1.2.1