2 * EIGRP Filter Functions.
3 * Copyright (C) 2013-2015
15 * Note: This file contains skeleton for all possible matches and sets,
16 * but they are hidden in comment block and not properly implemented.
17 * At this time, the only function we consider useful for our use
18 * in distribute command in EIGRP is matching destination IP (with both
19 * access and prefix list).
22 * This file is part of GNU Zebra.
24 * GNU Zebra is free software; you can redistribute it and/or modify it
25 * under the terms of the GNU General Public License as published by the
26 * Free Software Foundation; either version 2, or (at your option) any
29 * GNU Zebra is distributed in the hope that it will be useful, but
30 * WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 * General Public License for more details.
34 * You should have received a copy of the GNU General Public License along
35 * with this program; see the file COPYING; if not, write to the Free Software
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
48 #include "sockunion.h" /* for inet_aton () */
51 #include "eigrpd/eigrpd.h"
52 #include "eigrpd/eigrp_structs.h"
53 #include "eigrpd/eigrp_const.h"
54 #include "eigrpd/eigrp_macros.h"
55 #include "eigrpd/eigrp_routemap.h"
57 void eigrp_if_rmap_update(struct if_rmap
*if_rmap
)
59 struct interface
*ifp
;
60 struct eigrp_interface
*ei
, *ei2
;
61 struct listnode
*node
, *nnode
;
62 struct route_map
*rmap
;
65 ifp
= if_lookup_by_name(if_rmap
->ifname
);
71 for (ALL_LIST_ELEMENTS(e
->eiflist
, node
, nnode
, ei2
)) {
72 if (strcmp(ei2
->ifp
->name
, ifp
->name
) == 0) {
78 if (if_rmap
->routemap
[IF_RMAP_IN
]) {
79 rmap
= route_map_lookup_by_name(if_rmap
->routemap
[IF_RMAP_IN
]);
81 ei
->routemap
[IF_RMAP_IN
] = rmap
;
83 ei
->routemap
[IF_RMAP_IN
] = NULL
;
85 ei
->routemap
[EIGRP_FILTER_IN
] = NULL
;
87 if (if_rmap
->routemap
[IF_RMAP_OUT
]) {
88 rmap
= route_map_lookup_by_name(if_rmap
->routemap
[IF_RMAP_OUT
]);
90 ei
->routemap
[IF_RMAP_OUT
] = rmap
;
92 ei
->routemap
[IF_RMAP_OUT
] = NULL
;
94 ei
->routemap
[EIGRP_FILTER_OUT
] = NULL
;
97 void eigrp_if_rmap_update_interface(struct interface
*ifp
)
99 struct if_rmap
*if_rmap
;
101 if_rmap
= if_rmap_lookup(ifp
->name
);
103 eigrp_if_rmap_update(if_rmap
);
106 void eigrp_routemap_update_redistribute(void)
114 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
115 if (e
->route_map
[i
].name
)
116 e
->route_map
[i
].map
= route_map_lookup_by_name(
117 e
->route_map
[i
].name
);
123 void eigrp_rmap_update(const char *notused
)
125 struct interface
*ifp
;
126 struct listnode
*node
, *nnode
;
128 for (ALL_LIST_ELEMENTS(iflist
, node
, nnode
, ifp
))
129 eigrp_if_rmap_update_interface(ifp
);
131 eigrp_routemap_update_redistribute();
134 /* Add eigrp route map rule. */
135 static int eigrp_route_match_add(struct vty
*vty
, struct route_map_index
*index
,
136 const char *command
, const char *arg
)
139 ret
= route_map_add_match(index
, command
, arg
);
142 case RMAP_RULE_MISSING
:
143 vty_out(vty
, "%% Can't find rule.\n");
144 return CMD_WARNING_CONFIG_FAILED
;
145 case RMAP_COMPILE_ERROR
:
146 vty_out(vty
, "%% Argument is malformed.\n");
147 return CMD_WARNING_CONFIG_FAILED
;
153 /* Delete rip route map rule. */
154 static int eigrp_route_match_delete(struct vty
*vty
,
155 struct route_map_index
*index
,
156 const char *command
, const char *arg
)
159 ret
= route_map_delete_match(index
, command
, arg
);
162 case RMAP_RULE_MISSING
:
163 vty_out(vty
, "%% Can't find rule.\n");
164 return CMD_WARNING_CONFIG_FAILED
;
165 case RMAP_COMPILE_ERROR
:
166 vty_out(vty
, "%% Argument is malformed.\n");
167 return CMD_WARNING_CONFIG_FAILED
;
173 /* Add eigrp route map rule. */
174 static int eigrp_route_set_add(struct vty
*vty
, struct route_map_index
*index
,
175 const char *command
, const char *arg
)
179 ret
= route_map_add_set(index
, command
, arg
);
182 case RMAP_RULE_MISSING
:
183 vty_out(vty
, "%% Can't find rule.\n");
184 return CMD_WARNING_CONFIG_FAILED
;
185 case RMAP_COMPILE_ERROR
:
186 /* rip, ripng and other protocols share the set metric
188 but only values from 0 to 16 are valid for rip and
190 if metric is out of range for rip and ripng, it is
192 other protocols. Do not return an error */
193 if (strcmp(command
, "metric")) {
194 vty_out(vty
, "%% Argument is malformed.\n");
195 return CMD_WARNING_CONFIG_FAILED
;
202 /* Delete eigrp route map rule. */
203 static int eigrp_route_set_delete(struct vty
*vty
,
204 struct route_map_index
*index
,
205 const char *command
, const char *arg
)
209 ret
= route_map_delete_set(index
, command
, arg
);
212 case RMAP_RULE_MISSING
:
213 vty_out(vty
, "%% Can't find rule.\n");
214 return CMD_WARNING_CONFIG_FAILED
;
215 case RMAP_COMPILE_ERROR
:
216 vty_out(vty
, "%% Argument is malformed.\n");
217 return CMD_WARNING_CONFIG_FAILED
;
223 /* Hook function for updating route_map assignment. */
225 void eigrp_route_map_update(const char *notused
)
232 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
233 if (e
->route_map
[i
].name
)
234 e
->route_map
[i
].map
= route_map_lookup_by_name(
235 e
->route_map
[i
].name
);
241 /* `match metric METRIC' */
242 /* Match function return 1 if match is success else return zero. */
243 static route_map_result_t
route_match_metric(void *rule
, struct prefix
*prefix
,
244 route_map_object_t type
,
247 // u_int32_t *metric;
249 // struct rip_info *rinfo;
250 // struct eigrp_neighbor_entry *te;
251 // struct eigrp_prefix_entry *pe;
252 // struct listnode *node, *node2, *nnode, *nnode2;
255 // e = eigrp_lookup();
257 // if (type == RMAP_EIGRP)
262 // /* If external metric is available, the route-map should
263 // work on this one (for redistribute purpose) */
264 // /*check = (rinfo->external_metric) ? rinfo->external_metric :
267 // if (check == *metric)
268 // return RMAP_MATCH;
270 // return RMAP_NOMATCH;
275 /* Route map `match metric' match statement. `arg' is METRIC value */
276 static void *route_match_metric_compile(const char *arg
)
278 // u_int32_t *metric;
280 // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
281 // *metric = atoi (arg);
286 // XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
290 /* Free route map's compiled `match metric' value. */
291 static void route_match_metric_free(void *rule
)
293 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
296 /* Route map commands for metric matching. */
297 struct route_map_rule_cmd route_match_metric_cmd
= {
298 "metric", route_match_metric
, route_match_metric_compile
,
299 route_match_metric_free
};
301 /* `match interface IFNAME' */
302 /* Match function return 1 if match is success else return zero. */
303 static route_map_result_t
route_match_interface(void *rule
,
304 struct prefix
*prefix
,
305 route_map_object_t type
,
308 // struct rip_info *rinfo;
309 // struct interface *ifp;
312 // if (type == RMAP_EIGRP)
315 // ifp = if_lookup_by_name(ifname);
318 // return RMAP_NOMATCH;
322 // /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex ==
324 // return RMAP_MATCH;
326 // return RMAP_NOMATCH;*/
331 /* Route map `match interface' match statement. `arg' is IFNAME value */
332 /* XXX I don`t know if I need to check does interface exist? */
333 static void *route_match_interface_compile(const char *arg
)
335 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
338 /* Free route map's compiled `match interface' value. */
339 static void route_match_interface_free(void *rule
)
341 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
344 /* Route map commands for interface matching. */
345 struct route_map_rule_cmd route_match_interface_cmd
= {
346 "interface", route_match_interface
, route_match_interface_compile
,
347 route_match_interface_free
};
349 /* `match ip next-hop IP_ACCESS_LIST' */
351 /* Match function return 1 if match is success else return zero. */
352 static route_map_result_t
route_match_ip_next_hop(void *rule
,
353 struct prefix
*prefix
,
354 route_map_object_t type
,
357 // struct access_list *alist;
358 // struct rip_info *rinfo;
359 // struct prefix_ipv4 p;
361 // if (type == RMAP_EIGRP)
364 // p.family = AF_INET;
365 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop :
367 // p.prefixlen = IPV4_MAX_BITLEN;
369 // alist = access_list_lookup (AFI_IP, (char *) rule);
370 // if (alist == NULL)
371 // return RMAP_NOMATCH;
373 // return (access_list_apply (alist, &p) == FILTER_DENY ?
374 // RMAP_NOMATCH : RMAP_MATCH);
379 /* Route map `ip next-hop' match statement. `arg' should be
381 static void *route_match_ip_next_hop_compile(const char *arg
)
383 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
386 /* Free route map's compiled `. */
387 static void route_match_ip_next_hop_free(void *rule
)
389 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
392 /* Route map commands for ip next-hop matching. */
393 static struct route_map_rule_cmd route_match_ip_next_hop_cmd
= {
394 "ip next-hop", route_match_ip_next_hop
, route_match_ip_next_hop_compile
,
395 route_match_ip_next_hop_free
};
397 /* `match ip next-hop prefix-list PREFIX_LIST' */
399 static route_map_result_t
400 route_match_ip_next_hop_prefix_list(void *rule
, struct prefix
*prefix
,
401 route_map_object_t type
, void *object
)
403 // struct prefix_list *plist;
404 // struct rip_info *rinfo;
405 // struct prefix_ipv4 p;
407 // if (type == RMAP_EIGRP)
410 // p.family = AF_INET;
411 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop :
413 // p.prefixlen = IPV4_MAX_BITLEN;
415 // plist = prefix_list_lookup (AFI_IP, (char *) rule);
416 // if (plist == NULL)
417 // return RMAP_NOMATCH;
419 // return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
420 // RMAP_NOMATCH : RMAP_MATCH);
425 static void *route_match_ip_next_hop_prefix_list_compile(const char *arg
)
427 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
430 static void route_match_ip_next_hop_prefix_list_free(void *rule
)
432 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
435 static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd
= {
436 "ip next-hop prefix-list", route_match_ip_next_hop_prefix_list
,
437 route_match_ip_next_hop_prefix_list_compile
,
438 route_match_ip_next_hop_prefix_list_free
};
440 /* `match ip address IP_ACCESS_LIST' */
442 /* Match function should return 1 if match is success else return
444 static route_map_result_t
route_match_ip_address(void *rule
,
445 struct prefix
*prefix
,
446 route_map_object_t type
,
449 struct access_list
*alist
;
451 if (type
== RMAP_EIGRP
) {
452 alist
= access_list_lookup(AFI_IP
, (char *)rule
);
456 return (access_list_apply(alist
, prefix
) == FILTER_DENY
463 /* Route map `ip address' match statement. `arg' should be
465 static void *route_match_ip_address_compile(const char *arg
)
467 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
470 /* Free route map's compiled `ip address' value. */
471 static void route_match_ip_address_free(void *rule
)
473 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
476 /* Route map commands for ip address matching. */
477 static struct route_map_rule_cmd route_match_ip_address_cmd
= {
478 "ip address", route_match_ip_address
, route_match_ip_address_compile
,
479 route_match_ip_address_free
};
481 /* `match ip address prefix-list PREFIX_LIST' */
483 static route_map_result_t
484 route_match_ip_address_prefix_list(void *rule
, struct prefix
*prefix
,
485 route_map_object_t type
, void *object
)
487 struct prefix_list
*plist
;
489 if (type
== RMAP_EIGRP
) {
490 plist
= prefix_list_lookup(AFI_IP
, (char *)rule
);
494 return (prefix_list_apply(plist
, prefix
) == PREFIX_DENY
501 static void *route_match_ip_address_prefix_list_compile(const char *arg
)
503 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
506 static void route_match_ip_address_prefix_list_free(void *rule
)
508 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
511 static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd
= {
512 "ip address prefix-list", route_match_ip_address_prefix_list
,
513 route_match_ip_address_prefix_list_compile
,
514 route_match_ip_address_prefix_list_free
};
516 /* `match tag TAG' */
517 /* Match function return 1 if match is success else return zero. */
518 static route_map_result_t
route_match_tag(void *rule
, struct prefix
*prefix
,
519 route_map_object_t type
, void *object
)
522 // struct rip_info *rinfo;
524 // if (type == RMAP_EIGRP)
529 // /* The information stored by rinfo is host ordered. */
530 // /*if (rinfo->tag == *tag)
531 // return RMAP_MATCH;
533 // return RMAP_NOMATCH;*/
538 /* Route map `match tag' match statement. `arg' is TAG value */
539 static void *route_match_tag_compile(const char *arg
)
543 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
544 // *tag = atoi (arg);
549 /* Free route map's compiled `match tag' value. */
550 static void route_match_tag_free(void *rule
)
552 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
555 /* Route map commands for tag matching. */
556 struct route_map_rule_cmd route_match_tag_cmd
= {
557 "tag", route_match_tag
, route_match_tag_compile
, route_match_tag_free
};
559 /* Set metric to attribute. */
560 static route_map_result_t
route_set_metric(void *rule
, struct prefix
*prefix
,
561 route_map_object_t type
,
564 // if (type == RMAP_RIP)
566 // struct rip_metric_modifier *mod;
567 // struct rip_info *rinfo;
572 // /*if (mod->type == metric_increment)
573 // rinfo->metric_out += mod->metric;
574 // else if (mod->type == metric_decrement)
575 // rinfo->metric_out -= mod->metric;
576 // else if (mod->type == metric_absolute)
577 // rinfo->metric_out = mod->metric;
579 // if ((signed int)rinfo->metric_out < 1)
580 // rinfo->metric_out = 1;
581 // if (rinfo->metric_out > RIP_METRIC_INFINITY)
582 // rinfo->metric_out = RIP_METRIC_INFINITY;*/
584 // rinfo->metric_set = 1;
589 /* set metric compilation. */
590 static void *route_set_metric_compile(const char *arg
)
596 // char *endptr = NULL;
597 // struct rip_metric_modifier *mod;
599 // len = strlen (arg);
605 // /* Examine first character. */
606 // if (arg[0] == '+')
608 // //type = metric_increment;
611 // else if (arg[0] == '-')
613 // //type = metric_decrement;
617 // type = metric_absolute;*/
619 // /* Check beginning with digit string. */
620 // if (*pnt < '0' || *pnt > '9')
623 // /* Convert string to integer. */
624 // metric = strtol (pnt, &endptr, 10);
626 // if (metric == LONG_MAX || *endptr != '\0')
628 // /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
631 // mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
632 // sizeof (struct rip_metric_modifier));
634 // mod->metric = metric;
639 /* Free route map's compiled `set metric' value. */
640 static void route_set_metric_free(void *rule
)
642 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
645 /* Set metric rule structure. */
646 static struct route_map_rule_cmd route_set_metric_cmd
= {
647 "metric", route_set_metric
, route_set_metric_compile
,
648 route_set_metric_free
,
651 /* `set ip next-hop IP_ADDRESS' */
653 /* Set nexthop to object. ojbect must be pointer to struct attr. */
654 static route_map_result_t
route_set_ip_nexthop(void *rule
,
655 struct prefix
*prefix
,
656 route_map_object_t type
,
659 // struct in_addr *address;
660 // struct rip_info *rinfo;
662 // if(type == RMAP_RIP)
664 // /* Fetch routemap's rule information. */
668 // /* Set next hop value. */
669 // rinfo->nexthop_out = *address;
675 /* Route map `ip nexthop' compile function. Given string is converted
676 to struct in_addr structure. */
677 static void *route_set_ip_nexthop_compile(const char *arg
)
680 // struct in_addr *address;
682 // address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct
685 // ret = inet_aton (arg, address);
689 // XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
696 /* Free route map's compiled `ip nexthop' value. */
697 static void route_set_ip_nexthop_free(void *rule
)
699 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
702 /* Route map commands for ip nexthop set. */
703 static struct route_map_rule_cmd route_set_ip_nexthop_cmd
= {
704 "ip next-hop", route_set_ip_nexthop
, route_set_ip_nexthop_compile
,
705 route_set_ip_nexthop_free
};
709 /* Set tag to object. ojbect must be pointer to struct attr. */
710 static route_map_result_t
route_set_tag(void *rule
, struct prefix
*prefix
,
711 route_map_object_t type
, void *object
)
714 // struct rip_info *rinfo;
716 // if(type == RMAP_RIP)
718 // /* Fetch routemap's rule information. */
722 // /* Set next hop value. */
723 // rinfo->tag_out = *tag;
729 /* Route map `tag' compile function. Given string is converted
731 static void *route_set_tag_compile(const char *arg
)
735 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
736 // *tag = atoi (arg);
741 /* Free route map's compiled `ip nexthop' value. */
742 static void route_set_tag_free(void *rule
)
744 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
747 /* Route map commands for tag set. */
748 static struct route_map_rule_cmd route_set_tag_cmd
= {
749 "tag", route_set_tag
, route_set_tag_compile
, route_set_tag_free
};
751 #define MATCH_STR "Match values from routing table\n"
752 #define SET_STR "Set values in destination routing protocol\n"
756 "match metric <0-4294967295>",
758 "Match metric of route\n"
761 return eigrp_route_match_add(vty
, vty
->index
, "metric", argv
[0]);
764 DEFUN (no_match_metric
,
769 "Match metric of route\n")
772 return eigrp_route_match_delete(vty
, vty
->index
, "metric",
775 return eigrp_route_match_delete(vty
, vty
->index
, "metric", argv
[0]);
778 ALIAS(no_match_metric
, no_match_metric_val_cmd
,
779 "no match metric <0-4294967295>", NO_STR MATCH_STR
780 "Match metric of route\n"
783 DEFUN (match_interface
,
785 "match interface WORD",
787 "Match first hop interface of route\n"
790 return eigrp_route_match_add(vty
, vty
->index
, "interface", argv
[0]);
793 DEFUN (no_match_interface
,
794 no_match_interface_cmd
,
795 "no match interface",
798 "Match first hop interface of route\n")
801 return eigrp_route_match_delete(vty
, vty
->index
, "interface",
804 return eigrp_route_match_delete(vty
, vty
->index
, "interface", argv
[0]);
807 ALIAS(no_match_interface
, no_match_interface_val_cmd
, "no match interface WORD",
809 "Match first hop interface of route\n"
812 DEFUN (match_ip_next_hop
,
813 match_ip_next_hop_cmd
,
814 "match ip next-hop (<1-199>|<1300-2699>|WORD)",
817 "Match next-hop address of route\n"
818 "IP access-list number\n"
819 "IP access-list number (expanded range)\n"
820 "IP Access-list name\n")
822 return eigrp_route_match_add(vty
, vty
->index
, "ip next-hop", argv
[0]);
825 DEFUN (no_match_ip_next_hop
,
826 no_match_ip_next_hop_cmd
,
827 "no match ip next-hop",
831 "Match next-hop address of route\n")
834 return eigrp_route_match_delete(vty
, vty
->index
, "ip next-hop",
837 return eigrp_route_match_delete(vty
, vty
->index
, "ip next-hop",
841 ALIAS(no_match_ip_next_hop
, no_match_ip_next_hop_val_cmd
,
842 "no match ip next-hop (<1-199>|<1300-2699>|WORD)", NO_STR MATCH_STR IP_STR
843 "Match next-hop address of route\n"
844 "IP access-list number\n"
845 "IP access-list number (expanded range)\n"
846 "IP Access-list name\n")
848 DEFUN (match_ip_next_hop_prefix_list
,
849 match_ip_next_hop_prefix_list_cmd
,
850 "match ip next-hop prefix-list WORD",
853 "Match next-hop address of route\n"
854 "Match entries of prefix-lists\n"
855 "IP prefix-list name\n")
857 return eigrp_route_match_add(vty
, vty
->index
, "ip next-hop prefix-list",
861 DEFUN (no_match_ip_next_hop_prefix_list
,
862 no_match_ip_next_hop_prefix_list_cmd
,
863 "no match ip next-hop prefix-list",
867 "Match next-hop address of route\n"
868 "Match entries of prefix-lists\n")
871 return eigrp_route_match_delete(
872 vty
, vty
->index
, "ip next-hop prefix-list", NULL
);
874 return eigrp_route_match_delete(vty
, vty
->index
,
875 "ip next-hop prefix-list", argv
[0]);
878 ALIAS(no_match_ip_next_hop_prefix_list
,
879 no_match_ip_next_hop_prefix_list_val_cmd
,
880 "no match ip next-hop prefix-list WORD", NO_STR MATCH_STR IP_STR
881 "Match next-hop address of route\n"
882 "Match entries of prefix-lists\n"
883 "IP prefix-list name\n")
885 DEFUN (match_ip_address
,
886 match_ip_address_cmd
,
887 "match ip address (<1-199>|<1300-2699>|WORD)",
890 "Match address of route\n"
891 "IP access-list number\n"
892 "IP access-list number (expanded range)\n"
893 "IP Access-list name\n")
895 return eigrp_route_match_add(vty
, vty
->index
, "ip address", argv
[0]);
898 DEFUN (no_match_ip_address
,
899 no_match_ip_address_cmd
,
900 "no match ip address",
904 "Match address of route\n")
907 return eigrp_route_match_delete(vty
, vty
->index
, "ip address",
910 return eigrp_route_match_delete(vty
, vty
->index
, "ip address", argv
[0]);
913 ALIAS(no_match_ip_address
, no_match_ip_address_val_cmd
,
914 "no match ip address (<1-199>|<1300-2699>|WORD)", NO_STR MATCH_STR IP_STR
915 "Match address of route\n"
916 "IP access-list number\n"
917 "IP access-list number (expanded range)\n"
918 "IP Access-list name\n")
920 DEFUN (match_ip_address_prefix_list
,
921 match_ip_address_prefix_list_cmd
,
922 "match ip address prefix-list WORD",
925 "Match address of route\n"
926 "Match entries of prefix-lists\n"
927 "IP prefix-list name\n")
929 return eigrp_route_match_add(vty
, vty
->index
, "ip address prefix-list",
933 DEFUN (no_match_ip_address_prefix_list
,
934 no_match_ip_address_prefix_list_cmd
,
935 "no match ip address prefix-list",
939 "Match address of route\n"
940 "Match entries of prefix-lists\n")
943 return eigrp_route_match_delete(vty
, vty
->index
,
944 "ip address prefix-list", NULL
);
946 return eigrp_route_match_delete(vty
, vty
->index
,
947 "ip address prefix-list", argv
[0]);
950 ALIAS(no_match_ip_address_prefix_list
, no_match_ip_address_prefix_list_val_cmd
,
951 "no match ip address prefix-list WORD", NO_STR MATCH_STR IP_STR
952 "Match address of route\n"
953 "Match entries of prefix-lists\n"
954 "IP prefix-list name\n")
958 "match tag <0-65535>",
960 "Match tag of route\n"
963 return eigrp_route_match_add(vty
, vty
->index
, "tag", argv
[0]);
971 "Match tag of route\n")
974 return eigrp_route_match_delete(vty
, vty
->index
, "tag", NULL
);
976 return eigrp_route_match_delete(vty
, vty
->index
, "tag", argv
[0]);
979 ALIAS(no_match_tag
, no_match_tag_val_cmd
, "no match tag <0-65535>",
981 "Match tag of route\n"
988 "set metric <0-4294967295>",
990 "Metric value for destination routing protocol\n"
993 return eigrp_route_set_add(vty
, vty
->index
, "metric", argv
[0]);
996 ALIAS(set_metric
, set_metric_addsub_cmd
, "set metric <+/-metric>", SET_STR
997 "Metric value for destination routing protocol\n"
998 "Add or subtract metric\n")
1000 DEFUN (no_set_metric
,
1005 "Metric value for destination routing protocol\n")
1008 return eigrp_route_set_delete(vty
, vty
->index
, "metric", NULL
);
1010 return eigrp_route_set_delete(vty
, vty
->index
, "metric", argv
[0]);
1013 ALIAS(no_set_metric
, no_set_metric_val_cmd
,
1014 "no set metric (<0-4294967295>|<+/-metric>)", NO_STR SET_STR
1015 "Metric value for destination routing protocol\n"
1017 "Add or subtract metric\n")
1019 DEFUN (set_ip_nexthop
,
1021 "set ip next-hop A.B.C.D",
1024 "Next hop address\n"
1025 "IP address of next hop\n")
1030 ret
= str2sockunion(argv
[0], &su
);
1032 vty_out(vty
, "%% Malformed next-hop address\n");
1033 return CMD_WARNING_CONFIG_FAILED
;
1036 return eigrp_route_set_add(vty
, vty
->index
, "ip next-hop", argv
[0]);
1039 DEFUN (no_set_ip_nexthop
,
1040 no_set_ip_nexthop_cmd
,
1041 "no set ip next-hop",
1045 "Next hop address\n")
1048 return eigrp_route_set_delete(vty
, vty
->index
, "ip next-hop",
1051 return eigrp_route_set_delete(vty
, vty
->index
, "ip next-hop", argv
[0]);
1054 ALIAS(no_set_ip_nexthop
, no_set_ip_nexthop_val_cmd
,
1055 "no set ip next-hop A.B.C.D", NO_STR SET_STR IP_STR
1056 "Next hop address\n"
1057 "IP address of next hop\n")
1061 "set tag <0-65535>",
1063 "Tag value for routing protocol\n"
1066 return eigrp_route_set_add(vty
, vty
->index
, "tag", argv
[0]);
1074 "Tag value for routing protocol\n")
1077 return eigrp_route_set_delete(vty
, vty
->index
, "tag", NULL
);
1079 return eigrp_route_set_delete(vty
, vty
->index
, "tag", argv
[0]);
1082 ALIAS(no_set_tag
, no_set_tag_val_cmd
, "no set tag <0-65535>", NO_STR SET_STR
1083 "Tag value for routing protocol\n"
1087 /* Route-map init */
1088 void eigrp_route_map_init()
1091 route_map_init_vty();
1092 route_map_add_hook(eigrp_route_map_update
);
1093 route_map_delete_hook(eigrp_route_map_update
);
1095 /*route_map_install_match (&route_match_metric_cmd);
1096 route_map_install_match (&route_match_interface_cmd);*/
1097 /*route_map_install_match (&route_match_ip_next_hop_cmd);
1098 route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd);
1099 route_map_install_match (&route_match_ip_address_cmd);
1100 route_map_install_match (&route_match_ip_address_prefix_list_cmd);*/
1101 /*route_map_install_match (&route_match_tag_cmd);*/
1103 /*route_map_install_set (&route_set_metric_cmd);
1104 route_map_install_set (&route_set_ip_nexthop_cmd);
1105 route_map_install_set (&route_set_tag_cmd);*/
1107 /*install_element (RMAP_NODE, &route_match_metric_cmd);
1108 install_element (RMAP_NODE, &no_match_metric_cmd);
1109 install_element (RMAP_NODE, &no_match_metric_val_cmd);
1110 install_element (RMAP_NODE, &route_match_interface_cmd);
1111 install_element (RMAP_NODE, &no_match_interface_cmd);
1112 install_element (RMAP_NODE, &no_match_interface_val_cmd);
1113 install_element (RMAP_NODE, &route_match_ip_next_hop_cmd);
1114 install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
1115 install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
1116 install_element (RMAP_NODE, &route_match_ip_next_hop_prefix_list_cmd);
1117 install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
1118 install_element (RMAP_NODE,
1119 &no_match_ip_next_hop_prefix_list_val_cmd);*/
1120 /*install_element (RMAP_NODE, &route_match_ip_address_cmd);
1121 install_element (RMAP_NODE, &no_match_ip_address_cmd);
1122 install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
1123 install_element (RMAP_NODE, &route_match_ip_address_prefix_list_cmd);
1124 install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
1125 install_element (RMAP_NODE,
1126 &no_match_ip_address_prefix_list_val_cmd);*/
1127 /*install_element (RMAP_NODE, &route_match_tag_cmd);
1128 install_element (RMAP_NODE, &no_match_tag_cmd);
1129 install_element (RMAP_NODE, &no_match_tag_val_cmd);*/
1131 /*install_element (RMAP_NODE, &set_metric_cmd);
1132 install_element (RMAP_NODE, &set_metric_addsub_cmd);
1133 install_element (RMAP_NODE, &no_set_metric_cmd);
1134 install_element (RMAP_NODE, &no_set_metric_val_cmd);
1135 install_element (RMAP_NODE, &set_ip_nexthop_cmd);
1136 install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
1137 install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
1138 install_element (RMAP_NODE, &set_tag_cmd);
1139 install_element (RMAP_NODE, &no_set_tag_cmd);
1140 install_element (RMAP_NODE, &no_set_tag_val_cmd);*/