]> git.proxmox.com Git - mirror_frr.git/blame - ospfd/ospf_routemap.c
Merge pull request #5366 from ton31337/fix/addpath_total_peer_update_7.1
[mirror_frr.git] / ospfd / ospf_routemap.c
CommitLineData
718e3744 1/*
2 * Route map function of ospfd.
3 * Copyright (C) 2000 IP Infusion Inc.
4 *
5 * Written by Toshiaki Takada.
6 *
7 * This file is part of GNU Zebra.
8 *
9 * GNU Zebra is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * GNU Zebra is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
896014f4
DL
19 * You should have received a copy of the GNU General Public License along
20 * with this program; see the file COPYING; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
718e3744 22 */
23
24#include <zebra.h>
25
26#include "memory.h"
27#include "prefix.h"
28#include "table.h"
82f97584 29#include "vty.h"
718e3744 30#include "routemap.h"
31#include "command.h"
32#include "log.h"
33#include "plist.h"
1306c09a 34#include "vrf.h"
5d5ba018 35#include "frrstr.h"
718e3744 36
37#include "ospfd/ospfd.h"
38#include "ospfd/ospf_asbr.h"
39#include "ospfd/ospf_interface.h"
40#include "ospfd/ospf_lsa.h"
41#include "ospfd/ospf_route.h"
42#include "ospfd/ospf_zebra.h"
45301f8c 43#include "ospfd/ospf_errors.h"
718e3744 44
45/* Hook function for updating route_map assignment. */
d62a17ae 46static void ospf_route_map_update(const char *name)
47{
48 struct ospf *ospf;
49 int type;
b5a8894d 50 struct listnode *n1 = NULL;
d62a17ae 51
52 /* If OSPF instatnce does not exist, return right now. */
b5a8894d 53 if (listcount(om->ospf) == 0)
d62a17ae 54 return;
55
43b8d1d8 56 for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
b5a8894d
CS
57 /* Update route-map */
58 for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
59 struct list *red_list;
60 struct listnode *node;
61 struct ospf_redist *red;
62
63 red_list = ospf->redist[type];
64 if (!red_list)
65 continue;
66
67 for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) {
68 if (ROUTEMAP_NAME(red)
69 && strcmp(ROUTEMAP_NAME(red), name) == 0) {
70 /* Keep old route-map. */
71 struct route_map *old = ROUTEMAP(red);
72
93d836e6 73 if (!old) {
74 /* Route-map creation */
75 /* Update route-map. */
76 ROUTEMAP(red) =
77 route_map_lookup_by_name(
78 ROUTEMAP_NAME(red));
996c9314 79
93d836e6 80 route_map_counter_increment(
81 ROUTEMAP(red));
82 } else {
83 /* Route-map deletion */
84 ROUTEMAP(red) = NULL;
85 }
996c9314
LB
86 /* No update for this distribute type.
87 */
88 if (old == NULL
89 && ROUTEMAP(red) == NULL)
b5a8894d
CS
90 continue;
91
996c9314
LB
92 ospf_distribute_list_update(
93 ospf, type, red->instance);
b5a8894d 94 }
d62a17ae 95 }
96 }
97 }
718e3744 98}
99
d62a17ae 100static void ospf_route_map_event(route_map_event_t event, const char *name)
718e3744 101{
d62a17ae 102 struct ospf *ospf;
103 int type;
b5a8894d
CS
104 struct listnode *n1 = NULL;
105
106 for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
107 for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
108 struct list *red_list;
109 struct listnode *node;
110 struct ospf_redist *red;
111
112 red_list = ospf->redist[type];
113 if (!red_list)
114 continue;
115
116 for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) {
117 if (ROUTEMAP_NAME(red) && ROUTEMAP(red)
118 && !strcmp(ROUTEMAP_NAME(red), name)) {
996c9314
LB
119 ospf_distribute_list_update(
120 ospf, type, red->instance);
b5a8894d 121 }
d62a17ae 122 }
123 }
124 }
718e3744 125}
126
718e3744 127/* `match ip netxthop ' */
128/* Match function return 1 if match is success else return zero. */
d62a17ae 129static route_map_result_t route_match_ip_nexthop(void *rule,
123214ef 130 const struct prefix *prefix,
d62a17ae 131 route_map_object_t type,
132 void *object)
133{
134 struct access_list *alist;
135 struct external_info *ei = object;
136 struct prefix_ipv4 p;
137
138 if (type == RMAP_OSPF) {
139 p.family = AF_INET;
140 p.prefix = ei->nexthop;
141 p.prefixlen = IPV4_MAX_BITLEN;
142
143 alist = access_list_lookup(AFI_IP, (char *)rule);
144 if (alist == NULL)
145 return RMAP_NOMATCH;
146
147 return (access_list_apply(alist, &p) == FILTER_DENY
148 ? RMAP_NOMATCH
149 : RMAP_MATCH);
150 }
151 return RMAP_NOMATCH;
718e3744 152}
153
154/* Route map `ip next-hop' match statement. `arg' should be
155 access-list name. */
d62a17ae 156static void *route_match_ip_nexthop_compile(const char *arg)
718e3744 157{
d62a17ae 158 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
718e3744 159}
160
161/* Free route map's compiled `ip address' value. */
d62a17ae 162static void route_match_ip_nexthop_free(void *rule)
718e3744 163{
d62a17ae 164 XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
718e3744 165}
166
167/* Route map commands for metric matching. */
d62a17ae 168struct route_map_rule_cmd route_match_ip_nexthop_cmd = {
169 "ip next-hop", route_match_ip_nexthop, route_match_ip_nexthop_compile,
170 route_match_ip_nexthop_free};
718e3744 171
172/* `match ip next-hop prefix-list PREFIX_LIST' */
173
4dadc291 174static route_map_result_t
123214ef 175route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
d62a17ae 176 route_map_object_t type, void *object)
718e3744 177{
d62a17ae 178 struct prefix_list *plist;
179 struct external_info *ei = object;
180 struct prefix_ipv4 p;
181
182 if (type == RMAP_OSPF) {
183 p.family = AF_INET;
184 p.prefix = ei->nexthop;
185 p.prefixlen = IPV4_MAX_BITLEN;
186
187 plist = prefix_list_lookup(AFI_IP, (char *)rule);
188 if (plist == NULL)
189 return RMAP_NOMATCH;
190
191 return (prefix_list_apply(plist, &p) == PREFIX_DENY
192 ? RMAP_NOMATCH
193 : RMAP_MATCH);
194 }
195 return RMAP_NOMATCH;
718e3744 196}
197
d62a17ae 198static void *route_match_ip_next_hop_prefix_list_compile(const char *arg)
718e3744 199{
d62a17ae 200 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
718e3744 201}
202
d62a17ae 203static void route_match_ip_next_hop_prefix_list_free(void *rule)
718e3744 204{
d62a17ae 205 XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
718e3744 206}
207
d62a17ae 208struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = {
209 "ip next-hop prefix-list", route_match_ip_next_hop_prefix_list,
210 route_match_ip_next_hop_prefix_list_compile,
211 route_match_ip_next_hop_prefix_list_free};
718e3744 212
2d818099
DA
213/* `match ip next-hop type <blackhole>' */
214
215static route_map_result_t
216route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
217 route_map_object_t type, void *object)
218{
219 struct external_info *ei = object;
220
221 if (type == RMAP_OSPF && prefix->family == AF_INET) {
222 ei = (struct external_info *)object;
223 if (!ei)
224 return RMAP_DENYMATCH;
225
226 if (ei->nexthop.s_addr == INADDR_ANY && !ei->ifindex)
227 return RMAP_MATCH;
228 }
229 return RMAP_NOMATCH;
230}
231
232static void *route_match_ip_next_hop_type_compile(const char *arg)
233{
234 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
235}
236
237static void route_match_ip_next_hop_type_free(void *rule)
238{
239 XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
240}
241
242static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = {
243 "ip next-hop type", route_match_ip_next_hop_type,
244 route_match_ip_next_hop_type_compile,
245 route_match_ip_next_hop_type_free};
246
718e3744 247/* `match ip address IP_ACCESS_LIST' */
248/* Match function should return 1 if match is success else return
249 zero. */
d62a17ae 250static route_map_result_t route_match_ip_address(void *rule,
123214ef 251 const struct prefix *prefix,
d62a17ae 252 route_map_object_t type,
253 void *object)
254{
255 struct access_list *alist;
256 /* struct prefix_ipv4 match; */
257
258 if (type == RMAP_OSPF) {
259 alist = access_list_lookup(AFI_IP, (char *)rule);
260 if (alist == NULL)
261 return RMAP_NOMATCH;
262
263 return (access_list_apply(alist, prefix) == FILTER_DENY
264 ? RMAP_NOMATCH
265 : RMAP_MATCH);
266 }
267 return RMAP_NOMATCH;
718e3744 268}
269
270/* Route map `ip address' match statement. `arg' should be
271 access-list name. */
d62a17ae 272static void *route_match_ip_address_compile(const char *arg)
718e3744 273{
d62a17ae 274 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
718e3744 275}
276
277/* Free route map's compiled `ip address' value. */
d62a17ae 278static void route_match_ip_address_free(void *rule)
718e3744 279{
d62a17ae 280 XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
718e3744 281}
282
283/* Route map commands for ip address matching. */
d62a17ae 284struct route_map_rule_cmd route_match_ip_address_cmd = {
285 "ip address", route_match_ip_address, route_match_ip_address_compile,
286 route_match_ip_address_free};
718e3744 287
288/* `match ip address prefix-list PREFIX_LIST' */
4dadc291 289static route_map_result_t
123214ef 290route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
d62a17ae 291 route_map_object_t type, void *object)
718e3744 292{
d62a17ae 293 struct prefix_list *plist;
294
295 if (type == RMAP_OSPF) {
296 plist = prefix_list_lookup(AFI_IP, (char *)rule);
297 if (plist == NULL)
298 return RMAP_NOMATCH;
299
300 return (prefix_list_apply(plist, prefix) == PREFIX_DENY
301 ? RMAP_NOMATCH
302 : RMAP_MATCH);
303 }
304 return RMAP_NOMATCH;
718e3744 305}
306
d62a17ae 307static void *route_match_ip_address_prefix_list_compile(const char *arg)
718e3744 308{
d62a17ae 309 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
718e3744 310}
311
d62a17ae 312static void route_match_ip_address_prefix_list_free(void *rule)
718e3744 313{
d62a17ae 314 XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
718e3744 315}
316
d62a17ae 317struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = {
318 "ip address prefix-list", route_match_ip_address_prefix_list,
319 route_match_ip_address_prefix_list_compile,
320 route_match_ip_address_prefix_list_free};
718e3744 321
322/* `match interface IFNAME' */
323/* Match function should return 1 if match is success else return
324 zero. */
d62a17ae 325static route_map_result_t route_match_interface(void *rule,
123214ef 326 const struct prefix *prefix,
d62a17ae 327 route_map_object_t type,
328 void *object)
718e3744 329{
d62a17ae 330 struct interface *ifp;
331 struct external_info *ei;
718e3744 332
d62a17ae 333 if (type == RMAP_OSPF) {
334 ei = object;
b5a8894d 335 ifp = if_lookup_by_name_all_vrf((char *)rule);
718e3744 336
d62a17ae 337 if (ifp == NULL || ifp->ifindex != ei->ifindex)
338 return RMAP_NOMATCH;
718e3744 339
d62a17ae 340 return RMAP_MATCH;
341 }
342 return RMAP_NOMATCH;
718e3744 343}
344
345/* Route map `interface' match statement. `arg' should be
346 interface name. */
d62a17ae 347static void *route_match_interface_compile(const char *arg)
718e3744 348{
d62a17ae 349 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
718e3744 350}
351
352/* Free route map's compiled `interface' value. */
d62a17ae 353static void route_match_interface_free(void *rule)
718e3744 354{
d62a17ae 355 XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
718e3744 356}
357
358/* Route map commands for ip address matching. */
d62a17ae 359struct route_map_rule_cmd route_match_interface_cmd = {
360 "interface", route_match_interface, route_match_interface_compile,
361 route_match_interface_free};
718e3744 362
0d9551dc 363/* Match function return 1 if match is success else return zero. */
123214ef
MS
364static route_map_result_t route_match_tag(void *rule,
365 const struct prefix *prefix,
d62a17ae 366 route_map_object_t type, void *object)
0d9551dc 367{
d62a17ae 368 route_tag_t *tag;
369 struct external_info *ei;
0d9551dc 370
d62a17ae 371 if (type == RMAP_OSPF) {
372 tag = rule;
373 ei = object;
0d9551dc 374
d62a17ae 375 return ((ei->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH);
376 }
0d9551dc 377
d62a17ae 378 return RMAP_NOMATCH;
0d9551dc
DS
379}
380
0d9551dc 381/* Route map commands for tag matching. */
d62a17ae 382static struct route_map_rule_cmd route_match_tag_cmd = {
9d303b37 383 "tag", route_match_tag, route_map_rule_tag_compile,
d62a17ae 384 route_map_rule_tag_free,
0d9551dc
DS
385};
386
6a74c5f9 387struct ospf_metric {
7a5e6e46 388 enum { metric_increment, metric_decrement, metric_absolute } type;
6a74c5f9 389 bool used;
d7c0a89a 390 uint32_t metric;
6a74c5f9 391};
0d9551dc 392
718e3744 393/* `set metric METRIC' */
394/* Set metric to attribute. */
123214ef
MS
395static route_map_result_t route_set_metric(void *rule,
396 const struct prefix *prefix,
d62a17ae 397 route_map_object_t type,
398 void *object)
718e3744 399{
6a74c5f9 400 struct ospf_metric *metric;
d62a17ae 401 struct external_info *ei;
402
403 if (type == RMAP_OSPF) {
404 /* Fetch routemap's rule information. */
405 metric = rule;
406 ei = object;
407
408 /* Set metric out value. */
7a5e6e46 409 if (!metric->used)
410 return RMAP_OKAY;
236e900c
QY
411
412 ei->route_map_set.metric = DEFAULT_DEFAULT_METRIC;
413
7a5e6e46 414 if (metric->type == metric_increment)
415 ei->route_map_set.metric += metric->metric;
236e900c 416 else if (metric->type == metric_decrement)
7a5e6e46 417 ei->route_map_set.metric -= metric->metric;
236e900c 418 else if (metric->type == metric_absolute)
6a74c5f9 419 ei->route_map_set.metric = metric->metric;
7a5e6e46 420
7a5e6e46 421 if (ei->route_map_set.metric > OSPF_LS_INFINITY)
422 ei->route_map_set.metric = OSPF_LS_INFINITY;
d62a17ae 423 }
424 return RMAP_OKAY;
718e3744 425}
426
427/* set metric compilation. */
d62a17ae 428static void *route_set_metric_compile(const char *arg)
429{
6a74c5f9
DS
430 struct ospf_metric *metric;
431
d7c0a89a 432 metric = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t));
6a74c5f9 433 metric->used = false;
d62a17ae 434
7a5e6e46 435 if (all_digit(arg))
436 metric->type = metric_absolute;
437
438 if (strmatch(arg, "+rtt") || strmatch(arg, "-rtt")) {
cf444bcf 439 flog_warn(EC_OSPF_SET_METRIC_PLUS,
45301f8c 440 "OSPF does not support 'set metric +rtt / -rtt'");
7a5e6e46 441 return metric;
442 }
443
444 if ((arg[0] == '+') && all_digit(arg + 1)) {
445 metric->type = metric_increment;
446 arg++;
ed2eb093 447 }
7a5e6e46 448
449 if ((arg[0] == '-') && all_digit(arg + 1)) {
450 metric->type = metric_decrement;
451 arg++;
452 }
453
6a74c5f9 454 metric->metric = strtoul(arg, NULL, 10);
7a5e6e46 455
456 if (metric->metric)
457 metric->used = true;
d62a17ae 458
459 return metric;
718e3744 460}
461
462/* Free route map's compiled `set metric' value. */
d62a17ae 463static void route_set_metric_free(void *rule)
718e3744 464{
d62a17ae 465 XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
718e3744 466}
467
468/* Set metric rule structure. */
d62a17ae 469struct route_map_rule_cmd route_set_metric_cmd = {
9d303b37 470 "metric", route_set_metric, route_set_metric_compile,
d62a17ae 471 route_set_metric_free,
718e3744 472};
473
474/* `set metric-type TYPE' */
475/* Set metric-type to attribute. */
d62a17ae 476static route_map_result_t route_set_metric_type(void *rule,
123214ef 477 const struct prefix *prefix,
d62a17ae 478 route_map_object_t type,
479 void *object)
718e3744 480{
d7c0a89a 481 uint32_t *metric_type;
d62a17ae 482 struct external_info *ei;
483
484 if (type == RMAP_OSPF) {
485 /* Fetch routemap's rule information. */
486 metric_type = rule;
487 ei = object;
488
489 /* Set metric out value. */
490 ei->route_map_set.metric_type = *metric_type;
491 }
492 return RMAP_OKAY;
718e3744 493}
494
495/* set metric-type compilation. */
d62a17ae 496static void *route_set_metric_type_compile(const char *arg)
718e3744 497{
d7c0a89a 498 uint32_t *metric_type;
718e3744 499
d7c0a89a 500 metric_type = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t));
d62a17ae 501 if (strcmp(arg, "type-1") == 0)
502 *metric_type = EXTERNAL_METRIC_TYPE_1;
503 else if (strcmp(arg, "type-2") == 0)
504 *metric_type = EXTERNAL_METRIC_TYPE_2;
718e3744 505
d62a17ae 506 if (*metric_type == EXTERNAL_METRIC_TYPE_1
507 || *metric_type == EXTERNAL_METRIC_TYPE_2)
508 return metric_type;
718e3744 509
d62a17ae 510 XFREE(MTYPE_ROUTE_MAP_COMPILED, metric_type);
511 return NULL;
718e3744 512}
513
514/* Free route map's compiled `set metric-type' value. */
d62a17ae 515static void route_set_metric_type_free(void *rule)
718e3744 516{
d62a17ae 517 XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
718e3744 518}
519
520/* Set metric rule structure. */
d62a17ae 521struct route_map_rule_cmd route_set_metric_type_cmd = {
9d303b37 522 "metric-type", route_set_metric_type, route_set_metric_type_compile,
d62a17ae 523 route_set_metric_type_free,
718e3744 524};
525
123214ef 526static route_map_result_t route_set_tag(void *rule, const struct prefix *prefix,
d62a17ae 527 route_map_object_t type, void *object)
0d9551dc 528{
d62a17ae 529 route_tag_t *tag;
530 struct external_info *ei;
0d9551dc 531
d62a17ae 532 if (type == RMAP_OSPF) {
533 tag = rule;
534 ei = object;
0d9551dc 535
d62a17ae 536 /* Set tag value */
537 ei->tag = *tag;
538 }
0d9551dc 539
d62a17ae 540 return RMAP_OKAY;
0d9551dc
DS
541}
542
0d9551dc 543/* Route map commands for tag set. */
d62a17ae 544static struct route_map_rule_cmd route_set_tag_cmd = {
9d303b37 545 "tag", route_set_tag, route_map_rule_tag_compile,
d62a17ae 546 route_map_rule_tag_free,
0d9551dc
DS
547};
548
718e3744 549DEFUN (set_metric_type,
550 set_metric_type_cmd,
6147e2c6 551 "set metric-type <type-1|type-2>",
718e3744 552 SET_STR
553 "Type of metric for destination routing protocol\n"
73ffb25b 554 "OSPF[6] external type 1 metric\n"
555 "OSPF[6] external type 2 metric\n")
718e3744 556{
d62a17ae 557 char *ext = argv[2]->text;
558 return generic_set_add(vty, VTY_GET_CONTEXT(route_map_index),
559 "metric-type", ext);
718e3744 560}
561
562DEFUN (no_set_metric_type,
563 no_set_metric_type_cmd,
692b4c65 564 "no set metric-type [<type-1|type-2>]",
718e3744 565 NO_STR
566 SET_STR
ff788d08 567 "Type of metric for destination routing protocol\n"
692b4c65 568 "OSPF[6] external type 1 metric\n"
ff788d08 569 "OSPF[6] external type 2 metric\n")
718e3744 570{
d62a17ae 571 char *ext = (argc == 4) ? argv[3]->text : NULL;
572 return generic_set_delete(vty, VTY_GET_CONTEXT(route_map_index),
573 "metric-type", ext);
0d9551dc
DS
574}
575
718e3744 576/* Route-map init */
d62a17ae 577void ospf_route_map_init(void)
718e3744 578{
d62a17ae 579 route_map_init();
580
581 route_map_add_hook(ospf_route_map_update);
582 route_map_delete_hook(ospf_route_map_update);
583 route_map_event_hook(ospf_route_map_event);
718e3744 584
d62a17ae 585 route_map_set_metric_hook(generic_set_add);
586 route_map_no_set_metric_hook(generic_set_delete);
82f97584 587
d62a17ae 588 route_map_match_ip_next_hop_hook(generic_match_add);
589 route_map_no_match_ip_next_hop_hook(generic_match_delete);
58b0878a 590
d62a17ae 591 route_map_match_interface_hook(generic_match_add);
592 route_map_no_match_interface_hook(generic_match_delete);
58b0878a 593
d62a17ae 594 route_map_match_ip_address_hook(generic_match_add);
595 route_map_no_match_ip_address_hook(generic_match_delete);
82f97584 596
d62a17ae 597 route_map_match_ip_address_prefix_list_hook(generic_match_add);
598 route_map_no_match_ip_address_prefix_list_hook(generic_match_delete);
82f97584 599
d62a17ae 600 route_map_match_ip_next_hop_prefix_list_hook(generic_match_add);
601 route_map_no_match_ip_next_hop_prefix_list_hook(generic_match_delete);
82f97584 602
2d818099
DA
603 route_map_match_ip_next_hop_type_hook(generic_match_add);
604 route_map_no_match_ip_next_hop_type_hook(generic_match_delete);
605
d62a17ae 606 route_map_match_tag_hook(generic_match_add);
607 route_map_no_match_tag_hook(generic_match_delete);
82f97584 608
d62a17ae 609 route_map_set_metric_hook(generic_set_add);
610 route_map_no_set_metric_hook(generic_set_delete);
82f97584 611
d62a17ae 612 route_map_set_tag_hook(generic_set_add);
613 route_map_no_set_tag_hook(generic_set_delete);
82f97584 614
d62a17ae 615 route_map_install_match(&route_match_ip_nexthop_cmd);
616 route_map_install_match(&route_match_ip_next_hop_prefix_list_cmd);
617 route_map_install_match(&route_match_ip_address_cmd);
618 route_map_install_match(&route_match_ip_address_prefix_list_cmd);
2d818099 619 route_map_install_match(&route_match_ip_next_hop_type_cmd);
d62a17ae 620 route_map_install_match(&route_match_interface_cmd);
621 route_map_install_match(&route_match_tag_cmd);
718e3744 622
d62a17ae 623 route_map_install_set(&route_set_metric_cmd);
624 route_map_install_set(&route_set_metric_type_cmd);
625 route_map_install_set(&route_set_tag_cmd);
718e3744 626
d62a17ae 627 install_element(RMAP_NODE, &set_metric_type_cmd);
628 install_element(RMAP_NODE, &no_set_metric_type_cmd);
718e3744 629}