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
)
138 enum rmap_compile_rets ret
;
140 ret
= route_map_add_match(index
, command
, arg
, type
);
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
;
148 case RMAP_COMPILE_SUCCESS
:
150 * Intentionally not handling these cases
158 /* Delete rip route map rule. */
159 static int eigrp_route_match_delete(struct vty
*vty
,
160 struct route_map_index
*index
,
161 const char *command
, const char *arg
)
163 enum rmap_compile_rets ret
;
165 ret
= route_map_delete_match(index
, command
, arg
, type
);
167 case RMAP_RULE_MISSING
:
168 vty_out(vty
, "%% Can't find rule.\n");
169 return CMD_WARNING_CONFIG_FAILED
;
170 case RMAP_COMPILE_ERROR
:
171 vty_out(vty
, "%% Argument is malformed.\n");
172 return CMD_WARNING_CONFIG_FAILED
;
173 case RMAP_COMPILE_SUCCESS
:
175 * These cases intentionally ignored
183 /* Add eigrp route map rule. */
184 static int eigrp_route_set_add(struct vty
*vty
, struct route_map_index
*index
,
185 const char *command
, const char *arg
)
187 enum rmap_compile_rets ret
;
189 ret
= route_map_add_set(index
, command
, arg
);
191 case RMAP_RULE_MISSING
:
192 vty_out(vty
, "%% Can't find rule.\n");
193 return CMD_WARNING_CONFIG_FAILED
;
194 case RMAP_COMPILE_ERROR
:
196 * rip, ripng and other protocols share the set metric command
197 * but only values from 0 to 16 are valid for rip and ripng
198 * if metric is out of range for rip and ripng, it is
199 * not for other protocols. Do not return an error
201 if (strcmp(command
, "metric")) {
202 vty_out(vty
, "%% Argument is malformed.\n");
203 return CMD_WARNING_CONFIG_FAILED
;
206 case RMAP_COMPILE_SUCCESS
:
208 * These cases intentionally left blank here
216 /* Delete eigrp route map rule. */
217 static int eigrp_route_set_delete(struct vty
*vty
,
218 struct route_map_index
*index
,
219 const char *command
, const char *arg
)
221 enum rmap_compile_rets ret
;
223 ret
= route_map_delete_set(index
, command
, arg
);
225 case RMAP_RULE_MISSING
:
226 vty_out(vty
, "%% Can't find rule.\n");
227 return CMD_WARNING_CONFIG_FAILED
;
228 case RMAP_COMPILE_ERROR
:
229 vty_out(vty
, "%% Argument is malformed.\n");
230 return CMD_WARNING_CONFIG_FAILED
;
231 case RMAP_COMPILE_SUCCESS
:
233 * These cases intentionally not handled
241 /* Hook function for updating route_map assignment. */
243 void eigrp_route_map_update(const char *notused
)
250 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
251 if (e
->route_map
[i
].name
)
252 e
->route_map
[i
].map
= route_map_lookup_by_name(
253 e
->route_map
[i
].name
);
259 /* `match metric METRIC' */
260 /* Match function return 1 if match is success else return zero. */
261 static enum route_map_cmd_result_t
262 route_match_metric(void *rule
, struct prefix
*prefix
, route_map_object_t type
,
267 // struct rip_info *rinfo;
268 // struct eigrp_route_descriptor *te;
269 // struct eigrp_prefix_descriptor *pe;
270 // struct listnode *node, *node2, *nnode, *nnode2;
273 // e = eigrp_lookup();
275 // if (type == RMAP_EIGRP)
280 // /* If external metric is available, the route-map should
281 // work on this one (for redistribute purpose) */
282 // /*check = (rinfo->external_metric) ? rinfo->external_metric :
285 // if (check == *metric)
286 // return RMAP_MATCH;
288 // return RMAP_NOMATCH;
293 /* Route map `match metric' match statement. `arg' is METRIC value */
294 static void *route_match_metric_compile(const char *arg
)
298 // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t));
299 // *metric = atoi (arg);
304 // XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
308 /* Free route map's compiled `match metric' value. */
309 static void route_match_metric_free(void *rule
)
311 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
314 /* Route map commands for metric matching. */
315 static const struct route_map_rule_cmd route_match_metric_cmd
= {
318 route_match_metric_compile
,
319 route_match_metric_free
322 /* `match interface IFNAME' */
323 /* Match function return 1 if match is success else return zero. */
324 static enum route_map_cmd_result_t
325 route_match_interface(void *rule
, struct prefix
*prefix
,
326 route_map_object_t type
, void *object
)
328 // struct rip_info *rinfo;
329 // struct interface *ifp;
332 // if (type == RMAP_EIGRP)
335 // ifp = if_lookup_by_name(ifname);
338 // return RMAP_NOMATCH;
342 // /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex ==
344 // return RMAP_MATCH;
346 // return RMAP_NOMATCH;*/
351 /* Route map `match interface' match statement. `arg' is IFNAME value */
352 /* XXX I don`t know if I need to check does interface exist? */
353 static void *route_match_interface_compile(const char *arg
)
355 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
358 /* Free route map's compiled `match interface' value. */
359 static void route_match_interface_free(void *rule
)
361 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
364 /* Route map commands for interface matching. */
365 static const struct route_map_rule_cmd route_match_interface_cmd
= {
367 route_match_interface
,
368 route_match_interface_compile
,
369 route_match_interface_free
372 /* `match ip next-hop IP_ACCESS_LIST' */
374 /* Match function return 1 if match is success else return zero. */
375 static enum route_map_cmd_result_t
376 route_match_ip_next_hop(void *rule
, struct prefix
*prefix
,
377 route_map_object_t type
, void *object
)
379 // struct access_list *alist;
380 // struct rip_info *rinfo;
381 // struct prefix_ipv4 p;
383 // if (type == RMAP_EIGRP)
386 // p.family = AF_INET;
387 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop :
389 // p.prefixlen = IPV4_MAX_BITLEN;
391 // alist = access_list_lookup (AFI_IP, (char *) rule);
392 // if (alist == NULL)
393 // return RMAP_NOMATCH;
395 // return (access_list_apply (alist, &p) == FILTER_DENY ?
396 // RMAP_NOMATCH : RMAP_MATCH);
401 /* Route map `ip next-hop' match statement. `arg' should be
403 static void *route_match_ip_next_hop_compile(const char *arg
)
405 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
408 /* Free route map's compiled `. */
409 static void route_match_ip_next_hop_free(void *rule
)
411 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
414 /* Route map commands for ip next-hop matching. */
415 static const struct route_map_rule_cmd route_match_ip_next_hop_cmd
= {
417 route_match_ip_next_hop
,
418 route_match_ip_next_hop_compile
,
419 route_match_ip_next_hop_free
422 /* `match ip next-hop prefix-list PREFIX_LIST' */
424 static enum route_map_cmd_result_t
425 route_match_ip_next_hop_prefix_list(void *rule
, struct prefix
*prefix
,
426 route_map_object_t type
, void *object
)
428 // struct prefix_list *plist;
429 // struct rip_info *rinfo;
430 // struct prefix_ipv4 p;
432 // if (type == RMAP_EIGRP)
435 // p.family = AF_INET;
436 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop :
438 // p.prefixlen = IPV4_MAX_BITLEN;
440 // plist = prefix_list_lookup (AFI_IP, (char *) rule);
441 // if (plist == NULL)
442 // return RMAP_NOMATCH;
444 // return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
445 // RMAP_NOMATCH : RMAP_MATCH);
450 static void *route_match_ip_next_hop_prefix_list_compile(const char *arg
)
452 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
455 static void route_match_ip_next_hop_prefix_list_free(void *rule
)
457 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
460 static const struct route_map_rule_cmd
461 route_match_ip_next_hop_prefix_list_cmd
= {
462 "ip next-hop prefix-list",
463 route_match_ip_next_hop_prefix_list
,
464 route_match_ip_next_hop_prefix_list_compile
,
465 route_match_ip_next_hop_prefix_list_free
468 /* `match ip address IP_ACCESS_LIST' */
470 /* Match function should return 1 if match is success else return
472 static enum route_map_cmd_result_t
473 route_match_ip_address(void *rule
, struct prefix
*prefix
,
474 route_map_object_t type
, void *object
)
476 struct access_list
*alist
;
478 if (type
== RMAP_EIGRP
) {
479 alist
= access_list_lookup(AFI_IP
, (char *)rule
);
483 return (access_list_apply(alist
, prefix
) == FILTER_DENY
490 /* Route map `ip address' match statement. `arg' should be
492 static void *route_match_ip_address_compile(const char *arg
)
494 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
497 /* Free route map's compiled `ip address' value. */
498 static void route_match_ip_address_free(void *rule
)
500 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
503 /* Route map commands for ip address matching. */
504 static const struct route_map_rule_cmd route_match_ip_address_cmd
= {
506 route_match_ip_address
,
507 route_match_ip_address_compile
,
508 route_match_ip_address_free
511 /* `match ip address prefix-list PREFIX_LIST' */
513 static enum route_map_cmd_result_t
514 route_match_ip_address_prefix_list(void *rule
, struct prefix
*prefix
,
515 route_map_object_t type
, void *object
)
517 struct prefix_list
*plist
;
519 if (type
== RMAP_EIGRP
) {
520 plist
= prefix_list_lookup(AFI_IP
, (char *)rule
);
524 return (prefix_list_apply(plist
, prefix
) == PREFIX_DENY
531 static void *route_match_ip_address_prefix_list_compile(const char *arg
)
533 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
536 static void route_match_ip_address_prefix_list_free(void *rule
)
538 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
541 static const struct route_map_rule_cmd
542 route_match_ip_address_prefix_list_cmd
= {
543 "ip address prefix-list",
544 route_match_ip_address_prefix_list
,
545 route_match_ip_address_prefix_list_compile
,
546 route_match_ip_address_prefix_list_free
549 /* `match tag TAG' */
550 /* Match function return 1 if match is success else return zero. */
551 static enum route_map_cmd_result_t
552 route_match_tag(void *rule
, struct prefix
*prefix
, route_map_object_t type
,
555 // unsigned short *tag;
556 // struct rip_info *rinfo;
558 // if (type == RMAP_EIGRP)
563 // /* The information stored by rinfo is host ordered. */
564 // /*if (rinfo->tag == *tag)
565 // return RMAP_MATCH;
567 // return RMAP_NOMATCH;*/
572 /* Route map `match tag' match statement. `arg' is TAG value */
573 static void *route_match_tag_compile(const char *arg
)
575 // unsigned short *tag;
577 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(unsigned short));
578 // *tag = atoi (arg);
583 /* Free route map's compiled `match tag' value. */
584 static void route_match_tag_free(void *rule
)
586 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
589 /* Route map commands for tag matching. */
590 static const struct route_map_rule_cmd route_match_tag_cmd
= {
593 route_match_tag_compile
,
597 /* Set metric to attribute. */
598 static enum route_map_cmd_result_t
599 route_set_metric(void *rule
, struct prefix
*prefix
,
600 route_map_object_t type
, void *object
)
602 // if (type == RMAP_RIP)
604 // struct rip_metric_modifier *mod;
605 // struct rip_info *rinfo;
610 // /*if (mod->type == metric_increment)
611 // rinfo->metric_out += mod->metric;
612 // else if (mod->type == metric_decrement)
613 // rinfo->metric_out -= mod->metric;
614 // else if (mod->type == metric_absolute)
615 // rinfo->metric_out = mod->metric;
617 // if ((signed int)rinfo->metric_out < 1)
618 // rinfo->metric_out = 1;
619 // if (rinfo->metric_out > RIP_METRIC_INFINITY)
620 // rinfo->metric_out = RIP_METRIC_INFINITY;*/
622 // rinfo->metric_set = 1;
627 /* set metric compilation. */
628 static void *route_set_metric_compile(const char *arg
)
634 // char *endptr = NULL;
635 // struct rip_metric_modifier *mod;
637 // len = strlen (arg);
643 // /* Examine first character. */
644 // if (arg[0] == '+')
646 // //type = metric_increment;
649 // else if (arg[0] == '-')
651 // //type = metric_decrement;
655 // type = metric_absolute;*/
657 // /* Check beginning with digit string. */
658 // if (*pnt < '0' || *pnt > '9')
661 // /* Convert string to integer. */
662 // metric = strtol (pnt, &endptr, 10);
664 // if (metric == LONG_MAX || *endptr != '\0')
666 // /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
669 // mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
670 // sizeof(struct rip_metric_modifier));
672 // mod->metric = metric;
677 /* Free route map's compiled `set metric' value. */
678 static void route_set_metric_free(void *rule
)
680 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
683 /* Set metric rule structure. */
684 static const struct route_map_rule_cmd route_set_metric_cmd
= {
687 route_set_metric_compile
,
688 route_set_metric_free
,
691 /* `set ip next-hop IP_ADDRESS' */
693 /* Set nexthop to object. ojbect must be pointer to struct attr. */
694 static enum route_map_cmd_result_t
695 route_set_ip_nexthop(void *rule
, struct prefix
*prefix
,
696 route_map_object_t type
, void *object
)
698 // struct in_addr *address;
699 // struct rip_info *rinfo;
701 // if(type == RMAP_RIP)
703 // /* Fetch routemap's rule information. */
707 // /* Set next hop value. */
708 // rinfo->nexthop_out = *address;
714 /* Route map `ip nexthop' compile function. Given string is converted
715 to struct in_addr structure. */
716 static void *route_set_ip_nexthop_compile(const char *arg
)
719 // struct in_addr *address;
721 // address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(struct
724 // ret = inet_aton (arg, address);
728 // XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
735 /* Free route map's compiled `ip nexthop' value. */
736 static void route_set_ip_nexthop_free(void *rule
)
738 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
741 /* Route map commands for ip nexthop set. */
742 static const struct route_map_rule_cmd route_set_ip_nexthop_cmd
= {
744 route_set_ip_nexthop
,
745 route_set_ip_nexthop_compile
,
746 route_set_ip_nexthop_free
751 /* Set tag to object. ojbect must be pointer to struct attr. */
752 static enum route_map_cmd_result_t
753 route_set_tag(void *rule
, struct prefix
*prefix
,
754 route_map_object_t type
, void *object
)
756 // unsigned short *tag;
757 // struct rip_info *rinfo;
759 // if(type == RMAP_RIP)
761 // /* Fetch routemap's rule information. */
765 // /* Set next hop value. */
766 // rinfo->tag_out = *tag;
772 /* Route map `tag' compile function. Given string is converted
773 to unsigned short. */
774 static void *route_set_tag_compile(const char *arg
)
776 // unsigned short *tag;
778 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(unsigned short));
779 // *tag = atoi (arg);
784 /* Free route map's compiled `ip nexthop' value. */
785 static void route_set_tag_free(void *rule
)
787 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
790 /* Route map commands for tag set. */
791 static const struct route_map_rule_cmd route_set_tag_cmd
= {
794 route_set_tag_compile
,
798 #define MATCH_STR "Match values from routing table\n"
799 #define SET_STR "Set values in destination routing protocol\n"
803 "match metric (0-4294967295)",
805 "Match metric of route\n"
808 return eigrp_route_match_add(vty
, vty
->index
, "metric", argv
[0]);
811 DEFUN (no_match_metric
,
816 "Match metric of route\n")
819 return eigrp_route_match_delete(vty
, vty
->index
, "metric",
822 return eigrp_route_match_delete(vty
, vty
->index
, "metric", argv
[0]);
825 ALIAS(no_match_metric
, no_match_metric_val_cmd
,
826 "no match metric (0-4294967295)", NO_STR MATCH_STR
827 "Match metric of route\n"
830 DEFUN (match_interface
,
832 "match interface WORD",
834 "Match first hop interface of route\n"
837 return eigrp_route_match_add(vty
, vty
->index
, "interface", argv
[0]);
840 DEFUN (no_match_interface
,
841 no_match_interface_cmd
,
842 "no match interface",
845 "Match first hop interface of route\n")
848 return eigrp_route_match_delete(vty
, vty
->index
, "interface",
851 return eigrp_route_match_delete(vty
, vty
->index
, "interface", argv
[0]);
854 ALIAS(no_match_interface
, no_match_interface_val_cmd
, "no match interface WORD",
856 "Match first hop interface of route\n"
859 DEFUN (match_ip_next_hop
,
860 match_ip_next_hop_cmd
,
861 "match ip next-hop ((1-199)|(1300-2699)|WORD)",
864 "Match next-hop address of route\n"
865 "IP access-list number\n"
866 "IP access-list number (expanded range)\n"
867 "IP Access-list name\n")
869 return eigrp_route_match_add(vty
, vty
->index
, "ip next-hop", argv
[0]);
872 DEFUN (no_match_ip_next_hop
,
873 no_match_ip_next_hop_cmd
,
874 "no match ip next-hop",
878 "Match next-hop address of route\n")
881 return eigrp_route_match_delete(vty
, vty
->index
, "ip next-hop",
884 return eigrp_route_match_delete(vty
, vty
->index
, "ip next-hop",
888 ALIAS(no_match_ip_next_hop
, no_match_ip_next_hop_val_cmd
,
889 "no match ip next-hop ((1-199)|(1300-2699)|WORD)", NO_STR MATCH_STR IP_STR
890 "Match next-hop 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 DEFUN (match_ip_next_hop_prefix_list
,
896 match_ip_next_hop_prefix_list_cmd
,
897 "match ip next-hop prefix-list WORD",
900 "Match next-hop address of route\n"
901 "Match entries of prefix-lists\n"
902 "IP prefix-list name\n")
904 return eigrp_route_match_add(vty
, vty
->index
, "ip next-hop prefix-list",
908 DEFUN (no_match_ip_next_hop_prefix_list
,
909 no_match_ip_next_hop_prefix_list_cmd
,
910 "no match ip next-hop prefix-list",
914 "Match next-hop address of route\n"
915 "Match entries of prefix-lists\n")
918 return eigrp_route_match_delete(
919 vty
, vty
->index
, "ip next-hop prefix-list", NULL
);
921 return eigrp_route_match_delete(vty
, vty
->index
,
922 "ip next-hop prefix-list", argv
[0]);
925 ALIAS(no_match_ip_next_hop_prefix_list
,
926 no_match_ip_next_hop_prefix_list_val_cmd
,
927 "no match ip next-hop prefix-list WORD", NO_STR MATCH_STR IP_STR
928 "Match next-hop address of route\n"
929 "Match entries of prefix-lists\n"
930 "IP prefix-list name\n")
932 DEFUN (match_ip_address
,
933 match_ip_address_cmd
,
934 "match ip address ((1-199)|(1300-2699)|WORD)",
937 "Match address of route\n"
938 "IP access-list number\n"
939 "IP access-list number (expanded range)\n"
940 "IP Access-list name\n")
942 return eigrp_route_match_add(vty
, vty
->index
, "ip address", argv
[0]);
945 DEFUN (no_match_ip_address
,
946 no_match_ip_address_cmd
,
947 "no match ip address",
951 "Match address of route\n")
954 return eigrp_route_match_delete(vty
, vty
->index
, "ip address",
957 return eigrp_route_match_delete(vty
, vty
->index
, "ip address", argv
[0]);
960 ALIAS(no_match_ip_address
, no_match_ip_address_val_cmd
,
961 "no match ip address ((1-199)|(1300-2699)|WORD)", NO_STR MATCH_STR IP_STR
962 "Match address of route\n"
963 "IP access-list number\n"
964 "IP access-list number (expanded range)\n"
965 "IP Access-list name\n")
967 DEFUN (match_ip_address_prefix_list
,
968 match_ip_address_prefix_list_cmd
,
969 "match ip address prefix-list WORD",
972 "Match address of route\n"
973 "Match entries of prefix-lists\n"
974 "IP prefix-list name\n")
976 return eigrp_route_match_add(vty
, vty
->index
, "ip address prefix-list",
980 DEFUN (no_match_ip_address_prefix_list
,
981 no_match_ip_address_prefix_list_cmd
,
982 "no match ip address prefix-list",
986 "Match address of route\n"
987 "Match entries of prefix-lists\n")
990 return eigrp_route_match_delete(vty
, vty
->index
,
991 "ip address prefix-list", NULL
);
993 return eigrp_route_match_delete(vty
, vty
->index
,
994 "ip address prefix-list", argv
[0]);
997 ALIAS(no_match_ip_address_prefix_list
, no_match_ip_address_prefix_list_val_cmd
,
998 "no match ip address prefix-list WORD", NO_STR MATCH_STR IP_STR
999 "Match address of route\n"
1000 "Match entries of prefix-lists\n"
1001 "IP prefix-list name\n")
1005 "match tag (0-65535)",
1007 "Match tag of route\n"
1010 return eigrp_route_match_add(vty
, vty
->index
, "tag", argv
[0]);
1013 DEFUN (no_match_tag
,
1018 "Match tag of route\n")
1021 return eigrp_route_match_delete(vty
, vty
->index
, "tag", NULL
);
1023 return eigrp_route_match_delete(vty
, vty
->index
, "tag", argv
[0]);
1026 ALIAS(no_match_tag
, no_match_tag_val_cmd
, "no match tag (0-65535)",
1028 "Match tag of route\n"
1035 "set metric (0-4294967295)",
1037 "Metric value for destination routing protocol\n"
1040 return eigrp_route_set_add(vty
, vty
->index
, "metric", argv
[0]);
1043 ALIAS(set_metric
, set_metric_addsub_cmd
, "set metric <+/-metric>", SET_STR
1044 "Metric value for destination routing protocol\n"
1045 "Add or subtract metric\n")
1047 DEFUN (no_set_metric
,
1052 "Metric value for destination routing protocol\n")
1055 return eigrp_route_set_delete(vty
, vty
->index
, "metric", NULL
);
1057 return eigrp_route_set_delete(vty
, vty
->index
, "metric", argv
[0]);
1060 ALIAS(no_set_metric
, no_set_metric_val_cmd
,
1061 "no set metric ((0-4294967295)|<+/-metric>)", NO_STR SET_STR
1062 "Metric value for destination routing protocol\n"
1064 "Add or subtract metric\n")
1066 DEFUN (set_ip_nexthop
,
1068 "set ip next-hop A.B.C.D",
1071 "Next hop address\n"
1072 "IP address of next hop\n")
1077 ret
= str2sockunion(argv
[0], &su
);
1079 vty_out(vty
, "%% Malformed next-hop address\n");
1080 return CMD_WARNING_CONFIG_FAILED
;
1083 return eigrp_route_set_add(vty
, vty
->index
, "ip next-hop", argv
[0]);
1086 DEFUN (no_set_ip_nexthop
,
1087 no_set_ip_nexthop_cmd
,
1088 "no set ip next-hop",
1092 "Next hop address\n")
1095 return eigrp_route_set_delete(vty
, vty
->index
, "ip next-hop",
1098 return eigrp_route_set_delete(vty
, vty
->index
, "ip next-hop", argv
[0]);
1101 ALIAS(no_set_ip_nexthop
, no_set_ip_nexthop_val_cmd
,
1102 "no set ip next-hop A.B.C.D", NO_STR SET_STR IP_STR
1103 "Next hop address\n"
1104 "IP address of next hop\n")
1108 "set tag (0-65535)",
1110 "Tag value for routing protocol\n"
1113 return eigrp_route_set_add(vty
, vty
->index
, "tag", argv
[0]);
1121 "Tag value for routing protocol\n")
1124 return eigrp_route_set_delete(vty
, vty
->index
, "tag", NULL
);
1126 return eigrp_route_set_delete(vty
, vty
->index
, "tag", argv
[0]);
1129 ALIAS(no_set_tag
, no_set_tag_val_cmd
, "no set tag (0-65535)", NO_STR SET_STR
1130 "Tag value for routing protocol\n"
1134 /* Route-map init */
1135 void eigrp_route_map_init()
1138 route_map_init_vty();
1139 route_map_add_hook(eigrp_route_map_update
);
1140 route_map_delete_hook(eigrp_route_map_update
);
1142 /*route_map_install_match (&route_match_metric_cmd);
1143 route_map_install_match (&route_match_interface_cmd);*/
1144 /*route_map_install_match (&route_match_ip_next_hop_cmd);
1145 route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd);
1146 route_map_install_match (&route_match_ip_address_cmd);
1147 route_map_install_match (&route_match_ip_address_prefix_list_cmd);*/
1148 /*route_map_install_match (&route_match_tag_cmd);*/
1150 /*route_map_install_set (&route_set_metric_cmd);
1151 route_map_install_set (&route_set_ip_nexthop_cmd);
1152 route_map_install_set (&route_set_tag_cmd);*/
1154 /*install_element (RMAP_NODE, &route_match_metric_cmd);
1155 install_element (RMAP_NODE, &no_match_metric_cmd);
1156 install_element (RMAP_NODE, &no_match_metric_val_cmd);
1157 install_element (RMAP_NODE, &route_match_interface_cmd);
1158 install_element (RMAP_NODE, &no_match_interface_cmd);
1159 install_element (RMAP_NODE, &no_match_interface_val_cmd);
1160 install_element (RMAP_NODE, &route_match_ip_next_hop_cmd);
1161 install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
1162 install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
1163 install_element (RMAP_NODE, &route_match_ip_next_hop_prefix_list_cmd);
1164 install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
1165 install_element (RMAP_NODE,
1166 &no_match_ip_next_hop_prefix_list_val_cmd);*/
1167 /*install_element (RMAP_NODE, &route_match_ip_address_cmd);
1168 install_element (RMAP_NODE, &no_match_ip_address_cmd);
1169 install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
1170 install_element (RMAP_NODE, &route_match_ip_address_prefix_list_cmd);
1171 install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
1172 install_element (RMAP_NODE,
1173 &no_match_ip_address_prefix_list_val_cmd);*/
1174 /*install_element (RMAP_NODE, &route_match_tag_cmd);
1175 install_element (RMAP_NODE, &no_match_tag_cmd);
1176 install_element (RMAP_NODE, &no_match_tag_val_cmd);*/
1178 /*install_element (RMAP_NODE, &set_metric_cmd);
1179 install_element (RMAP_NODE, &set_metric_addsub_cmd);
1180 install_element (RMAP_NODE, &no_set_metric_cmd);
1181 install_element (RMAP_NODE, &no_set_metric_val_cmd);
1182 install_element (RMAP_NODE, &set_ip_nexthop_cmd);
1183 install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
1184 install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
1185 install_element (RMAP_NODE, &set_tag_cmd);
1186 install_element (RMAP_NODE, &no_set_tag_cmd);
1187 install_element (RMAP_NODE, &no_set_tag_val_cmd);*/