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
35 * along with GNU Zebra; see the file COPYING. If not, write to the Free
36 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
49 #include "sockunion.h" /* for inet_aton () */
52 #include "eigrpd/eigrpd.h"
53 #include "eigrpd/eigrp_structs.h"
54 #include "eigrpd/eigrp_const.h"
55 #include "eigrpd/eigrp_macros.h"
56 #include "eigrpd/eigrp_routemap.h"
59 eigrp_if_rmap_update (struct if_rmap
*if_rmap
)
61 struct interface
*ifp
;
62 struct eigrp_interface
*ei
, *ei2
;
63 struct listnode
*node
, *nnode
;
64 struct route_map
*rmap
;
67 ifp
= if_lookup_by_name (if_rmap
->ifname
);
73 for (ALL_LIST_ELEMENTS (e
->eiflist
, node
, nnode
, ei2
))
75 if(strcmp(ei2
->ifp
->name
,ifp
->name
) == 0){
81 if (if_rmap
->routemap
[IF_RMAP_IN
])
83 rmap
= route_map_lookup_by_name (if_rmap
->routemap
[IF_RMAP_IN
]);
85 ei
->routemap
[IF_RMAP_IN
] = rmap
;
87 ei
->routemap
[IF_RMAP_IN
] = NULL
;
90 ei
->routemap
[EIGRP_FILTER_IN
] = NULL
;
92 if (if_rmap
->routemap
[IF_RMAP_OUT
])
94 rmap
= route_map_lookup_by_name (if_rmap
->routemap
[IF_RMAP_OUT
]);
96 ei
->routemap
[IF_RMAP_OUT
] = rmap
;
98 ei
->routemap
[IF_RMAP_OUT
] = NULL
;
101 ei
->routemap
[EIGRP_FILTER_OUT
] = NULL
;
105 eigrp_if_rmap_update_interface (struct interface
*ifp
)
107 struct if_rmap
*if_rmap
;
109 if_rmap
= if_rmap_lookup (ifp
->name
);
111 eigrp_if_rmap_update (if_rmap
);
115 eigrp_routemap_update_redistribute (void)
124 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
126 if (e
->route_map
[i
].name
)
127 e
->route_map
[i
].map
=
128 route_map_lookup_by_name (e
->route_map
[i
].name
);
135 eigrp_rmap_update (const char *notused
)
137 struct interface
*ifp
;
138 struct listnode
*node
, *nnode
;
140 for (ALL_LIST_ELEMENTS (iflist
, node
, nnode
, ifp
))
141 eigrp_if_rmap_update_interface (ifp
);
143 eigrp_routemap_update_redistribute ();
146 /* Add eigrp route map rule. */
148 eigrp_route_match_add (struct vty
*vty
, struct route_map_index
*index
,
149 const char *command
, const char *arg
)
152 ret
= route_map_add_match (index
, command
, arg
);
157 case RMAP_RULE_MISSING
:
158 vty_out (vty
, "%% Can't find rule.%s", VTY_NEWLINE
);
160 case RMAP_COMPILE_ERROR
:
161 vty_out (vty
, "%% Argument is malformed.%s", VTY_NEWLINE
);
168 /* Delete rip route map rule. */
170 eigrp_route_match_delete (struct vty
*vty
, struct route_map_index
*index
,
171 const char *command
, const char *arg
)
174 ret
= route_map_delete_match (index
, command
, arg
);
179 case RMAP_RULE_MISSING
:
180 vty_out (vty
, "%% Can't find rule.%s", VTY_NEWLINE
);
182 case RMAP_COMPILE_ERROR
:
183 vty_out (vty
, "%% Argument is malformed.%s", VTY_NEWLINE
);
190 /* Add eigrp route map rule. */
192 eigrp_route_set_add (struct vty
*vty
, struct route_map_index
*index
,
193 const char *command
, const char *arg
)
197 ret
= route_map_add_set (index
, command
, arg
);
202 case RMAP_RULE_MISSING
:
203 vty_out (vty
, "%% Can't find rule.%s", VTY_NEWLINE
);
205 case RMAP_COMPILE_ERROR
:
206 /* rip, ripng and other protocols share the set metric command
207 but only values from 0 to 16 are valid for rip and ripng
208 if metric is out of range for rip and ripng, it is not for
209 other protocols. Do not return an error */
210 if (strcmp(command
, "metric")) {
211 vty_out (vty
, "%% Argument is malformed.%s", VTY_NEWLINE
);
219 /* Delete eigrp route map rule. */
221 eigrp_route_set_delete (struct vty
*vty
, struct route_map_index
*index
,
222 const char *command
, const char *arg
)
226 ret
= route_map_delete_set (index
, command
, arg
);
231 case RMAP_RULE_MISSING
:
232 vty_out (vty
, "%% Can't find rule.%s", VTY_NEWLINE
);
234 case RMAP_COMPILE_ERROR
:
235 vty_out (vty
, "%% Argument is malformed.%s", VTY_NEWLINE
);
242 /* Hook function for updating route_map assignment. */
245 eigrp_route_map_update (const char *notused
)
253 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
255 if (e
->route_map
[i
].name
)
256 e
->route_map
[i
].map
=
257 route_map_lookup_by_name (e
->route_map
[i
].name
);
264 /* `match metric METRIC' */
265 /* Match function return 1 if match is success else return zero. */
266 static route_map_result_t
267 route_match_metric (void *rule
, struct prefix
*prefix
,
268 route_map_object_t type
, void *object
)
270 // u_int32_t *metric;
272 // struct rip_info *rinfo;
273 // struct eigrp_neighbor_entry *te;
274 // struct eigrp_prefix_entry *pe;
275 // struct listnode *node, *node2, *nnode, *nnode2;
278 // e = eigrp_lookup();
280 // if (type == RMAP_EIGRP)
285 // /* If external metric is available, the route-map should
286 // work on this one (for redistribute purpose) */
287 // /*check = (rinfo->external_metric) ? rinfo->external_metric :
290 // if (check == *metric)
291 // return RMAP_MATCH;
293 // return RMAP_NOMATCH;
298 /* Route map `match metric' match statement. `arg' is METRIC value */
300 route_match_metric_compile (const char *arg
)
302 // u_int32_t *metric;
304 // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
305 // *metric = atoi (arg);
310 // XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
314 /* Free route map's compiled `match metric' value. */
316 route_match_metric_free (void *rule
)
318 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
321 /* Route map commands for metric matching. */
322 struct route_map_rule_cmd route_match_metric_cmd
=
326 route_match_metric_compile
,
327 route_match_metric_free
330 /* `match interface IFNAME' */
331 /* Match function return 1 if match is success else return zero. */
332 static route_map_result_t
333 route_match_interface (void *rule
, struct prefix
*prefix
,
334 route_map_object_t type
, void *object
)
336 // struct rip_info *rinfo;
337 // struct interface *ifp;
340 // if (type == RMAP_EIGRP)
343 // ifp = if_lookup_by_name(ifname);
346 // return RMAP_NOMATCH;
350 // /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex == ifp->ifindex)
351 // return RMAP_MATCH;
353 // return RMAP_NOMATCH;*/
358 /* Route map `match interface' match statement. `arg' is IFNAME value */
359 /* XXX I don`t know if I need to check does interface exist? */
361 route_match_interface_compile (const char *arg
)
363 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
366 /* Free route map's compiled `match interface' value. */
368 route_match_interface_free (void *rule
)
370 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
373 /* Route map commands for interface matching. */
374 struct route_map_rule_cmd route_match_interface_cmd
=
377 route_match_interface
,
378 route_match_interface_compile
,
379 route_match_interface_free
382 /* `match ip next-hop IP_ACCESS_LIST' */
384 /* Match function return 1 if match is success else return zero. */
385 static route_map_result_t
386 route_match_ip_next_hop (void *rule
, struct prefix
*prefix
,
387 route_map_object_t type
, void *object
)
389 // struct access_list *alist;
390 // struct rip_info *rinfo;
391 // struct prefix_ipv4 p;
393 // if (type == RMAP_EIGRP)
396 // p.family = AF_INET;
397 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
398 // p.prefixlen = IPV4_MAX_BITLEN;
400 // alist = access_list_lookup (AFI_IP, (char *) rule);
401 // if (alist == NULL)
402 // return RMAP_NOMATCH;
404 // return (access_list_apply (alist, &p) == FILTER_DENY ?
405 // RMAP_NOMATCH : RMAP_MATCH);
410 /* Route map `ip next-hop' match statement. `arg' should be
413 route_match_ip_next_hop_compile (const char *arg
)
415 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
418 /* Free route map's compiled `. */
420 route_match_ip_next_hop_free (void *rule
)
422 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
425 /* Route map commands for ip next-hop matching. */
426 static struct route_map_rule_cmd route_match_ip_next_hop_cmd
=
429 route_match_ip_next_hop
,
430 route_match_ip_next_hop_compile
,
431 route_match_ip_next_hop_free
434 /* `match ip next-hop prefix-list PREFIX_LIST' */
436 static route_map_result_t
437 route_match_ip_next_hop_prefix_list (void *rule
, struct prefix
*prefix
,
438 route_map_object_t type
, void *object
)
440 // struct prefix_list *plist;
441 // struct rip_info *rinfo;
442 // struct prefix_ipv4 p;
444 // if (type == RMAP_EIGRP)
447 // p.family = AF_INET;
448 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
449 // p.prefixlen = IPV4_MAX_BITLEN;
451 // plist = prefix_list_lookup (AFI_IP, (char *) rule);
452 // if (plist == NULL)
453 // return RMAP_NOMATCH;
455 // return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
456 // RMAP_NOMATCH : RMAP_MATCH);
462 route_match_ip_next_hop_prefix_list_compile (const char *arg
)
464 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
468 route_match_ip_next_hop_prefix_list_free (void *rule
)
470 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
473 static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd
=
475 "ip next-hop prefix-list",
476 route_match_ip_next_hop_prefix_list
,
477 route_match_ip_next_hop_prefix_list_compile
,
478 route_match_ip_next_hop_prefix_list_free
481 /* `match ip address IP_ACCESS_LIST' */
483 /* Match function should return 1 if match is success else return
485 static route_map_result_t
486 route_match_ip_address (void *rule
, struct prefix
*prefix
,
487 route_map_object_t type
, void *object
)
489 struct access_list
*alist
;
491 if (type
== RMAP_EIGRP
)
493 alist
= access_list_lookup (AFI_IP
, (char *) rule
);
497 return (access_list_apply (alist
, prefix
) == FILTER_DENY
?
498 RMAP_NOMATCH
: RMAP_MATCH
);
503 /* Route map `ip address' match statement. `arg' should be
506 route_match_ip_address_compile (const char *arg
)
508 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
511 /* Free route map's compiled `ip address' value. */
513 route_match_ip_address_free (void *rule
)
515 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
518 /* Route map commands for ip address matching. */
519 static struct route_map_rule_cmd route_match_ip_address_cmd
=
522 route_match_ip_address
,
523 route_match_ip_address_compile
,
524 route_match_ip_address_free
527 /* `match ip address prefix-list PREFIX_LIST' */
529 static route_map_result_t
530 route_match_ip_address_prefix_list (void *rule
, struct prefix
*prefix
,
531 route_map_object_t type
, void *object
)
533 struct prefix_list
*plist
;
535 if (type
== RMAP_EIGRP
)
537 plist
= prefix_list_lookup (AFI_IP
, (char *) rule
);
541 return (prefix_list_apply (plist
, prefix
) == PREFIX_DENY
?
542 RMAP_NOMATCH
: RMAP_MATCH
);
548 route_match_ip_address_prefix_list_compile (const char *arg
)
550 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
554 route_match_ip_address_prefix_list_free (void *rule
)
556 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
559 static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd
=
561 "ip address prefix-list",
562 route_match_ip_address_prefix_list
,
563 route_match_ip_address_prefix_list_compile
,
564 route_match_ip_address_prefix_list_free
567 /* `match tag TAG' */
568 /* Match function return 1 if match is success else return zero. */
569 static route_map_result_t
570 route_match_tag (void *rule
, struct prefix
*prefix
,
571 route_map_object_t type
, void *object
)
574 // struct rip_info *rinfo;
576 // if (type == RMAP_EIGRP)
581 // /* The information stored by rinfo is host ordered. */
582 // /*if (rinfo->tag == *tag)
583 // return RMAP_MATCH;
585 // return RMAP_NOMATCH;*/
590 /* Route map `match tag' match statement. `arg' is TAG value */
592 route_match_tag_compile (const char *arg
)
596 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
597 // *tag = atoi (arg);
602 /* Free route map's compiled `match tag' value. */
604 route_match_tag_free (void *rule
)
606 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
609 /* Route map commands for tag matching. */
610 struct route_map_rule_cmd route_match_tag_cmd
=
614 route_match_tag_compile
,
618 /* Set metric to attribute. */
619 static route_map_result_t
620 route_set_metric (void *rule
, struct prefix
*prefix
,
621 route_map_object_t type
, void *object
)
623 // if (type == RMAP_RIP)
625 // struct rip_metric_modifier *mod;
626 // struct rip_info *rinfo;
631 // /*if (mod->type == metric_increment)
632 // rinfo->metric_out += mod->metric;
633 // else if (mod->type == metric_decrement)
634 // rinfo->metric_out -= mod->metric;
635 // else if (mod->type == metric_absolute)
636 // rinfo->metric_out = mod->metric;
638 // if ((signed int)rinfo->metric_out < 1)
639 // rinfo->metric_out = 1;
640 // if (rinfo->metric_out > RIP_METRIC_INFINITY)
641 // rinfo->metric_out = RIP_METRIC_INFINITY;*/
643 // rinfo->metric_set = 1;
648 /* set metric compilation. */
650 route_set_metric_compile (const char *arg
)
656 // char *endptr = NULL;
657 // struct rip_metric_modifier *mod;
659 // len = strlen (arg);
665 // /* Examine first character. */
666 // if (arg[0] == '+')
668 // //type = metric_increment;
671 // else if (arg[0] == '-')
673 // //type = metric_decrement;
677 // type = metric_absolute;*/
679 // /* Check beginning with digit string. */
680 // if (*pnt < '0' || *pnt > '9')
683 // /* Convert string to integer. */
684 // metric = strtol (pnt, &endptr, 10);
686 // if (metric == LONG_MAX || *endptr != '\0')
688 // /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
691 // mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
692 // sizeof (struct rip_metric_modifier));
694 // mod->metric = metric;
699 /* Free route map's compiled `set metric' value. */
701 route_set_metric_free (void *rule
)
703 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
706 /* Set metric rule structure. */
707 static struct route_map_rule_cmd route_set_metric_cmd
=
711 route_set_metric_compile
,
712 route_set_metric_free
,
715 /* `set ip next-hop IP_ADDRESS' */
717 /* Set nexthop to object. ojbect must be pointer to struct attr. */
718 static route_map_result_t
719 route_set_ip_nexthop (void *rule
, struct prefix
*prefix
,
720 route_map_object_t type
, void *object
)
722 // struct in_addr *address;
723 // struct rip_info *rinfo;
725 // if(type == RMAP_RIP)
727 // /* Fetch routemap's rule information. */
731 // /* Set next hop value. */
732 // rinfo->nexthop_out = *address;
738 /* Route map `ip nexthop' compile function. Given string is converted
739 to struct in_addr structure. */
741 route_set_ip_nexthop_compile (const char *arg
)
744 // struct in_addr *address;
746 // address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr));
748 // ret = inet_aton (arg, address);
752 // XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
759 /* Free route map's compiled `ip nexthop' value. */
761 route_set_ip_nexthop_free (void *rule
)
763 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
766 /* Route map commands for ip nexthop set. */
767 static struct route_map_rule_cmd route_set_ip_nexthop_cmd
=
770 route_set_ip_nexthop
,
771 route_set_ip_nexthop_compile
,
772 route_set_ip_nexthop_free
777 /* Set tag to object. ojbect must be pointer to struct attr. */
778 static route_map_result_t
779 route_set_tag (void *rule
, struct prefix
*prefix
,
780 route_map_object_t type
, void *object
)
783 // struct rip_info *rinfo;
785 // if(type == RMAP_RIP)
787 // /* Fetch routemap's rule information. */
791 // /* Set next hop value. */
792 // rinfo->tag_out = *tag;
798 /* Route map `tag' compile function. Given string is converted
801 route_set_tag_compile (const char *arg
)
805 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
806 // *tag = atoi (arg);
811 /* Free route map's compiled `ip nexthop' value. */
813 route_set_tag_free (void *rule
)
815 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
818 /* Route map commands for tag set. */
819 static struct route_map_rule_cmd route_set_tag_cmd
=
823 route_set_tag_compile
,
827 #define MATCH_STR "Match values from routing table\n"
828 #define SET_STR "Set values in destination routing protocol\n"
832 "match metric <0-4294967295>",
834 "Match metric of route\n"
837 return eigrp_route_match_add (vty
, vty
->index
, "metric", argv
[0]);
840 DEFUN (no_match_metric
,
845 "Match metric of route\n")
848 return eigrp_route_match_delete (vty
, vty
->index
, "metric", NULL
);
850 return eigrp_route_match_delete (vty
, vty
->index
, "metric", argv
[0]);
853 ALIAS (no_match_metric
,
854 no_match_metric_val_cmd
,
855 "no match metric <0-4294967295>",
858 "Match metric of route\n"
861 DEFUN (match_interface
,
863 "match interface WORD",
865 "Match first hop interface of route\n"
868 return eigrp_route_match_add (vty
, vty
->index
, "interface", argv
[0]);
871 DEFUN (no_match_interface
,
872 no_match_interface_cmd
,
873 "no match interface",
876 "Match first hop interface of route\n")
879 return eigrp_route_match_delete (vty
, vty
->index
, "interface", NULL
);
881 return eigrp_route_match_delete (vty
, vty
->index
, "interface", argv
[0]);
884 ALIAS (no_match_interface
,
885 no_match_interface_val_cmd
,
886 "no match interface WORD",
889 "Match first hop interface of route\n"
892 DEFUN (match_ip_next_hop
,
893 match_ip_next_hop_cmd
,
894 "match ip next-hop (<1-199>|<1300-2699>|WORD)",
897 "Match next-hop address of route\n"
898 "IP access-list number\n"
899 "IP access-list number (expanded range)\n"
900 "IP Access-list name\n")
902 return eigrp_route_match_add (vty
, vty
->index
, "ip next-hop", argv
[0]);
905 DEFUN (no_match_ip_next_hop
,
906 no_match_ip_next_hop_cmd
,
907 "no match ip next-hop",
911 "Match next-hop address of route\n")
914 return eigrp_route_match_delete (vty
, vty
->index
, "ip next-hop", NULL
);
916 return eigrp_route_match_delete (vty
, vty
->index
, "ip next-hop", argv
[0]);
919 ALIAS (no_match_ip_next_hop
,
920 no_match_ip_next_hop_val_cmd
,
921 "no match ip next-hop (<1-199>|<1300-2699>|WORD)",
925 "Match next-hop address of route\n"
926 "IP access-list number\n"
927 "IP access-list number (expanded range)\n"
928 "IP Access-list name\n")
930 DEFUN (match_ip_next_hop_prefix_list
,
931 match_ip_next_hop_prefix_list_cmd
,
932 "match ip next-hop prefix-list WORD",
935 "Match next-hop address of route\n"
936 "Match entries of prefix-lists\n"
937 "IP prefix-list name\n")
939 return eigrp_route_match_add (vty
, vty
->index
, "ip next-hop prefix-list", argv
[0]);
942 DEFUN (no_match_ip_next_hop_prefix_list
,
943 no_match_ip_next_hop_prefix_list_cmd
,
944 "no match ip next-hop prefix-list",
948 "Match next-hop address of route\n"
949 "Match entries of prefix-lists\n")
952 return eigrp_route_match_delete (vty
, vty
->index
, "ip next-hop prefix-list", NULL
);
954 return eigrp_route_match_delete (vty
, vty
->index
, "ip next-hop prefix-list", argv
[0]);
957 ALIAS (no_match_ip_next_hop_prefix_list
,
958 no_match_ip_next_hop_prefix_list_val_cmd
,
959 "no match ip next-hop prefix-list WORD",
963 "Match next-hop address of route\n"
964 "Match entries of prefix-lists\n"
965 "IP prefix-list name\n")
967 DEFUN (match_ip_address
,
968 match_ip_address_cmd
,
969 "match ip address (<1-199>|<1300-2699>|WORD)",
972 "Match address of route\n"
973 "IP access-list number\n"
974 "IP access-list number (expanded range)\n"
975 "IP Access-list name\n")
978 return eigrp_route_match_add (vty
, vty
->index
, "ip address", argv
[0]);
981 DEFUN (no_match_ip_address
,
982 no_match_ip_address_cmd
,
983 "no match ip address",
987 "Match address of route\n")
990 return eigrp_route_match_delete (vty
, vty
->index
, "ip address", NULL
);
992 return eigrp_route_match_delete (vty
, vty
->index
, "ip address", argv
[0]);
995 ALIAS (no_match_ip_address
,
996 no_match_ip_address_val_cmd
,
997 "no match ip address (<1-199>|<1300-2699>|WORD)",
1001 "Match address of route\n"
1002 "IP access-list number\n"
1003 "IP access-list number (expanded range)\n"
1004 "IP Access-list name\n")
1006 DEFUN (match_ip_address_prefix_list
,
1007 match_ip_address_prefix_list_cmd
,
1008 "match ip address prefix-list WORD",
1011 "Match address of route\n"
1012 "Match entries of prefix-lists\n"
1013 "IP prefix-list name\n")
1015 return eigrp_route_match_add (vty
, vty
->index
, "ip address prefix-list", argv
[0]);
1018 DEFUN (no_match_ip_address_prefix_list
,
1019 no_match_ip_address_prefix_list_cmd
,
1020 "no match ip address prefix-list",
1024 "Match address of route\n"
1025 "Match entries of prefix-lists\n")
1028 return eigrp_route_match_delete (vty
, vty
->index
, "ip address prefix-list", NULL
);
1030 return eigrp_route_match_delete (vty
, vty
->index
, "ip address prefix-list", argv
[0]);
1033 ALIAS (no_match_ip_address_prefix_list
,
1034 no_match_ip_address_prefix_list_val_cmd
,
1035 "no match ip address prefix-list WORD",
1039 "Match address of route\n"
1040 "Match entries of prefix-lists\n"
1041 "IP prefix-list name\n")
1045 "match tag <0-65535>",
1047 "Match tag of route\n"
1050 return eigrp_route_match_add (vty
, vty
->index
, "tag", argv
[0]);
1053 DEFUN (no_match_tag
,
1058 "Match tag of route\n")
1061 return eigrp_route_match_delete (vty
, vty
->index
, "tag", NULL
);
1063 return eigrp_route_match_delete (vty
, vty
->index
, "tag", argv
[0]);
1066 ALIAS (no_match_tag
,
1067 no_match_tag_val_cmd
,
1068 "no match tag <0-65535>",
1071 "Match tag of route\n"
1078 "set metric <0-4294967295>",
1080 "Metric value for destination routing protocol\n"
1083 return eigrp_route_set_add (vty
, vty
->index
, "metric", argv
[0]);
1087 set_metric_addsub_cmd
,
1088 "set metric <+/-metric>",
1090 "Metric value for destination routing protocol\n"
1091 "Add or subtract metric\n")
1093 DEFUN (no_set_metric
,
1098 "Metric value for destination routing protocol\n")
1101 return eigrp_route_set_delete (vty
, vty
->index
, "metric", NULL
);
1103 return eigrp_route_set_delete (vty
, vty
->index
, "metric", argv
[0]);
1106 ALIAS (no_set_metric
,
1107 no_set_metric_val_cmd
,
1108 "no set metric (<0-4294967295>|<+/-metric>)",
1111 "Metric value for destination routing protocol\n"
1113 "Add or subtract metric\n")
1115 DEFUN (set_ip_nexthop
,
1117 "set ip next-hop A.B.C.D",
1120 "Next hop address\n"
1121 "IP address of next hop\n")
1126 ret
= str2sockunion (argv
[0], &su
);
1129 vty_out (vty
, "%% Malformed next-hop address%s", VTY_NEWLINE
);
1133 return eigrp_route_set_add (vty
, vty
->index
, "ip next-hop", argv
[0]);
1136 DEFUN (no_set_ip_nexthop
,
1137 no_set_ip_nexthop_cmd
,
1138 "no set ip next-hop",
1142 "Next hop address\n")
1145 return eigrp_route_set_delete (vty
, vty
->index
, "ip next-hop", NULL
);
1147 return eigrp_route_set_delete (vty
, vty
->index
, "ip next-hop", argv
[0]);
1150 ALIAS (no_set_ip_nexthop
,
1151 no_set_ip_nexthop_val_cmd
,
1152 "no set ip next-hop A.B.C.D",
1156 "Next hop address\n"
1157 "IP address of next hop\n")
1161 "set tag <0-65535>",
1163 "Tag value for routing protocol\n"
1166 return eigrp_route_set_add (vty
, vty
->index
, "tag", argv
[0]);
1174 "Tag value for routing protocol\n")
1177 return eigrp_route_set_delete (vty
, vty
->index
, "tag", NULL
);
1179 return eigrp_route_set_delete (vty
, vty
->index
, "tag", argv
[0]);
1184 "no set tag <0-65535>",
1187 "Tag value for routing protocol\n"
1191 /* Route-map init */
1193 eigrp_route_map_init ()
1196 route_map_init_vty ();
1197 route_map_add_hook (eigrp_route_map_update
);
1198 route_map_delete_hook (eigrp_route_map_update
);
1200 /*route_map_install_match (&route_match_metric_cmd);
1201 route_map_install_match (&route_match_interface_cmd);*/
1202 /*route_map_install_match (&route_match_ip_next_hop_cmd);
1203 route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd);
1204 route_map_install_match (&route_match_ip_address_cmd);
1205 route_map_install_match (&route_match_ip_address_prefix_list_cmd);*/
1206 /*route_map_install_match (&route_match_tag_cmd);*/
1208 /*route_map_install_set (&route_set_metric_cmd);
1209 route_map_install_set (&route_set_ip_nexthop_cmd);
1210 route_map_install_set (&route_set_tag_cmd);*/
1212 /*install_element (RMAP_NODE, &route_match_metric_cmd);
1213 install_element (RMAP_NODE, &no_match_metric_cmd);
1214 install_element (RMAP_NODE, &no_match_metric_val_cmd);
1215 install_element (RMAP_NODE, &route_match_interface_cmd);
1216 install_element (RMAP_NODE, &no_match_interface_cmd);
1217 install_element (RMAP_NODE, &no_match_interface_val_cmd);
1218 install_element (RMAP_NODE, &route_match_ip_next_hop_cmd);
1219 install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
1220 install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
1221 install_element (RMAP_NODE, &route_match_ip_next_hop_prefix_list_cmd);
1222 install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
1223 install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd);*/
1224 /*install_element (RMAP_NODE, &route_match_ip_address_cmd);
1225 install_element (RMAP_NODE, &no_match_ip_address_cmd);
1226 install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
1227 install_element (RMAP_NODE, &route_match_ip_address_prefix_list_cmd);
1228 install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
1229 install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd);*/
1230 /*install_element (RMAP_NODE, &route_match_tag_cmd);
1231 install_element (RMAP_NODE, &no_match_tag_cmd);
1232 install_element (RMAP_NODE, &no_match_tag_val_cmd);*/
1234 /*install_element (RMAP_NODE, &set_metric_cmd);
1235 install_element (RMAP_NODE, &set_metric_addsub_cmd);
1236 install_element (RMAP_NODE, &no_set_metric_cmd);
1237 install_element (RMAP_NODE, &no_set_metric_val_cmd);
1238 install_element (RMAP_NODE, &set_ip_nexthop_cmd);
1239 install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
1240 install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
1241 install_element (RMAP_NODE, &set_tag_cmd);
1242 install_element (RMAP_NODE, &no_set_tag_cmd);
1243 install_element (RMAP_NODE, &no_set_tag_val_cmd);*/