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_vrf (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 prefixlen of ip address of route\n"
246 char *plen
= (argc
== 6) ? argv
[5]->arg
: NULL
;
247 return zebra_route_match_delete (vty
,
248 "ip address prefix-len", plen
,
249 RMAP_EVENT_MATCH_DELETED
);
253 DEFUN (match_ip_nexthop_prefix_len
,
254 match_ip_nexthop_prefix_len_cmd
,
255 "match ip next-hop prefix-len (0-32)",
258 "Match prefixlen of nexthop ip address\n"
259 "Match prefixlen of given nexthop\n"
262 return zebra_route_match_add (vty
, "ip next-hop prefix-len",
263 argv
[4]->arg
, RMAP_EVENT_MATCH_ADDED
);
266 DEFUN (no_match_ip_nexthop_prefix_len
,
267 no_match_ip_nexthop_prefix_len_cmd
,
268 "no match ip next-hop prefix-len [(0-32)]",
272 "Match prefixlen of nexthop ip address\n"
273 "Match prefix length of nexthop\n"
276 char *plen
= (argc
== 6) ? argv
[5]->arg
: NULL
;
277 return zebra_route_match_delete (vty
,
278 "ip next-hop prefix-len", plen
,
279 RMAP_EVENT_MATCH_DELETED
);
283 DEFUN (match_source_protocol
,
284 match_source_protocol_cmd
,
285 "match source-protocol <bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static>",
287 "Match protocol via which the route was learnt\n")
289 char *proto
= argv
[2]->text
;
292 i
= proto_name2num(proto
);
295 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
298 return zebra_route_match_add (vty
, "source-protocol", proto
, RMAP_EVENT_MATCH_ADDED
);
301 DEFUN (no_match_source_protocol
,
302 no_match_source_protocol_cmd
,
303 "no match source-protocol [<bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static>]",
306 "No match protocol via which the route was learnt\n"
309 char *proto
= (argc
== 4) ? argv
[3]->text
: NULL
;
310 return zebra_route_match_delete (vty
, "source-protocol", proto
, RMAP_EVENT_MATCH_DELETED
);
317 "set src <A.B.C.D|X:X::X:X>",
319 "src address for route\n"
324 struct interface
*pif
= NULL
;
329 if (inet_pton(AF_INET
, argv
[idx_ip
]->arg
, &src
.ipv4
) != 1)
331 if (inet_pton(AF_INET6
, argv
[idx_ip
]->arg
, &src
.ipv6
) != 1)
333 vty_out (vty
, "%% not a valid IPv4/v6 address%s", VTY_NEWLINE
);
337 p
.family
= family
= AF_INET6
;
338 p
.u
.prefix6
= src
.ipv6
;
339 p
.prefixlen
= IPV6_MAX_BITLEN
;
343 p
.family
= family
= AF_INET
;
344 p
.u
.prefix4
= src
.ipv4
;
345 p
.prefixlen
= IPV4_MAX_BITLEN
;
348 if (!zebra_check_addr(&p
))
350 vty_out (vty
, "%% not a valid source IPv4/v6 address%s", VTY_NEWLINE
);
354 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
356 if (family
== AF_INET
)
357 pif
= if_lookup_exact_address_vrf ((void *)&src
.ipv4
, AF_INET
,
359 else if (family
== AF_INET6
)
360 pif
= if_lookup_exact_address_vrf ((void *)&src
.ipv6
, AF_INET6
,
369 vty_out (vty
, "%% not a local address%s", VTY_NEWLINE
);
373 VTY_DECLVAR_CONTEXT (route_map_index
, index
);
374 return generic_set_add (vty
, index
, "src", argv
[idx_ip
]->arg
);
379 "no set src [<A.B.C.D|X:X::X:X>]",
382 "Source address for route\n")
384 char *ip
= (argc
== 4) ? argv
[3]->arg
: NULL
;
385 VTY_DECLVAR_CONTEXT (route_map_index
, index
);
386 return generic_set_delete (vty
, index
, "src", ip
);
389 DEFUN (zebra_route_map_timer
,
390 zebra_route_map_timer_cmd
,
391 "zebra route-map delay-timer (0-600)",
392 "Time to wait before route-map updates are processed\n"
393 "0 means event-driven updates are disabled\n")
396 u_int32_t rmap_delay_timer
;
398 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer
, argv
[idx_number
]->arg
, 0, 600);
399 zebra_route_map_set_delay_timer(rmap_delay_timer
);
401 return (CMD_SUCCESS
);
404 DEFUN (no_zebra_route_map_timer
,
405 no_zebra_route_map_timer_cmd
,
406 "no zebra route-map delay-timer [(0-600)]",
408 "Time to wait before route-map updates are processed\n"
409 "Reset delay-timer to default value, 30 secs\n"
410 "0 means event-driven updates are disabled\n")
413 zebra_route_map_set_delay_timer(ZEBRA_RMAP_DEFAULT_UPDATE_TIMER
);
415 return (CMD_SUCCESS
);
421 "ip protocol <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any> route-map ROUTE-MAP",
423 "Filter routing info exchanged between zebra and protocol\n"
424 QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
425 "Specify route-map\n"
428 char *proto
= argv
[2]->text
;
429 char *rmap
= argv
[4]->arg
;
432 if (strcasecmp(proto
, "any") == 0)
435 i
= proto_name2num(proto
);
438 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
441 if (proto_rm
[AFI_IP
][i
])
443 if (strcmp(proto_rm
[AFI_IP
][i
], rmap
) == 0)
446 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP
][i
]);
448 proto_rm
[AFI_IP
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap
);
450 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
451 zlog_debug ("%u: IPv4 Routemap config for protocol %s, scheduling RIB processing",
454 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
458 DEFUN (no_ip_protocol
,
460 "no ip protocol <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any> [route-map ROUTE-MAP]",
463 "Stop filtering routing info between zebra and protocol\n"
464 QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
465 "Specify route map\n"
468 char *proto
= argv
[3]->text
;
469 char *rmap
= (argc
== 6) ? argv
[5]->arg
: NULL
;
472 if (strcasecmp(proto
, "any") == 0)
475 i
= proto_name2num(proto
);
479 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
483 if (!proto_rm
[AFI_IP
][i
])
486 if (!rmap
|| strcmp (rmap
, proto_rm
[AFI_IP
][i
]) == 0)
488 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP
][i
]);
489 proto_rm
[AFI_IP
][i
] = NULL
;
491 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
492 zlog_debug ("%u: IPv4 Routemap unconfig for protocol %s, scheduling RIB processing",
494 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
500 DEFUN (show_ip_protocol
,
501 show_ip_protocol_cmd
,
505 "IP protocol filtering status\n")
509 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
510 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
511 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
513 if (proto_rm
[AFI_IP
][i
])
514 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
518 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
520 if (proto_rm
[AFI_IP
][i
])
521 vty_out (vty
, "%-10s : %-10s%s", "any", proto_rm
[AFI_IP
][i
],
524 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
529 DEFUN (ipv6_protocol
,
531 "ipv6 protocol <kernel|connected|static|ripng|ospf6|isis|bgp|table|any> route-map ROUTE-MAP",
533 "Filter IPv6 routing info exchanged between zebra and protocol\n"
534 QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
535 "Specify route map\n"
538 char *proto
= argv
[2]->text
;
539 char *rmap
= argv
[4]->arg
;
542 if (strcasecmp(proto
, "any") == 0)
545 i
= proto_name2num(proto
);
548 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
551 if (proto_rm
[AFI_IP6
][i
])
553 if (strcmp(proto_rm
[AFI_IP6
][i
], rmap
) == 0)
556 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP6
][i
]);
558 proto_rm
[AFI_IP6
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap
);
560 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
561 zlog_debug ("%u: IPv6 Routemap config for protocol %s, scheduling RIB processing",
564 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
568 DEFUN (no_ipv6_protocol
,
569 no_ipv6_protocol_cmd
,
570 "no ipv6 protocol <kernel|connected|static|ripng|ospf6|isis|bgp|table|any> [route-map ROUTE-MAP]",
573 "Stop filtering IPv6 routing info between zebra and protocol\n"
574 QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
575 "Specify route map\n"
578 const char *proto
= argv
[3]->text
;
579 const char *rmap
= (argc
== 6) ? argv
[5]->arg
: NULL
;
582 if (strcasecmp(proto
, "any") == 0)
585 i
= proto_name2num(proto
);
588 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
591 if (!proto_rm
[AFI_IP6
][i
])
594 if (!rmap
|| strcmp(rmap
, proto_rm
[AFI_IP6
][i
]) == 0)
596 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP6
][i
]);
597 proto_rm
[AFI_IP6
][i
] = NULL
;
599 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
600 zlog_debug ("%u: IPv6 Routemap unconfig for protocol %s, scheduling RIB processing",
603 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
609 DEFUN (show_ipv6_protocol
,
610 show_ipv6_protocol_cmd
,
611 "show ipv6 protocol",
614 "IPv6 protocol filtering status\n")
618 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
619 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
620 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
622 if (proto_rm
[AFI_IP6
][i
])
623 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
624 proto_rm
[AFI_IP6
][i
],
627 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
629 if (proto_rm
[AFI_IP6
][i
])
630 vty_out (vty
, "%-10s : %-10s%s", "any", proto_rm
[AFI_IP6
][i
],
633 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
638 DEFUN (ip_protocol_nht_rmap
,
639 ip_protocol_nht_rmap_cmd
,
640 "ip nht <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any> route-map ROUTE-MAP",
642 "Filter Next Hop tracking route resolution\n"
643 QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
644 "Specify route map\n"
647 char *proto
= argv
[2]->text
;
648 char *rmap
= argv
[4]->arg
;
651 if (strcasecmp(proto
, "any") == 0)
654 i
= proto_name2num(proto
);
657 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
660 if (nht_rm
[AFI_IP
][i
])
662 if (strcmp(nht_rm
[AFI_IP
][i
], rmap
) == 0)
665 XFREE (MTYPE_ROUTE_MAP_NAME
, nht_rm
[AFI_IP
][i
]);
668 nht_rm
[AFI_IP
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap
);
669 zebra_evaluate_rnh(0, AF_INET
, 1, RNH_NEXTHOP_TYPE
, NULL
);
674 DEFUN (no_ip_protocol_nht_rmap
,
675 no_ip_protocol_nht_rmap_cmd
,
676 "no ip nht <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any> [route-map ROUTE-MAP]",
679 "Filter Next Hop tracking route resolution\n"
680 QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
681 "Specify route map\n"
684 char *proto
= argv
[3]->text
;
685 char *rmap
= (argc
== 6) ? argv
[5]->arg
: NULL
;
688 if (strcasecmp(proto
, "any") == 0)
691 i
= proto_name2num(proto
);
694 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
697 if (!nht_rm
[AFI_IP
][i
])
700 if (!rmap
&& strcmp(rmap
, nht_rm
[AFI_IP
][i
]) == 0)
702 XFREE (MTYPE_ROUTE_MAP_NAME
, nht_rm
[AFI_IP
][i
]);
703 nht_rm
[AFI_IP
][i
] = NULL
;
704 zebra_evaluate_rnh(0, AF_INET
, 1, RNH_NEXTHOP_TYPE
, NULL
);
710 DEFUN (show_ip_protocol_nht
,
711 show_ip_protocol_nht_cmd
,
712 "show ip nht route-map",
715 "IP Next Hop tracking filtering status\n")
719 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
720 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
721 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
723 if (nht_rm
[AFI_IP
][i
])
724 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
728 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
730 if (nht_rm
[AFI_IP
][i
])
731 vty_out (vty
, "%-10s : %-10s%s", "any", nht_rm
[AFI_IP
][i
],
734 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
739 DEFUN (ipv6_protocol_nht_rmap
,
740 ipv6_protocol_nht_rmap_cmd
,
741 "ipv6 nht <kernel|connected|static|ripng|ospf6|isis|bgp|table|any> route-map ROUTE-MAP",
743 "Filter Next Hop tracking route resolution\n"
744 QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
745 "Specify route map\n"
748 char *proto
= argv
[2]->text
;
749 char *rmap
= argv
[4]->arg
;
752 if (strcasecmp(proto
, "any") == 0)
755 i
= proto_name2num(proto
);
758 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
761 if (nht_rm
[AFI_IP6
][i
])
762 XFREE (MTYPE_ROUTE_MAP_NAME
, nht_rm
[AFI_IP6
][i
]);
763 nht_rm
[AFI_IP6
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap
);
764 zebra_evaluate_rnh(0, AF_INET6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
769 DEFUN (no_ipv6_protocol_nht_rmap
,
770 no_ipv6_protocol_nht_rmap_cmd
,
771 "no ipv6 nht <kernel|connected|static|ripng|ospf6|isis|bgp|table|any> [route-map ROUTE-MAP]",
774 "Filter Next Hop tracking route resolution\n"
775 QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
776 "Specify route map\n"
779 char *proto
= argv
[3]->text
;
780 char *rmap
= (argc
== 6) ? argv
[5]->arg
: NULL
;
783 if (strcasecmp(proto
, "any") == 0)
786 i
= proto_name2num(proto
);
789 vty_out (vty
, "invalid protocol name \"%s\"%s", proto
, VTY_NEWLINE
);
793 if (nht_rm
[AFI_IP6
][i
] && rmap
&& strcmp(rmap
, nht_rm
[AFI_IP6
][i
]))
795 vty_out (vty
, "invalid route-map \"%s\"%s", rmap
, VTY_NEWLINE
);
799 if (nht_rm
[AFI_IP6
][i
])
801 XFREE (MTYPE_ROUTE_MAP_NAME
, nht_rm
[AFI_IP6
][i
]);
802 nht_rm
[AFI_IP6
][i
] = NULL
;
805 zebra_evaluate_rnh(0, AF_INET6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
811 DEFUN (show_ipv6_protocol_nht
,
812 show_ipv6_protocol_nht_cmd
,
813 "show ipv6 nht route-map",
816 "IPv6 protocol Next Hop filtering status\n")
820 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
821 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
822 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
824 if (nht_rm
[AFI_IP6
][i
])
825 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
829 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
831 if (nht_rm
[AFI_IP
][i
])
832 vty_out (vty
, "%-10s : %-10s%s", "any", nht_rm
[AFI_IP6
][i
],
835 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
840 /*XXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
842 /* `match ip next-hop IP_ACCESS_LIST' */
844 /* Match function return 1 if match is success else return zero. */
845 static route_map_result_t
846 route_match_ip_next_hop (void *rule
, struct prefix
*prefix
,
847 route_map_object_t type
, void *object
)
849 struct access_list
*alist
;
850 struct nh_rmap_obj
*nh_data
;
851 struct prefix_ipv4 p
;
853 if (type
== RMAP_ZEBRA
)
857 return RMAP_DENYMATCH
;
859 switch (nh_data
->nexthop
->type
) {
860 case NEXTHOP_TYPE_IFINDEX
:
861 /* Interface routes can't match ip next-hop */
863 case NEXTHOP_TYPE_IPV4_IFINDEX
:
864 case NEXTHOP_TYPE_IPV4
:
866 p
.prefix
= nh_data
->nexthop
->gate
.ipv4
;
867 p
.prefixlen
= IPV4_MAX_BITLEN
;
872 alist
= access_list_lookup (AFI_IP
, (char *) rule
);
876 return (access_list_apply (alist
, &p
) == FILTER_DENY
?
877 RMAP_NOMATCH
: RMAP_MATCH
);
882 /* Route map `ip next-hop' match statement. `arg' should be
885 route_match_ip_next_hop_compile (const char *arg
)
887 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
890 /* Free route map's compiled `. */
892 route_match_ip_next_hop_free (void *rule
)
894 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
897 /* Route map commands for ip next-hop matching. */
898 static struct route_map_rule_cmd route_match_ip_next_hop_cmd
=
901 route_match_ip_next_hop
,
902 route_match_ip_next_hop_compile
,
903 route_match_ip_next_hop_free
906 /* `match ip next-hop prefix-list PREFIX_LIST' */
908 static route_map_result_t
909 route_match_ip_next_hop_prefix_list (void *rule
, struct prefix
*prefix
,
910 route_map_object_t type
, void *object
)
912 struct prefix_list
*plist
;
913 struct nh_rmap_obj
*nh_data
;
914 struct prefix_ipv4 p
;
916 if (type
== RMAP_ZEBRA
)
918 nh_data
= (struct nh_rmap_obj
*)object
;
920 return RMAP_DENYMATCH
;
922 switch (nh_data
->nexthop
->type
) {
923 case NEXTHOP_TYPE_IFINDEX
:
924 /* Interface routes can't match ip next-hop */
926 case NEXTHOP_TYPE_IPV4_IFINDEX
:
927 case NEXTHOP_TYPE_IPV4
:
929 p
.prefix
= nh_data
->nexthop
->gate
.ipv4
;
930 p
.prefixlen
= IPV4_MAX_BITLEN
;
935 plist
= prefix_list_lookup (AFI_IP
, (char *) rule
);
939 return (prefix_list_apply (plist
, &p
) == PREFIX_DENY
?
940 RMAP_NOMATCH
: RMAP_MATCH
);
946 route_match_ip_next_hop_prefix_list_compile (const char *arg
)
948 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
952 route_match_ip_next_hop_prefix_list_free (void *rule
)
954 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
957 static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd
=
959 "ip next-hop prefix-list",
960 route_match_ip_next_hop_prefix_list
,
961 route_match_ip_next_hop_prefix_list_compile
,
962 route_match_ip_next_hop_prefix_list_free
965 /* `match ip address IP_ACCESS_LIST' */
967 /* Match function should return 1 if match is success else return
969 static route_map_result_t
970 route_match_ip_address (void *rule
, struct prefix
*prefix
,
971 route_map_object_t type
, void *object
)
973 struct access_list
*alist
;
975 if (type
== RMAP_ZEBRA
)
977 alist
= access_list_lookup (AFI_IP
, (char *) rule
);
981 return (access_list_apply (alist
, prefix
) == FILTER_DENY
?
982 RMAP_NOMATCH
: RMAP_MATCH
);
987 /* Route map `ip address' match statement. `arg' should be
990 route_match_ip_address_compile (const char *arg
)
992 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
995 /* Free route map's compiled `ip address' value. */
997 route_match_ip_address_free (void *rule
)
999 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1002 /* Route map commands for ip address matching. */
1003 static struct route_map_rule_cmd route_match_ip_address_cmd
=
1006 route_match_ip_address
,
1007 route_match_ip_address_compile
,
1008 route_match_ip_address_free
1011 /* `match ip address prefix-list PREFIX_LIST' */
1013 static route_map_result_t
1014 route_match_ip_address_prefix_list (void *rule
, struct prefix
*prefix
,
1015 route_map_object_t type
, void *object
)
1017 struct prefix_list
*plist
;
1019 if (type
== RMAP_ZEBRA
)
1021 plist
= prefix_list_lookup (AFI_IP
, (char *) rule
);
1023 return RMAP_NOMATCH
;
1025 return (prefix_list_apply (plist
, prefix
) == PREFIX_DENY
?
1026 RMAP_NOMATCH
: RMAP_MATCH
);
1028 return RMAP_NOMATCH
;
1032 route_match_ip_address_prefix_list_compile (const char *arg
)
1034 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
1038 route_match_ip_address_prefix_list_free (void *rule
)
1040 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1043 static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd
=
1045 "ip address prefix-list",
1046 route_match_ip_address_prefix_list
,
1047 route_match_ip_address_prefix_list_compile
,
1048 route_match_ip_address_prefix_list_free
1052 /* `match ip address prefix-len PREFIXLEN' */
1054 static route_map_result_t
1055 route_match_ip_address_prefix_len (void *rule
, struct prefix
*prefix
,
1056 route_map_object_t type
, void *object
)
1058 u_int32_t
*prefixlen
= (u_int32_t
*)rule
;
1060 if (type
== RMAP_ZEBRA
)
1062 return ((prefix
->prefixlen
== *prefixlen
) ? RMAP_MATCH
: RMAP_NOMATCH
);
1064 return RMAP_NOMATCH
;
1068 route_match_ip_address_prefix_len_compile (const char *arg
)
1070 u_int32_t
*prefix_len
;
1071 char *endptr
= NULL
;
1072 unsigned long tmpval
;
1074 /* prefix len value shoud be integer. */
1075 if (! all_digit (arg
))
1079 tmpval
= strtoul (arg
, &endptr
, 10);
1080 if (*endptr
!= '\0' || errno
|| tmpval
> UINT32_MAX
)
1083 prefix_len
= XMALLOC (MTYPE_ROUTE_MAP_COMPILED
, sizeof (u_int32_t
));
1088 *prefix_len
= tmpval
;
1093 route_match_ip_address_prefix_len_free (void *rule
)
1095 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1098 static struct route_map_rule_cmd route_match_ip_address_prefix_len_cmd
=
1100 "ip address prefix-len",
1101 route_match_ip_address_prefix_len
,
1102 route_match_ip_address_prefix_len_compile
,
1103 route_match_ip_address_prefix_len_free
1107 /* `match ip nexthop prefix-len PREFIXLEN' */
1109 static route_map_result_t
1110 route_match_ip_nexthop_prefix_len (void *rule
, struct prefix
*prefix
,
1111 route_map_object_t type
, void *object
)
1113 u_int32_t
*prefixlen
= (u_int32_t
*)rule
;
1114 struct nh_rmap_obj
*nh_data
;
1115 struct prefix_ipv4 p
;
1117 if (type
== RMAP_ZEBRA
)
1119 nh_data
= (struct nh_rmap_obj
*)object
;
1120 if (!nh_data
|| !nh_data
->nexthop
)
1121 return RMAP_DENYMATCH
;
1123 switch (nh_data
->nexthop
->type
) {
1124 case NEXTHOP_TYPE_IFINDEX
:
1125 /* Interface routes can't match ip next-hop */
1126 return RMAP_NOMATCH
;
1127 case NEXTHOP_TYPE_IPV4_IFINDEX
:
1128 case NEXTHOP_TYPE_IPV4
:
1130 p
.prefix
= nh_data
->nexthop
->gate
.ipv4
;
1131 p
.prefixlen
= IPV4_MAX_BITLEN
;
1134 return RMAP_NOMATCH
;
1136 return ((p
.prefixlen
== *prefixlen
) ? RMAP_MATCH
: RMAP_NOMATCH
);
1138 return RMAP_NOMATCH
;
1141 static struct route_map_rule_cmd route_match_ip_nexthop_prefix_len_cmd
=
1143 "ip next-hop prefix-len",
1144 route_match_ip_nexthop_prefix_len
,
1145 route_match_ip_address_prefix_len_compile
, /* reuse */
1146 route_match_ip_address_prefix_len_free
/* reuse */
1149 /* `match source-protocol PROTOCOL' */
1151 static route_map_result_t
1152 route_match_source_protocol (void *rule
, struct prefix
*prefix
,
1153 route_map_object_t type
, void *object
)
1155 u_int32_t
*rib_type
= (u_int32_t
*)rule
;
1156 struct nh_rmap_obj
*nh_data
;
1158 if (type
== RMAP_ZEBRA
)
1160 nh_data
= (struct nh_rmap_obj
*)object
;
1162 return RMAP_DENYMATCH
;
1164 return ((nh_data
->source_protocol
== *rib_type
)
1165 ? RMAP_MATCH
: RMAP_NOMATCH
);
1167 return RMAP_NOMATCH
;
1171 route_match_source_protocol_compile (const char *arg
)
1173 u_int32_t
*rib_type
;
1176 i
= proto_name2num(arg
);
1177 rib_type
= XMALLOC (MTYPE_ROUTE_MAP_COMPILED
, sizeof (u_int32_t
));
1185 route_match_source_protocol_free (void *rule
)
1187 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1190 static struct route_map_rule_cmd route_match_source_protocol_cmd
=
1193 route_match_source_protocol
,
1194 route_match_source_protocol_compile
,
1195 route_match_source_protocol_free
1198 /* `set src A.B.C.D' */
1201 static route_map_result_t
1202 route_set_src (void *rule
, struct prefix
*prefix
,
1203 route_map_object_t type
, void *object
)
1205 struct nh_rmap_obj
*nh_data
;
1207 if (type
== RMAP_ZEBRA
)
1209 nh_data
= (struct nh_rmap_obj
*)object
;
1210 nh_data
->nexthop
->rmap_src
= *(union g_addr
*)rule
;
1215 /* set src compilation. */
1217 route_set_src_compile (const char *arg
)
1219 union g_addr src
, *psrc
;
1223 (inet_pton(AF_INET6
, arg
, &src
.ipv6
) == 1) ||
1224 #endif /* HAVE_IPV6 */
1225 (src
.ipv4
.s_addr
&& (inet_pton(AF_INET
, arg
, &src
.ipv4
) == 1)))
1227 psrc
= XMALLOC (MTYPE_ROUTE_MAP_COMPILED
, sizeof (union g_addr
));
1234 /* Free route map's compiled `set src' value. */
1236 route_set_src_free (void *rule
)
1238 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
1241 /* Set src rule structure. */
1242 static struct route_map_rule_cmd route_set_src_cmd
=
1246 route_set_src_compile
,
1251 zebra_route_map_update_timer (struct thread
*thread
)
1253 zebra_t_rmap_update
= NULL
;
1255 if (IS_ZEBRA_DEBUG_EVENT
)
1256 zlog_debug("Event driven route-map update triggered");
1258 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
1259 zlog_debug ("%u: Routemap update-timer fired, scheduling RIB processing",
1262 zebra_import_table_rm_update ();
1263 rib_update(VRF_DEFAULT
, RIB_UPDATE_RMAP_CHANGE
);
1264 zebra_evaluate_rnh(0, AF_INET
, 1, RNH_NEXTHOP_TYPE
, NULL
);
1265 zebra_evaluate_rnh(0, AF_INET6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
1271 zebra_route_map_set_delay_timer(u_int32_t value
)
1273 zebra_rmap_update_timer
= value
;
1274 if (!value
&& zebra_t_rmap_update
)
1276 /* Event driven route map updates is being disabled */
1277 /* But there's a pending timer. Fire it off now */
1278 thread_cancel(zebra_t_rmap_update
);
1279 zebra_route_map_update_timer(zebra_t_rmap_update
);
1284 zebra_route_map_write_delay_timer (struct vty
*vty
)
1286 if (vty
&& (zebra_rmap_update_timer
!= ZEBRA_RMAP_DEFAULT_UPDATE_TIMER
))
1287 vty_out (vty
, "zebra route-map delay-timer %d%s", zebra_rmap_update_timer
,
1293 zebra_route_map_check (int family
, int rib_type
, struct prefix
*p
,
1294 struct nexthop
*nexthop
, vrf_id_t vrf_id
, route_tag_t tag
)
1296 struct route_map
*rmap
= NULL
;
1297 route_map_result_t ret
= RMAP_MATCH
;
1298 struct nh_rmap_obj nh_obj
;
1300 nh_obj
.nexthop
= nexthop
;
1301 nh_obj
.vrf_id
= vrf_id
;
1302 nh_obj
.source_protocol
= rib_type
;
1306 if (rib_type
>= 0 && rib_type
< ZEBRA_ROUTE_MAX
)
1307 rmap
= route_map_lookup_by_name (proto_rm
[family
][rib_type
]);
1308 if (!rmap
&& proto_rm
[family
][ZEBRA_ROUTE_MAX
])
1309 rmap
= route_map_lookup_by_name (proto_rm
[family
][ZEBRA_ROUTE_MAX
]);
1311 ret
= route_map_apply(rmap
, p
, RMAP_ZEBRA
, &nh_obj
);
1318 zebra_get_import_table_route_map (afi_t afi
, uint32_t table
)
1320 return zebra_import_table_routemap
[afi
][table
];
1324 zebra_add_import_table_route_map (afi_t afi
, const char *rmap_name
, uint32_t table
)
1326 zebra_import_table_routemap
[afi
][table
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, rmap_name
);
1330 zebra_del_import_table_route_map (afi_t afi
, uint32_t table
)
1332 XFREE (MTYPE_ROUTE_MAP_NAME
, zebra_import_table_routemap
[afi
][table
]);
1336 zebra_import_table_route_map_check (int family
, int rib_type
, struct prefix
*p
,
1337 struct nexthop
*nexthop
, vrf_id_t vrf_id
, route_tag_t tag
, const char *rmap_name
)
1339 struct route_map
*rmap
= NULL
;
1340 route_map_result_t ret
= RMAP_DENYMATCH
;
1341 struct nh_rmap_obj nh_obj
;
1343 nh_obj
.nexthop
= nexthop
;
1344 nh_obj
.vrf_id
= vrf_id
;
1345 nh_obj
.source_protocol
= rib_type
;
1349 if (rib_type
>= 0 && rib_type
< ZEBRA_ROUTE_MAX
)
1350 rmap
= route_map_lookup_by_name (rmap_name
);
1352 ret
= route_map_apply(rmap
, p
, RMAP_ZEBRA
, &nh_obj
);
1359 zebra_nht_route_map_check (int family
, int client_proto
, struct prefix
*p
,
1360 struct rib
* rib
, struct nexthop
*nexthop
)
1362 struct route_map
*rmap
= NULL
;
1363 route_map_result_t ret
= RMAP_MATCH
;
1364 struct nh_rmap_obj nh_obj
;
1366 nh_obj
.nexthop
= nexthop
;
1367 nh_obj
.vrf_id
= rib
->vrf_id
;
1368 nh_obj
.source_protocol
= rib
->type
;
1369 nh_obj
.metric
= rib
->metric
;
1370 nh_obj
.tag
= rib
->tag
;
1372 if (client_proto
>= 0 && client_proto
< ZEBRA_ROUTE_MAX
)
1373 rmap
= route_map_lookup_by_name (nht_rm
[family
][client_proto
]);
1374 if (!rmap
&& nht_rm
[family
][ZEBRA_ROUTE_MAX
])
1375 rmap
= route_map_lookup_by_name (nht_rm
[family
][ZEBRA_ROUTE_MAX
]);
1377 ret
= route_map_apply(rmap
, p
, RMAP_ZEBRA
, &nh_obj
);
1384 zebra_route_map_mark_update (const char *rmap_name
)
1386 /* rmap_update_timer of 0 means don't do route updates */
1387 if (zebra_rmap_update_timer
&& !zebra_t_rmap_update
)
1388 zebra_t_rmap_update
=
1389 thread_add_timer(zebrad
.master
, zebra_route_map_update_timer
, NULL
,
1390 zebra_rmap_update_timer
);
1394 zebra_route_map_add (const char *rmap_name
)
1396 zebra_route_map_mark_update(rmap_name
);
1397 route_map_notify_dependencies(rmap_name
, RMAP_EVENT_MATCH_ADDED
);
1401 zebra_route_map_delete (const char *rmap_name
)
1403 zebra_route_map_mark_update(rmap_name
);
1404 route_map_notify_dependencies(rmap_name
, RMAP_EVENT_MATCH_DELETED
);
1408 zebra_route_map_event (route_map_event_t event
, const char *rmap_name
)
1410 zebra_route_map_mark_update(rmap_name
);
1411 route_map_notify_dependencies(rmap_name
, RMAP_EVENT_MATCH_ADDED
);
1414 /* ip protocol configuration write function */
1416 zebra_routemap_config_write_protocol (struct vty
*vty
)
1420 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
1422 if (proto_rm
[AFI_IP
][i
])
1423 vty_out (vty
, "ip protocol %s route-map %s%s", zebra_route_string(i
),
1424 proto_rm
[AFI_IP
][i
], VTY_NEWLINE
);
1426 if (proto_rm
[AFI_IP6
][i
])
1427 vty_out (vty
, "ipv6 protocol %s route-map %s%s", zebra_route_string(i
),
1428 proto_rm
[AFI_IP6
][i
], VTY_NEWLINE
);
1430 if (nht_rm
[AFI_IP
][i
])
1431 vty_out (vty
, "ip nht %s route-map %s%s", zebra_route_string(i
),
1432 nht_rm
[AFI_IP
][i
], VTY_NEWLINE
);
1434 if (nht_rm
[AFI_IP6
][i
])
1435 vty_out (vty
, "ipv6 nht %s route-map %s%s", zebra_route_string(i
),
1436 nht_rm
[AFI_IP6
][i
], VTY_NEWLINE
);
1439 if (proto_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
])
1440 vty_out (vty
, "ip protocol %s route-map %s%s", "any",
1441 proto_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
1443 if (proto_rm
[AFI_IP6
][ZEBRA_ROUTE_MAX
])
1444 vty_out (vty
, "ipv6 protocol %s route-map %s%s", "any",
1445 proto_rm
[AFI_IP6
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
1447 if (nht_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
])
1448 vty_out (vty
, "ip nht %s route-map %s%s", "any",
1449 nht_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
1451 if (nht_rm
[AFI_IP6
][ZEBRA_ROUTE_MAX
])
1452 vty_out (vty
, "ipv6 nht %s route-map %s%s", "any",
1453 nht_rm
[AFI_IP6
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
1455 if (zebra_rmap_update_timer
!= ZEBRA_RMAP_DEFAULT_UPDATE_TIMER
)
1456 vty_out (vty
, "zebra route-map delay-timer %d%s", zebra_rmap_update_timer
,
1461 zebra_route_map_init ()
1463 install_element (CONFIG_NODE
, &ip_protocol_cmd
);
1464 install_element (CONFIG_NODE
, &no_ip_protocol_cmd
);
1465 install_element (VIEW_NODE
, &show_ip_protocol_cmd
);
1466 install_element (CONFIG_NODE
, &ipv6_protocol_cmd
);
1467 install_element (CONFIG_NODE
, &no_ipv6_protocol_cmd
);
1468 install_element (VIEW_NODE
, &show_ipv6_protocol_cmd
);
1469 install_element (CONFIG_NODE
, &ip_protocol_nht_rmap_cmd
);
1470 install_element (CONFIG_NODE
, &no_ip_protocol_nht_rmap_cmd
);
1471 install_element (VIEW_NODE
, &show_ip_protocol_nht_cmd
);
1472 install_element (CONFIG_NODE
, &ipv6_protocol_nht_rmap_cmd
);
1473 install_element (CONFIG_NODE
, &no_ipv6_protocol_nht_rmap_cmd
);
1474 install_element (VIEW_NODE
, &show_ipv6_protocol_nht_cmd
);
1475 install_element (CONFIG_NODE
, &zebra_route_map_timer_cmd
);
1476 install_element (CONFIG_NODE
, &no_zebra_route_map_timer_cmd
);
1480 route_map_add_hook (zebra_route_map_add
);
1481 route_map_delete_hook (zebra_route_map_delete
);
1482 route_map_event_hook (zebra_route_map_event
);
1484 route_map_match_interface_hook (generic_match_add
);
1485 route_map_no_match_interface_hook (generic_match_delete
);
1487 route_map_match_ip_address_hook (generic_match_add
);
1488 route_map_no_match_ip_address_hook (generic_match_delete
);
1490 route_map_match_ip_address_prefix_list_hook (generic_match_add
);
1491 route_map_no_match_ip_address_prefix_list_hook (generic_match_delete
);
1493 route_map_match_ip_next_hop_hook (generic_match_add
);
1494 route_map_no_match_ip_next_hop_hook (generic_match_delete
);
1496 route_map_match_ip_next_hop_prefix_list_hook (generic_match_add
);
1497 route_map_no_match_ip_next_hop_prefix_list_hook (generic_match_delete
);
1499 route_map_match_tag_hook (generic_match_add
);
1500 route_map_no_match_tag_hook (generic_match_delete
);
1502 route_map_install_match (&route_match_tag_cmd
);
1503 route_map_install_match (&route_match_interface_cmd
);
1504 route_map_install_match (&route_match_ip_next_hop_cmd
);
1505 route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd
);
1506 route_map_install_match (&route_match_ip_address_cmd
);
1507 route_map_install_match (&route_match_ip_address_prefix_list_cmd
);
1508 route_map_install_match (&route_match_ip_address_prefix_len_cmd
);
1509 route_map_install_match (&route_match_ip_nexthop_prefix_len_cmd
);
1510 route_map_install_match (&route_match_source_protocol_cmd
);
1512 route_map_install_set (&route_set_src_cmd
);
1514 install_element (RMAP_NODE
, &match_ip_nexthop_prefix_len_cmd
);
1515 install_element (RMAP_NODE
, &no_match_ip_nexthop_prefix_len_cmd
);
1516 install_element (RMAP_NODE
, &match_ip_address_prefix_len_cmd
);
1517 install_element (RMAP_NODE
, &no_match_ip_address_prefix_len_cmd
);
1518 install_element (RMAP_NODE
, &match_source_protocol_cmd
);
1519 install_element (RMAP_NODE
, &no_match_source_protocol_cmd
);
1521 install_element (RMAP_NODE
, &set_src_cmd
);
1522 install_element (RMAP_NODE
, &no_set_src_cmd
);