summaryrefslogtreecommitdiffstats
path: root/lib/routemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/routemap.c')
-rw-r--r--lib/routemap.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/lib/routemap.c b/lib/routemap.c
index 2dfa5a46..b142e99c 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -28,7 +28,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "command.h"
#include "vty.h"
#include "log.h"
-
+
/* Vector for route match rules. */
static vector route_match_vec;
@@ -60,7 +60,7 @@ struct route_map_list
void (*add_hook) (const char *);
void (*delete_hook) (const char *);
- void (*event_hook) (route_map_event_t, const char *);
+ void (*event_hook) (route_map_event_t, const char *);
};
/* Master list of route map. */
@@ -72,7 +72,7 @@ route_map_rule_delete (struct route_map_rule_list *,
static void
route_map_index_delete (struct route_map_index *, int);
-
+
/* New route map allocation. Please note route map's name must be
specified. */
static struct route_map *
@@ -94,7 +94,7 @@ route_map_add (const char *name)
map = route_map_new (name);
list = &route_map_master;
-
+
map->next = NULL;
map->prev = list->tail;
if (list->tail)
@@ -117,7 +117,7 @@ route_map_delete (struct route_map *map)
struct route_map_list *list;
struct route_map_index *index;
char *name;
-
+
while ((index = map->head) != NULL)
route_map_index_delete (index, 0);
@@ -220,23 +220,23 @@ vty_show_route_map_entry (struct vty *vty, struct route_map *map)
if (index->description)
vty_out (vty, " Description:%s %s%s", VTY_NEWLINE,
index->description, VTY_NEWLINE);
-
+
/* Match clauses */
vty_out (vty, " Match clauses:%s", VTY_NEWLINE);
for (rule = index->match_list.head; rule; rule = rule->next)
- vty_out (vty, " %s %s%s",
+ vty_out (vty, " %s %s%s",
rule->cmd->str, rule->rule_str, VTY_NEWLINE);
-
+
vty_out (vty, " Set clauses:%s", VTY_NEWLINE);
for (rule = index->set_list.head; rule; rule = rule->next)
vty_out (vty, " %s %s%s",
rule->cmd->str, rule->rule_str, VTY_NEWLINE);
-
+
/* Call clause */
vty_out (vty, " Call clause:%s", VTY_NEWLINE);
if (index->nextrm)
vty_out (vty, " Call %s%s", index->nextrm, VTY_NEWLINE);
-
+
/* Exit Policy */
vty_out (vty, " Action:%s", VTY_NEWLINE);
if (index->exitpolicy == RMAP_GOTO)
@@ -353,7 +353,7 @@ route_map_index_add (struct route_map *map, enum route_map_type type,
index->map = map;
index->type = type;
index->pref = pref;
-
+
/* Compare preference. */
for (point = map->head; point; point = point->next)
if (point->pref >= pref)
@@ -394,7 +394,7 @@ route_map_index_add (struct route_map *map, enum route_map_type type,
/* Get route map index. */
static struct route_map_index *
-route_map_index_get (struct route_map *map, enum route_map_type type,
+route_map_index_get (struct route_map *map, enum route_map_type type,
int pref)
{
struct route_map_index *index;
@@ -420,7 +420,7 @@ route_map_rule_new (void)
new = XCALLOC (MTYPE_ROUTE_MAP_RULE, sizeof (struct route_map_rule));
return new;
}
-
+
/* Install rule command to the match list. */
void
route_map_install_match (struct route_map_rule_cmd *cmd)
@@ -552,7 +552,7 @@ route_map_add_match (struct route_map_index *index, const char *match_name,
{
next = rule->next;
if (rule->cmd == cmd)
- {
+ {
route_map_rule_delete (&index->match_list, rule);
replaced = 1;
}
@@ -591,9 +591,9 @@ route_map_delete_match (struct route_map_index *index, const char *match_name,
cmd = route_map_lookup_match (match_name);
if (cmd == NULL)
return 1;
-
+
for (rule = index->match_list.head; rule; rule = rule->next)
- if (rule->cmd == cmd &&
+ if (rule->cmd == cmd &&
(rulecmp (rule->rule_str, match_arg) == 0 || match_arg == NULL))
{
route_map_rule_delete (&index->match_list, rule);
@@ -677,7 +677,7 @@ route_map_delete_set (struct route_map_index *index, const char *set_name,
cmd = route_map_lookup_set (set_name);
if (cmd == NULL)
return 1;
-
+
for (rule = index->set_list.head; rule; rule = rule->next)
if ((rule->cmd == cmd) &&
(rulecmp (rule->rule_str, set_arg) == 0 || set_arg == NULL))
@@ -698,7 +698,7 @@ route_map_delete_set (struct route_map_index *index, const char *set_name,
The matrix for a route-map looks like this:
(note, this includes the description for the "NEXT"
and "GOTO" frobs now
-
+
Match | No Match
|
permit action | cont
@@ -707,7 +707,7 @@ route_map_delete_set (struct route_map_index *index, const char *set_name,
|
deny deny | cont
|
-
+
action)
-Apply Set statements, accept route
-If Call statement is present jump to the specified route-map, if it
@@ -719,10 +719,10 @@ route_map_delete_set (struct route_map_index *index, const char *set_name,
-Route is denied by route-map.
cont)
-Goto Next index
-
+
If we get no matches after we've processed all updates, then the route
is dropped too.
-
+
Some notes on the new "CALL", "NEXT" and "GOTO"
call WORD - If this clause is matched, then the set statements
are executed and then we jump to route-map 'WORD'. If
@@ -735,7 +735,7 @@ route_map_delete_set (struct route_map_index *index, const char *set_name,
first clause greater than this. In order to ensure
route-maps *always* exit, you cannot jump backwards.
Sorry ;)
-
+
We need to make sure our route-map processing matches the above
*/
@@ -757,7 +757,7 @@ route_map_apply_match (struct route_map_rule_list *match_list,
for (match = match_list->head; match; match = match->next)
{
/* Try each match statement in turn, If any do not return
- RMAP_MATCH, return, otherwise continue on to next match
+ RMAP_MATCH, return, otherwise continue on to next match
statement. All match statements must match for end-result
to be a match. */
ret = (*match->cmd->func_apply) (match->value, prefix,
@@ -827,7 +827,7 @@ route_map_apply (struct route_map *map, struct prefix *prefix,
if (ret == RMAP_DENYMATCH)
return ret;
}
-
+
switch (index->exitpolicy)
{
case RMAP_EXIT:
@@ -898,7 +898,7 @@ route_map_finish (void)
vector_free (route_set_vec);
route_set_vec = NULL;
}
-
+
/* VTY related functions. */
DEFUN (route_map,
route_map_cmd,
@@ -945,7 +945,7 @@ DEFUN (route_map,
index = route_map_index_get (map, permit, pref);
vty->index = index;
- vty->node = RMAP_NODE;
+ vty_set_node(vty, RMAP_NODE) ;
return CMD_SUCCESS;
}
@@ -1025,7 +1025,7 @@ DEFUN (no_route_map,
index = route_map_index_lookup (map, permit, pref);
if (index == NULL)
{
- vty_out (vty, "%% Could not find route-map entry %s %s%s",
+ vty_out (vty, "%% Could not find route-map entry %s %s%s",
argv[0], argv[2], VTY_NEWLINE);
return CMD_WARNING;
}
@@ -1066,7 +1066,7 @@ DEFUN (no_rmap_onmatch_next,
struct route_map_index *index;
index = vty->index;
-
+
if (index)
index->exitpolicy = RMAP_EXIT;
@@ -1089,11 +1089,11 @@ DEFUN (rmap_onmatch_goto,
VTY_GET_INTEGER_RANGE("route-map index", d, argv[0], 1, 65536);
else
d = index->pref + 1;
-
+
if (d <= index->pref)
{
/* Can't allow you to do that, Dave */
- vty_out (vty, "can't jump backwards in route-maps%s",
+ vty_out (vty, "can't jump backwards in route-maps%s",
VTY_NEWLINE);
return CMD_WARNING;
}
@@ -1119,7 +1119,7 @@ DEFUN (no_rmap_onmatch_goto,
if (index)
index->exitpolicy = RMAP_EXIT;
-
+
return CMD_SUCCESS;
}
@@ -1259,7 +1259,7 @@ route_map_config_write (struct vty *vty)
else
first = 0;
- vty_out (vty, "route-map %s %s %d%s",
+ vty_out (vty, "route-map %s %s %d%s",
map->name,
route_map_type_str (index->type),
index->pref, VTY_NEWLINE);
@@ -1268,7 +1268,7 @@ route_map_config_write (struct vty *vty)
vty_out (vty, " description %s%s", index->description, VTY_NEWLINE);
for (rule = index->match_list.head; rule; rule = rule->next)
- vty_out (vty, " match %s %s%s", rule->cmd->str,
+ vty_out (vty, " match %s %s%s", rule->cmd->str,
rule->rule_str ? rule->rule_str : "",
VTY_NEWLINE);
@@ -1282,7 +1282,7 @@ route_map_config_write (struct vty *vty)
vty_out (vty, " on-match goto %d%s", index->nextpref, VTY_NEWLINE);
if (index->exitpolicy == RMAP_NEXT)
vty_out (vty," on-match next%s", VTY_NEWLINE);
-
+
write++;
}
return write;
@@ -1315,12 +1315,12 @@ route_map_init_vty (void)
install_element (RMAP_NODE, &no_rmap_onmatch_next_cmd);
install_element (RMAP_NODE, &rmap_onmatch_goto_cmd);
install_element (RMAP_NODE, &no_rmap_onmatch_goto_cmd);
-
+
/* Install the continue stuff (ALIAS of on-match). */
install_element (RMAP_NODE, &rmap_continue_cmd);
install_element (RMAP_NODE, &no_rmap_continue_cmd);
install_element (RMAP_NODE, &rmap_continue_index_cmd);
-
+
/* Install the call stuff. */
install_element (RMAP_NODE, &rmap_call_cmd);
install_element (RMAP_NODE, &no_rmap_call_cmd);
@@ -1328,7 +1328,7 @@ route_map_init_vty (void)
/* Install description commands. */
install_element (RMAP_NODE, &rmap_description_cmd);
install_element (RMAP_NODE, &no_rmap_description_cmd);
-
+
/* Install show command */
install_element (ENABLE_NODE, &rmap_show_name_cmd);
}