2 * Copyright (C) 2006 IBM Corporation
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 #include "zebra_memory.h"
36 #include "zebra/zserv.h"
37 #include "zebra/redistribute.h"
38 #include "zebra/debug.h"
39 #include "zebra/zebra_rnh.h"
40 #include "zebra/zebra_routemap.h"
42 static u_int32_t zebra_rmap_update_timer
= ZEBRA_RMAP_DEFAULT_UPDATE_TIMER
;
43 static struct thread
*zebra_t_rmap_update
= NULL
;
44 char *proto_rm
[AFI_MAX
][ZEBRA_ROUTE_MAX
+1]; /* "any" == ZEBRA_ROUTE_MAX */
45 /* NH Tracking route map */
46 char *nht_rm
[AFI_MAX
][ZEBRA_ROUTE_MAX
+1]; /* "any" == ZEBRA_ROUTE_MAX */
47 char *zebra_import_table_routemap
[AFI_MAX
][ZEBRA_KERNEL_TABLE_MAX
];
51 struct nexthop
*nexthop
;
53 u_int32_t source_protocol
;
58 static void zebra_route_map_set_delay_timer(u_int32_t value
);
62 /* Add zebra route map rule */
64 zebra_route_match_add(struct vty
*vty
,
65 const char *command
, const char *arg
,
66 route_map_event_t type
)
68 VTY_DECLVAR_CONTEXT (route_map_index
, index
);
71 ret
= route_map_add_match (index
, command
, arg
);
76 case RMAP_RULE_MISSING
:
77 vty_out (vty
, "%% Zebra Can't find rule.%s", VTY_NEWLINE
);
79 case RMAP_COMPILE_ERROR
:
80 vty_out (vty
, "%% Zebra Argument is malformed.%s", VTY_NEWLINE
);
85 if (type
!= RMAP_EVENT_MATCH_ADDED
)
87 route_map_upd8_dependency (type
, arg
, index
->map
->name
);
92 /* Delete zebra route map rule. */
94 zebra_route_match_delete (struct vty
*vty
,
95 const char *command
, const char *arg
,
96 route_map_event_t type
)
98 VTY_DECLVAR_CONTEXT (route_map_index
, index
);
100 char *dep_name
= NULL
;
102 char *rmap_name
= NULL
;
104 if (type
!= RMAP_EVENT_MATCH_DELETED
)
106 /* ignore the mundane, the types without any dependency */
109 if ((tmpstr
= route_map_get_match_arg(index
, command
)) != NULL
)
110 dep_name
= XSTRDUP(MTYPE_ROUTE_MAP_RULE
, tmpstr
);
114 dep_name
= XSTRDUP(MTYPE_ROUTE_MAP_RULE
, arg
);
116 rmap_name
= XSTRDUP(MTYPE_ROUTE_MAP_NAME
, index
->map
->name
);
119 ret
= route_map_delete_match (index
, command
, arg
);
124 case RMAP_RULE_MISSING
:
125 vty_out (vty
, "%% Zebra Can't find rule.%s", VTY_NEWLINE
);
127 case RMAP_COMPILE_ERROR
:
128 vty_out (vty
, "%% Zebra Argument is malformed.%s", VTY_NEWLINE
);
133 if (type
!= RMAP_EVENT_MATCH_DELETED
&& dep_name
)
134 route_map_upd8_dependency(type
, dep_name
, rmap_name
);
137 XFREE(MTYPE_ROUTE_MAP_RULE
, dep_name
);
139 XFREE(MTYPE_ROUTE_MAP_NAME
, rmap_name
);
145 * Match function return 1 if match is success else return 0
147 static route_map_result_t
148 route_match_tag (void *rule
, struct prefix
*prefix
,
149 route_map_object_t type
, void *object
)
152 struct nh_rmap_obj
*nh_data
;
154 if (type
== RMAP_ZEBRA
)
159 if (nh_data
->tag
== *tag
)
165 /* Route map commands for tag matching */
166 static struct route_map_rule_cmd route_match_tag_cmd
=
170 route_map_rule_tag_compile
,
171 route_map_rule_tag_free
,
175 /* `match interface IFNAME' */
176 /* Match function return 1 if match is success else return zero. */
177 static route_map_result_t
178 route_match_interface (void *rule
, struct prefix
*prefix
,
179 route_map_object_t type
, void *object
)
181 struct nh_rmap_obj
*nh_data
;
185 if (type
== RMAP_ZEBRA
)
187 if (strcasecmp(ifname
, "any") == 0)
190 if (!nh_data
|| !nh_data
->nexthop
)
192 ifindex
= ifname2ifindex (ifname
, nh_data
->vrf_id
);
195 if (nh_data
->nexthop
->ifindex
== ifindex
)
201 /* Route map `match interface' match statement. `arg' is IFNAME value */
203 route_match_interface_compile (const char *arg
)
205 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
208 /* Free route map's compiled `match interface' value. */
210 route_match_interface_free (void *rule
)
212 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
215 /* Route map commands for interface matching */
216 struct route_map_rule_cmd route_match_interface_cmd
=
219 route_match_interface
,
220 route_match_interface_compile
,
221 route_match_interface_free
224 DEFUN (match_ip_address_prefix_len
,
225 match_ip_address_prefix_len_cmd
,
226 "match ip address prefix-len (0-32)",
229 "Match prefix length of ip address\n"
230 "Match prefix length of ip address\n"
233 return zebra_route_match_add (vty
, "ip address prefix-len",
234 argv
[4]->arg
, RMAP_EVENT_MATCH_ADDED
);
237 DEFUN (no_match_ip_address_prefix_len
,
238 no_match_ip_address_prefix_len_cmd
,
239 "no match ip address prefix-len [(0-32)]",
243 "Match prefix length of ip address\n"
244 "Match prefix length of ip address\n"
247 char *plen
= (argc
== 6) ? argv
[5]->arg
: NULL
;
248 return zebra_route_match_delete (vty
,
249 "ip address prefix-len", plen
,
250 RMAP_EVENT_MATCH_DELETED
);
254 DEFUN (match_ip_nexthop_prefix_len
,
255 match_ip_nexthop_prefix_len_cmd
,
256 "match ip next-hop prefix-len (0-32)",
259 "Match prefixlen of nexthop ip address\n"
260 "Match prefixlen of given nexthop\n"
263 return zebra_route_match_add (vty
, "ip next-hop prefix-len",
264 argv
[4]->arg
, RMAP_EVENT_MATCH_ADDED
);
267 DEFUN (no_match_ip_nexthop_prefix_len
,
268 no_match_ip_nexthop_prefix_len_cmd
,
269 "no match ip next-hop prefix-len [(0-32)]",
273 "Match prefixlen of nexthop ip address\n"
274 "Match prefix length of nexthop\n"
277 char *plen
= (argc
== 6) ? argv
[5]->arg
: NULL
;
278 return zebra_route_match_delete (vty
,
279 "ip next-hop prefix-len", plen
,
280 RMAP_EVENT_MATCH_DELETED
);
284 DEFUN (match_source_protocol
,
285 match_source_protocol_cmd
,
286 "match source-protocol <bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static>",
288 "Match protocol via which the route was learnt\n"
295 "Routes from directly connected peer\n"
296 "Routes from system configuration\n"
297 "Routes from kernel\n"
298 "Statically configured routes\n")
300 char *proto
= argv
[2]->text
;
303 i
= proto_name2num(proto
);
306 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
309 return zebra_route_match_add (vty
, "source-protocol", proto
, RMAP_EVENT_MATCH_ADDED
);
312 DEFUN (no_match_source_protocol
,
313 no_match_source_protocol_cmd
,
314 "no match source-protocol [<bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static>]",
317 "No match protocol via which the route was learnt\n"
324 "Routes from directly connected peer\n"
325 "Routes from system configuration\n"
326 "Routes from kernel\n"
327 "Statically configured routes\n")
329 char *proto
= (argc
== 4) ? argv
[3]->text
: NULL
;
330 return zebra_route_match_delete (vty
, "source-protocol", proto
, RMAP_EVENT_MATCH_DELETED
);
337 "set src <A.B.C.D|X:X::X:X>",
339 "src address for route\n"
341 "IPv6 src address\n")
345 struct interface
*pif
= NULL
;
350 if (inet_pton(AF_INET
, argv
[idx_ip
]->arg
, &src
.ipv4
) != 1)
352 if (inet_pton(AF_INET6
, argv
[idx_ip
]->arg
, &src
.ipv6
) != 1)
354 vty_out (vty
, "%% not a valid IPv4/v6 address%s", VTY_NEWLINE
);
358 p
.family
= family
= AF_INET6
;
359 p
.u
.prefix6
= src
.ipv6
;
360 p
.prefixlen
= IPV6_MAX_BITLEN
;
364 p
.family
= family
= AF_INET
;
365 p
.u
.prefix4
= src
.ipv4
;
366 p
.prefixlen
= IPV4_MAX_BITLEN
;
369 if (!zebra_check_addr(&p
))
371 vty_out (vty
, "%% not a valid source IPv4/v6 address%s", VTY_NEWLINE
);
375 RB_FOREACH (vrf
, vrf_id_head
, &vrfs_by_id
)
377 if (family
== AF_INET
)
378 pif
= if_lookup_exact_address ((void *)&src
.ipv4
, AF_INET
,
380 else if (family
== AF_INET6
)
381 pif
= if_lookup_exact_address ((void *)&src
.ipv6
, AF_INET6
,
390 vty_out (vty
, "%% not a local address%s", VTY_NEWLINE
);
394 VTY_DECLVAR_CONTEXT (route_map_index
, index
);
395 return generic_set_add (vty
, index
, "src", argv
[idx_ip
]->arg
);
400 "no set src [<A.B.C.D|X:X::X:X>]",
403 "Source address for route\n"
407 char *ip
= (argc
== 4) ? argv
[3]->arg
: NULL
;
408 VTY_DECLVAR_CONTEXT (route_map_index
, index
);
409 return generic_set_delete (vty
, index
, "src", ip
);
412 DEFUN (zebra_route_map_timer
,
413 zebra_route_map_timer_cmd
,
414 "zebra route-map delay-timer (0-600)",
415 "Zebra information\n"
416 "Set route-map parameters\n"
417 "Time to wait before route-map updates are processed\n"
418 "0 means event-driven updates are disabled\n")
421 u_int32_t rmap_delay_timer
;
423 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer
, argv
[idx_number
]->arg
, 0, 600);
424 zebra_route_map_set_delay_timer(rmap_delay_timer
);
426 return (CMD_SUCCESS
);
429 DEFUN (no_zebra_route_map_timer
,
430 no_zebra_route_map_timer_cmd
,
431 "no zebra route-map delay-timer [(0-600)]",
433 "Zebra information\n"
434 "Set route-map parameters\n"
435 "Reset delay-timer to default value, 30 secs\n"
436 "0 means event-driven updates are disabled\n")
438 zebra_route_map_set_delay_timer(ZEBRA_RMAP_DEFAULT_UPDATE_TIMER
);
440 return (CMD_SUCCESS
);
446 "ip protocol " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
" route-map ROUTE-MAP",
448 "Filter routing info exchanged between zebra and protocol\n"
449 FRR_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
450 "Specify route-map\n"
453 char *proto
= argv
[2]->text
;
454 char *rmap
= argv
[4]->arg
;
457 if (strcasecmp(proto
, "any") == 0)
460 i
= proto_name2num(proto
);
463 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
466 if (proto_rm
[AFI_IP
][i
])
468 if (strcmp(proto_rm
[AFI_IP
][i
], rmap
) == 0)
471 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP
][i
]);
473 proto_rm
[AFI_IP
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap
);
475 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
476 zlog_debug ("%u: IPv4 Routemap config for protocol %s, scheduling RIB processing",
479 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
483 DEFUN (no_ip_protocol
,
485 "no ip protocol " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
" [route-map ROUTE-MAP]",
488 "Stop filtering routing info between zebra and protocol\n"
489 FRR_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
490 "Specify route map\n"
493 char *proto
= argv
[3]->text
;
494 char *rmap
= (argc
== 6) ? argv
[5]->arg
: NULL
;
497 if (strcasecmp(proto
, "any") == 0)
500 i
= proto_name2num(proto
);
504 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
508 if (!proto_rm
[AFI_IP
][i
])
511 if (!rmap
|| strcmp (rmap
, proto_rm
[AFI_IP
][i
]) == 0)
513 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP
][i
]);
514 proto_rm
[AFI_IP
][i
] = NULL
;
516 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
517 zlog_debug ("%u: IPv4 Routemap unconfig for protocol %s, scheduling RIB processing",
519 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
524 DEFUN (show_ip_protocol
,
525 show_ip_protocol_cmd
,
529 "IP protocol filtering status\n")
533 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
534 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
535 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
537 if (proto_rm
[AFI_IP
][i
])
538 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
542 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
544 if (proto_rm
[AFI_IP
][i
])
545 vty_out (vty
, "%-10s : %-10s%s", "any", proto_rm
[AFI_IP
][i
],
548 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
553 DEFUN (ipv6_protocol
,
555 "ipv6 protocol " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA
" route-map ROUTE-MAP",
557 "Filter IPv6 routing info exchanged between zebra and protocol\n"
558 FRR_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
559 "Specify route map\n"
562 char *proto
= argv
[2]->text
;
563 char *rmap
= argv
[4]->arg
;
566 if (strcasecmp(proto
, "any") == 0)
569 i
= proto_name2num(proto
);
572 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
575 if (proto_rm
[AFI_IP6
][i
])
577 if (strcmp(proto_rm
[AFI_IP6
][i
], rmap
) == 0)
580 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP6
][i
]);
582 proto_rm
[AFI_IP6
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap
);
584 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
585 zlog_debug ("%u: IPv6 Routemap config for protocol %s, scheduling RIB processing",
588 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
592 DEFUN (no_ipv6_protocol
,
593 no_ipv6_protocol_cmd
,
594 "no ipv6 protocol " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA
" [route-map ROUTE-MAP]",
597 "Stop filtering IPv6 routing info between zebra and protocol\n"
598 FRR_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
599 "Specify route map\n"
602 const char *proto
= argv
[3]->text
;
603 const char *rmap
= (argc
== 6) ? argv
[5]->arg
: NULL
;
606 if (strcasecmp(proto
, "any") == 0)
609 i
= proto_name2num(proto
);
612 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
615 if (!proto_rm
[AFI_IP6
][i
])
618 if (!rmap
|| strcmp(rmap
, proto_rm
[AFI_IP6
][i
]) == 0)
620 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP6
][i
]);
621 proto_rm
[AFI_IP6
][i
] = NULL
;
623 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
624 zlog_debug ("%u: IPv6 Routemap unconfig for protocol %s, scheduling RIB processing",
627 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
632 DEFUN (show_ipv6_protocol
,
633 show_ipv6_protocol_cmd
,
634 "show ipv6 protocol",
637 "IPv6 protocol filtering status\n")
641 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
642 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
643 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
645 if (proto_rm
[AFI_IP6
][i
])
646 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
647 proto_rm
[AFI_IP6
][i
],
650 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
652 if (proto_rm
[AFI_IP6
][i
])
653 vty_out (vty
, "%-10s : %-10s%s", "any", proto_rm
[AFI_IP6
][i
],
656 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
661 DEFUN (ip_protocol_nht_rmap
,
662 ip_protocol_nht_rmap_cmd
,
663 "ip nht " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
" route-map ROUTE-MAP",
665 "Filter Next Hop tracking route resolution\n"
666 FRR_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
667 "Specify route map\n"
670 char *proto
= argv
[2]->text
;
671 char *rmap
= argv
[4]->arg
;
674 if (strcasecmp(proto
, "any") == 0)
677 i
= proto_name2num(proto
);
680 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
683 if (nht_rm
[AFI_IP
][i
])
685 if (strcmp(nht_rm
[AFI_IP
][i
], rmap
) == 0)
688 XFREE (MTYPE_ROUTE_MAP_NAME
, nht_rm
[AFI_IP
][i
]);
691 nht_rm
[AFI_IP
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap
);
692 zebra_evaluate_rnh(0, AF_INET
, 1, RNH_NEXTHOP_TYPE
, NULL
);
697 DEFUN (no_ip_protocol_nht_rmap
,
698 no_ip_protocol_nht_rmap_cmd
,
699 "no ip nht " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
" [route-map ROUTE-MAP]",
702 "Filter Next Hop tracking route resolution\n"
703 FRR_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
704 "Specify route map\n"
708 char *proto
= argv
[3]->text
;
709 char *rmap
= argv_find (argv
, argc
, "ROUTE-MAP", &idx
) ? argv
[idx
]->arg
: NULL
;
711 int i
= strmatch(proto
, "any") ? ZEBRA_ROUTE_MAX
: proto_name2num(proto
);
715 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
719 if (!nht_rm
[AFI_IP
][i
])
722 if (!rmap
|| strcmp(rmap
, nht_rm
[AFI_IP
][i
]) == 0)
724 XFREE (MTYPE_ROUTE_MAP_NAME
, nht_rm
[AFI_IP
][i
]);
725 nht_rm
[AFI_IP
][i
] = NULL
;
726 zebra_evaluate_rnh(0, AF_INET
, 1, RNH_NEXTHOP_TYPE
, NULL
);
731 DEFUN (show_ip_protocol_nht
,
732 show_ip_protocol_nht_cmd
,
733 "show ip nht route-map",
736 "IP nexthop tracking table\n"
737 "IP Next Hop tracking filtering status\n")
741 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
742 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
743 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
745 if (nht_rm
[AFI_IP
][i
])
746 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
750 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
752 if (nht_rm
[AFI_IP
][i
])
753 vty_out (vty
, "%-10s : %-10s%s", "any", nht_rm
[AFI_IP
][i
],
756 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
761 DEFUN (ipv6_protocol_nht_rmap
,
762 ipv6_protocol_nht_rmap_cmd
,
763 "ipv6 nht " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA
" route-map ROUTE-MAP",
765 "Filter Next Hop tracking route resolution\n"
766 FRR_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
767 "Specify route map\n"
770 char *proto
= argv
[2]->text
;
771 char *rmap
= argv
[4]->arg
;
774 if (strcasecmp(proto
, "any") == 0)
777 i
= proto_name2num(proto
);
780 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
783 if (nht_rm
[AFI_IP6
][i
])
784 XFREE (MTYPE_ROUTE_MAP_NAME
, nht_rm
[AFI_IP6
][i
]);
785 nht_rm
[AFI_IP6
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap
);
786 zebra_evaluate_rnh(0, AF_INET6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
791 DEFUN (no_ipv6_protocol_nht_rmap
,
792 no_ipv6_protocol_nht_rmap_cmd
,
793 "no ipv6 nht " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA
" [route-map ROUTE-MAP]",
796 "Filter Next Hop tracking route resolution\n"
797 FRR_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
798 "Specify route map\n"
801 char *proto
= argv
[3]->text
;
802 char *rmap
= (argc
== 6) ? argv
[5]->arg
: NULL
;
805 if (strcasecmp(proto
, "any") == 0)
808 i
= proto_name2num(proto
);
811 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
815 if (nht_rm
[AFI_IP6
][i
] && rmap
&& strcmp(rmap
, nht_rm
[AFI_IP6
][i
]))
817 vty_out (vty
, "invalid route-map \"%s\"%s", rmap
, VTY_NEWLINE
);
821 if (nht_rm
[AFI_IP6
][i
])
823 XFREE (MTYPE_ROUTE_MAP_NAME
, nht_rm
[AFI_IP6
][i
]);
824 nht_rm
[AFI_IP6
][i
] = NULL
;
827 zebra_evaluate_rnh(0, AF_INET6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
832 DEFUN (show_ipv6_protocol_nht
,
833 show_ipv6_protocol_nht_cmd
,
834 "show ipv6 nht route-map",
837 "Next Hop filtering status\n"
842 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
843 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
844 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
846 if (nht_rm
[AFI_IP6
][i
])
847 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
851 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
853 if (nht_rm
[AFI_IP
][i
])
854 vty_out (vty
, "%-10s : %-10s%s", "any", nht_rm
[AFI_IP6
][i
],
857 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
862 /*XXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
864 /* `match ip next-hop IP_ACCESS_LIST' */
866 /* Match function return 1 if match is success else return zero. */
867 static route_map_result_t
868 route_match_ip_next_hop (void *rule
, struct prefix
*prefix
,
869 route_map_object_t type
, void *object
)
871 struct access_list
*alist
;
872 struct nh_rmap_obj
*nh_data
;
873 struct prefix_ipv4 p
;
875 if (type
== RMAP_ZEBRA
)
879 return RMAP_DENYMATCH
;
881 switch (nh_data
->nexthop
->type
) {
882 case NEXTHOP_TYPE_IFINDEX
:
883 /* Interface routes can't match ip next-hop */
885 case NEXTHOP_TYPE_IPV4_IFINDEX
:
886 case NEXTHOP_TYPE_IPV4
:
888 p
.prefix
= nh_data
->nexthop
->gate
.ipv4
;
889 p
.prefixlen
= IPV4_MAX_BITLEN
;
894 alist
= access_list_lookup (AFI_IP
, (char *) rule
);
898 return (access_list_apply (alist
, &p
) == FILTER_DENY
?
899 RMAP_NOMATCH
: RMAP_MATCH
);
904 /* Route map `ip next-hop' match statement. `arg' should be
907 route_match_ip_next_hop_compile (const char *arg
)
909 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
912 /* Free route map's compiled `. */
914 route_match_ip_next_hop_free (void *rule
)
916 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
919 /* Route map commands for ip next-hop matching. */
920 static struct route_map_rule_cmd route_match_ip_next_hop_cmd
=
923 route_match_ip_next_hop
,
924 route_match_ip_next_hop_compile
,
925 route_match_ip_next_hop_free
928 /* `match ip next-hop prefix-list PREFIX_LIST' */
930 static route_map_result_t
931 route_match_ip_next_hop_prefix_list (void *rule
, struct prefix
*prefix
,
932 route_map_object_t type
, void *object
)
934 struct prefix_list
*plist
;
935 struct nh_rmap_obj
*nh_data
;
936 struct prefix_ipv4 p
;
938 if (type
== RMAP_ZEBRA
)
940 nh_data
= (struct nh_rmap_obj
*)object
;
942 return RMAP_DENYMATCH
;
944 switch (nh_data
->nexthop
->type
) {
945 case NEXTHOP_TYPE_IFINDEX
:
946 /* Interface routes can't match ip next-hop */
948 case NEXTHOP_TYPE_IPV4_IFINDEX
:
949 case NEXTHOP_TYPE_IPV4
:
951 p
.prefix
= nh_data
->nexthop
->gate
.ipv4
;
952 p
.prefixlen
= IPV4_MAX_BITLEN
;
957 plist
= prefix_list_lookup (AFI_IP
, (char *) rule
);
961 return (prefix_list_apply (plist
, &p
) == PREFIX_DENY
?
962 RMAP_NOMATCH
: RMAP_MATCH
);
968 route_match_ip_next_hop_prefix_list_compile (const char *arg
)
970 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
974 route_match_ip_next_hop_prefix_list_free (void *rule
)
976 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
979 static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd
=
981 "ip next-hop prefix-list",
982 route_match_ip_next_hop_prefix_list
,
983 route_match_ip_next_hop_prefix_list_compile
,
984 route_match_ip_next_hop_prefix_list_free
987 /* `match ip address IP_ACCESS_LIST' */
989 /* Match function should return 1 if match is success else return
991 static route_map_result_t
992 route_match_ip_address (void *rule
, struct prefix
*prefix
,
993 route_map_object_t type
, void *object
)
995 struct access_list
*alist
;
997 if (type
== RMAP_ZEBRA
)
999 alist
= access_list_lookup (AFI_IP
, (char *) rule
);
1001 return RMAP_NOMATCH
;
1003 return (access_list_apply (alist
, prefix
) == FILTER_DENY
?
1004 RMAP_NOMATCH
: RMAP_MATCH
);
1006 return RMAP_NOMATCH
;
1009 /* Route map `ip address' match statement. `arg' should be
1010 access-list name. */
1012 route_match_ip_address_compile (const char *arg
)
1014 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
1017 /* Free route map's compiled `ip address' value. */
1019 route_match_ip_address_free (void *rule
)
1021 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1024 /* Route map commands for ip address matching. */
1025 static struct route_map_rule_cmd route_match_ip_address_cmd
=
1028 route_match_ip_address
,
1029 route_match_ip_address_compile
,
1030 route_match_ip_address_free
1033 /* `match ip address prefix-list PREFIX_LIST' */
1035 static route_map_result_t
1036 route_match_ip_address_prefix_list (void *rule
, struct prefix
*prefix
,
1037 route_map_object_t type
, void *object
)
1039 struct prefix_list
*plist
;
1041 if (type
== RMAP_ZEBRA
)
1043 plist
= prefix_list_lookup (AFI_IP
, (char *) rule
);
1045 return RMAP_NOMATCH
;
1047 return (prefix_list_apply (plist
, prefix
) == PREFIX_DENY
?
1048 RMAP_NOMATCH
: RMAP_MATCH
);
1050 return RMAP_NOMATCH
;
1054 route_match_ip_address_prefix_list_compile (const char *arg
)
1056 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
1060 route_match_ip_address_prefix_list_free (void *rule
)
1062 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1065 static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd
=
1067 "ip address prefix-list",
1068 route_match_ip_address_prefix_list
,
1069 route_match_ip_address_prefix_list_compile
,
1070 route_match_ip_address_prefix_list_free
1074 /* `match ip address prefix-len PREFIXLEN' */
1076 static route_map_result_t
1077 route_match_ip_address_prefix_len (void *rule
, struct prefix
*prefix
,
1078 route_map_object_t type
, void *object
)
1080 u_int32_t
*prefixlen
= (u_int32_t
*)rule
;
1082 if (type
== RMAP_ZEBRA
)
1084 return ((prefix
->prefixlen
== *prefixlen
) ? RMAP_MATCH
: RMAP_NOMATCH
);
1086 return RMAP_NOMATCH
;
1090 route_match_ip_address_prefix_len_compile (const char *arg
)
1092 u_int32_t
*prefix_len
;
1093 char *endptr
= NULL
;
1094 unsigned long tmpval
;
1096 /* prefix len value shoud be integer. */
1097 if (! all_digit (arg
))
1101 tmpval
= strtoul (arg
, &endptr
, 10);
1102 if (*endptr
!= '\0' || errno
|| tmpval
> UINT32_MAX
)
1105 prefix_len
= XMALLOC (MTYPE_ROUTE_MAP_COMPILED
, sizeof (u_int32_t
));
1110 *prefix_len
= tmpval
;
1115 route_match_ip_address_prefix_len_free (void *rule
)
1117 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1120 static struct route_map_rule_cmd route_match_ip_address_prefix_len_cmd
=
1122 "ip address prefix-len",
1123 route_match_ip_address_prefix_len
,
1124 route_match_ip_address_prefix_len_compile
,
1125 route_match_ip_address_prefix_len_free
1129 /* `match ip nexthop prefix-len PREFIXLEN' */
1131 static route_map_result_t
1132 route_match_ip_nexthop_prefix_len (void *rule
, struct prefix
*prefix
,
1133 route_map_object_t type
, void *object
)
1135 u_int32_t
*prefixlen
= (u_int32_t
*)rule
;
1136 struct nh_rmap_obj
*nh_data
;
1137 struct prefix_ipv4 p
;
1139 if (type
== RMAP_ZEBRA
)
1141 nh_data
= (struct nh_rmap_obj
*)object
;
1142 if (!nh_data
|| !nh_data
->nexthop
)
1143 return RMAP_DENYMATCH
;
1145 switch (nh_data
->nexthop
->type
) {
1146 case NEXTHOP_TYPE_IFINDEX
:
1147 /* Interface routes can't match ip next-hop */
1148 return RMAP_NOMATCH
;
1149 case NEXTHOP_TYPE_IPV4_IFINDEX
:
1150 case NEXTHOP_TYPE_IPV4
:
1152 p
.prefix
= nh_data
->nexthop
->gate
.ipv4
;
1153 p
.prefixlen
= IPV4_MAX_BITLEN
;
1156 return RMAP_NOMATCH
;
1158 return ((p
.prefixlen
== *prefixlen
) ? RMAP_MATCH
: RMAP_NOMATCH
);
1160 return RMAP_NOMATCH
;
1163 static struct route_map_rule_cmd route_match_ip_nexthop_prefix_len_cmd
=
1165 "ip next-hop prefix-len",
1166 route_match_ip_nexthop_prefix_len
,
1167 route_match_ip_address_prefix_len_compile
, /* reuse */
1168 route_match_ip_address_prefix_len_free
/* reuse */
1171 /* `match source-protocol PROTOCOL' */
1173 static route_map_result_t
1174 route_match_source_protocol (void *rule
, struct prefix
*prefix
,
1175 route_map_object_t type
, void *object
)
1177 u_int32_t
*rib_type
= (u_int32_t
*)rule
;
1178 struct nh_rmap_obj
*nh_data
;
1180 if (type
== RMAP_ZEBRA
)
1182 nh_data
= (struct nh_rmap_obj
*)object
;
1184 return RMAP_DENYMATCH
;
1186 return ((nh_data
->source_protocol
== *rib_type
)
1187 ? RMAP_MATCH
: RMAP_NOMATCH
);
1189 return RMAP_NOMATCH
;
1193 route_match_source_protocol_compile (const char *arg
)
1195 u_int32_t
*rib_type
;
1198 i
= proto_name2num(arg
);
1199 rib_type
= XMALLOC (MTYPE_ROUTE_MAP_COMPILED
, sizeof (u_int32_t
));
1207 route_match_source_protocol_free (void *rule
)
1209 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1212 static struct route_map_rule_cmd route_match_source_protocol_cmd
=
1215 route_match_source_protocol
,
1216 route_match_source_protocol_compile
,
1217 route_match_source_protocol_free
1220 /* `set src A.B.C.D' */
1223 static route_map_result_t
1224 route_set_src (void *rule
, struct prefix
*prefix
,
1225 route_map_object_t type
, void *object
)
1227 struct nh_rmap_obj
*nh_data
;
1229 if (type
== RMAP_ZEBRA
)
1231 nh_data
= (struct nh_rmap_obj
*)object
;
1232 nh_data
->nexthop
->rmap_src
= *(union g_addr
*)rule
;
1237 /* set src compilation. */
1239 route_set_src_compile (const char *arg
)
1241 union g_addr src
, *psrc
;
1243 if ((inet_pton(AF_INET6
, arg
, &src
.ipv6
) == 1) ||
1244 (src
.ipv4
.s_addr
&& (inet_pton(AF_INET
, arg
, &src
.ipv4
) == 1)))
1246 psrc
= XMALLOC (MTYPE_ROUTE_MAP_COMPILED
, sizeof (union g_addr
));
1253 /* Free route map's compiled `set src' value. */
1255 route_set_src_free (void *rule
)
1257 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1260 /* Set src rule structure. */
1261 static struct route_map_rule_cmd route_set_src_cmd
=
1265 route_set_src_compile
,
1270 zebra_route_map_update_timer (struct thread
*thread
)
1272 zebra_t_rmap_update
= NULL
;
1274 if (IS_ZEBRA_DEBUG_EVENT
)
1275 zlog_debug("Event driven route-map update triggered");
1277 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
1278 zlog_debug ("%u: Routemap update-timer fired, scheduling RIB processing",
1281 zebra_import_table_rm_update ();
1282 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
1283 zebra_evaluate_rnh(0, AF_INET
, 1, RNH_NEXTHOP_TYPE
, NULL
);
1284 zebra_evaluate_rnh(0, AF_INET6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
1290 zebra_route_map_set_delay_timer(u_int32_t value
)
1292 zebra_rmap_update_timer
= value
;
1293 if (!value
&& zebra_t_rmap_update
)
1295 /* Event driven route map updates is being disabled */
1296 /* But there's a pending timer. Fire it off now */
1297 thread_cancel(zebra_t_rmap_update
);
1298 zebra_route_map_update_timer(zebra_t_rmap_update
);
1303 zebra_route_map_write_delay_timer (struct vty
*vty
)
1305 if (vty
&& (zebra_rmap_update_timer
!= ZEBRA_RMAP_DEFAULT_UPDATE_TIMER
))
1306 vty_out (vty
, "zebra route-map delay-timer %d%s", zebra_rmap_update_timer
,
1312 zebra_route_map_check (int family
, int rib_type
, struct prefix
*p
,
1313 struct nexthop
*nexthop
, vrf_id_t vrf_id
, route_tag_t tag
)
1315 struct route_map
*rmap
= NULL
;
1316 route_map_result_t ret
= RMAP_MATCH
;
1317 struct nh_rmap_obj nh_obj
;
1319 nh_obj
.nexthop
= nexthop
;
1320 nh_obj
.vrf_id
= vrf_id
;
1321 nh_obj
.source_protocol
= rib_type
;
1325 if (rib_type
>= 0 && rib_type
< ZEBRA_ROUTE_MAX
)
1326 rmap
= route_map_lookup_by_name (proto_rm
[family
][rib_type
]);
1327 if (!rmap
&& proto_rm
[family
][ZEBRA_ROUTE_MAX
])
1328 rmap
= route_map_lookup_by_name (proto_rm
[family
][ZEBRA_ROUTE_MAX
]);
1330 ret
= route_map_apply(rmap
, p
, RMAP_ZEBRA
, &nh_obj
);
1337 zebra_get_import_table_route_map (afi_t afi
, uint32_t table
)
1339 return zebra_import_table_routemap
[afi
][table
];
1343 zebra_add_import_table_route_map (afi_t afi
, const char *rmap_name
, uint32_t table
)
1345 zebra_import_table_routemap
[afi
][table
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap_name
);
1349 zebra_del_import_table_route_map (afi_t afi
, uint32_t table
)
1351 XFREE (MTYPE_ROUTE_MAP_NAME
, zebra_import_table_routemap
[afi
][table
]);
1355 zebra_import_table_route_map_check (int family
, int rib_type
, struct prefix
*p
,
1356 struct nexthop
*nexthop
, vrf_id_t vrf_id
, route_tag_t tag
, const char *rmap_name
)
1358 struct route_map
*rmap
= NULL
;
1359 route_map_result_t ret
= RMAP_DENYMATCH
;
1360 struct nh_rmap_obj nh_obj
;
1362 nh_obj
.nexthop
= nexthop
;
1363 nh_obj
.vrf_id
= vrf_id
;
1364 nh_obj
.source_protocol
= rib_type
;
1368 if (rib_type
>= 0 && rib_type
< ZEBRA_ROUTE_MAX
)
1369 rmap
= route_map_lookup_by_name (rmap_name
);
1371 ret
= route_map_apply(rmap
, p
, RMAP_ZEBRA
, &nh_obj
);
1378 zebra_nht_route_map_check (int family
, int client_proto
, struct prefix
*p
,
1379 struct rib
* rib
, struct nexthop
*nexthop
)
1381 struct route_map
*rmap
= NULL
;
1382 route_map_result_t ret
= RMAP_MATCH
;
1383 struct nh_rmap_obj nh_obj
;
1385 nh_obj
.nexthop
= nexthop
;
1386 nh_obj
.vrf_id
= rib
->vrf_id
;
1387 nh_obj
.source_protocol
= rib
->type
;
1388 nh_obj
.metric
= rib
->metric
;
1389 nh_obj
.tag
= rib
->tag
;
1391 if (client_proto
>= 0 && client_proto
< ZEBRA_ROUTE_MAX
)
1392 rmap
= route_map_lookup_by_name (nht_rm
[family
][client_proto
]);
1393 if (!rmap
&& nht_rm
[family
][ZEBRA_ROUTE_MAX
])
1394 rmap
= route_map_lookup_by_name (nht_rm
[family
][ZEBRA_ROUTE_MAX
]);
1396 ret
= route_map_apply(rmap
, p
, RMAP_ZEBRA
, &nh_obj
);
1403 zebra_route_map_mark_update (const char *rmap_name
)
1405 /* rmap_update_timer of 0 means don't do route updates */
1406 if (zebra_rmap_update_timer
&& !zebra_t_rmap_update
)
1407 zebra_t_rmap_update
=
1408 thread_add_timer(zebrad
.master
, zebra_route_map_update_timer
, NULL
,
1409 zebra_rmap_update_timer
);
1413 zebra_route_map_add (const char *rmap_name
)
1415 zebra_route_map_mark_update(rmap_name
);
1416 route_map_notify_dependencies(rmap_name
, RMAP_EVENT_MATCH_ADDED
);
1420 zebra_route_map_delete (const char *rmap_name
)
1422 zebra_route_map_mark_update(rmap_name
);
1423 route_map_notify_dependencies(rmap_name
, RMAP_EVENT_MATCH_DELETED
);
1427 zebra_route_map_event (route_map_event_t event
, const char *rmap_name
)
1429 zebra_route_map_mark_update(rmap_name
);
1430 route_map_notify_dependencies(rmap_name
, RMAP_EVENT_MATCH_ADDED
);
1433 /* ip protocol configuration write function */
1435 zebra_routemap_config_write_protocol (struct vty
*vty
)
1439 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
1441 if (proto_rm
[AFI_IP
][i
])
1442 vty_out (vty
, "ip protocol %s route-map %s%s", zebra_route_string(i
),
1443 proto_rm
[AFI_IP
][i
], VTY_NEWLINE
);
1445 if (proto_rm
[AFI_IP6
][i
])
1446 vty_out (vty
, "ipv6 protocol %s route-map %s%s", zebra_route_string(i
),
1447 proto_rm
[AFI_IP6
][i
], VTY_NEWLINE
);
1449 if (nht_rm
[AFI_IP
][i
])
1450 vty_out (vty
, "ip nht %s route-map %s%s", zebra_route_string(i
),
1451 nht_rm
[AFI_IP
][i
], VTY_NEWLINE
);
1453 if (nht_rm
[AFI_IP6
][i
])
1454 vty_out (vty
, "ipv6 nht %s route-map %s%s", zebra_route_string(i
),
1455 nht_rm
[AFI_IP6
][i
], VTY_NEWLINE
);
1458 if (proto_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
])
1459 vty_out (vty
, "ip protocol %s route-map %s%s", "any",
1460 proto_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
1462 if (proto_rm
[AFI_IP6
][ZEBRA_ROUTE_MAX
])
1463 vty_out (vty
, "ipv6 protocol %s route-map %s%s", "any",
1464 proto_rm
[AFI_IP6
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
1466 if (nht_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
])
1467 vty_out (vty
, "ip nht %s route-map %s%s", "any",
1468 nht_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
1470 if (nht_rm
[AFI_IP6
][ZEBRA_ROUTE_MAX
])
1471 vty_out (vty
, "ipv6 nht %s route-map %s%s", "any",
1472 nht_rm
[AFI_IP6
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
1474 if (zebra_rmap_update_timer
!= ZEBRA_RMAP_DEFAULT_UPDATE_TIMER
)
1475 vty_out (vty
, "zebra route-map delay-timer %d%s", zebra_rmap_update_timer
,
1480 zebra_route_map_init ()
1482 install_element (CONFIG_NODE
, &ip_protocol_cmd
);
1483 install_element (CONFIG_NODE
, &no_ip_protocol_cmd
);
1484 install_element (VIEW_NODE
, &show_ip_protocol_cmd
);
1485 install_element (CONFIG_NODE
, &ipv6_protocol_cmd
);
1486 install_element (CONFIG_NODE
, &no_ipv6_protocol_cmd
);
1487 install_element (VIEW_NODE
, &show_ipv6_protocol_cmd
);
1488 install_element (CONFIG_NODE
, &ip_protocol_nht_rmap_cmd
);
1489 install_element (CONFIG_NODE
, &no_ip_protocol_nht_rmap_cmd
);
1490 install_element (VIEW_NODE
, &show_ip_protocol_nht_cmd
);
1491 install_element (CONFIG_NODE
, &ipv6_protocol_nht_rmap_cmd
);
1492 install_element (CONFIG_NODE
, &no_ipv6_protocol_nht_rmap_cmd
);
1493 install_element (VIEW_NODE
, &show_ipv6_protocol_nht_cmd
);
1494 install_element (CONFIG_NODE
, &zebra_route_map_timer_cmd
);
1495 install_element (CONFIG_NODE
, &no_zebra_route_map_timer_cmd
);
1499 route_map_add_hook (zebra_route_map_add
);
1500 route_map_delete_hook (zebra_route_map_delete
);
1501 route_map_event_hook (zebra_route_map_event
);
1503 route_map_match_interface_hook (generic_match_add
);
1504 route_map_no_match_interface_hook (generic_match_delete
);
1506 route_map_match_ip_address_hook (generic_match_add
);
1507 route_map_no_match_ip_address_hook (generic_match_delete
);
1509 route_map_match_ip_address_prefix_list_hook (generic_match_add
);
1510 route_map_no_match_ip_address_prefix_list_hook (generic_match_delete
);
1512 route_map_match_ip_next_hop_hook (generic_match_add
);
1513 route_map_no_match_ip_next_hop_hook (generic_match_delete
);
1515 route_map_match_ip_next_hop_prefix_list_hook (generic_match_add
);
1516 route_map_no_match_ip_next_hop_prefix_list_hook (generic_match_delete
);
1518 route_map_match_tag_hook (generic_match_add
);
1519 route_map_no_match_tag_hook (generic_match_delete
);
1521 route_map_install_match (&route_match_tag_cmd
);
1522 route_map_install_match (&route_match_interface_cmd
);
1523 route_map_install_match (&route_match_ip_next_hop_cmd
);
1524 route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd
);
1525 route_map_install_match (&route_match_ip_address_cmd
);
1526 route_map_install_match (&route_match_ip_address_prefix_list_cmd
);
1527 route_map_install_match (&route_match_ip_address_prefix_len_cmd
);
1528 route_map_install_match (&route_match_ip_nexthop_prefix_len_cmd
);
1529 route_map_install_match (&route_match_source_protocol_cmd
);
1531 route_map_install_set (&route_set_src_cmd
);
1533 install_element (RMAP_NODE
, &match_ip_nexthop_prefix_len_cmd
);
1534 install_element (RMAP_NODE
, &no_match_ip_nexthop_prefix_len_cmd
);
1535 install_element (RMAP_NODE
, &match_ip_address_prefix_len_cmd
);
1536 install_element (RMAP_NODE
, &no_match_ip_address_prefix_len_cmd
);
1537 install_element (RMAP_NODE
, &match_source_protocol_cmd
);
1538 install_element (RMAP_NODE
, &no_match_source_protocol_cmd
);
1540 install_element (RMAP_NODE
, &set_src_cmd
);
1541 install_element (RMAP_NODE
, &no_set_src_cmd
);