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"
58 eigrp_if_rmap_update (struct if_rmap
*if_rmap
)
60 struct interface
*ifp
;
61 struct eigrp_interface
*ei
, *ei2
;
62 struct listnode
*node
, *nnode
;
63 struct route_map
*rmap
;
66 ifp
= if_lookup_by_name (if_rmap
->ifname
);
72 for (ALL_LIST_ELEMENTS (e
->eiflist
, node
, nnode
, ei2
))
74 if(strcmp(ei2
->ifp
->name
,ifp
->name
) == 0){
80 if (if_rmap
->routemap
[IF_RMAP_IN
])
82 rmap
= route_map_lookup_by_name (if_rmap
->routemap
[IF_RMAP_IN
]);
84 ei
->routemap
[IF_RMAP_IN
] = rmap
;
86 ei
->routemap
[IF_RMAP_IN
] = NULL
;
89 ei
->routemap
[EIGRP_FILTER_IN
] = NULL
;
91 if (if_rmap
->routemap
[IF_RMAP_OUT
])
93 rmap
= route_map_lookup_by_name (if_rmap
->routemap
[IF_RMAP_OUT
]);
95 ei
->routemap
[IF_RMAP_OUT
] = rmap
;
97 ei
->routemap
[IF_RMAP_OUT
] = NULL
;
100 ei
->routemap
[EIGRP_FILTER_OUT
] = NULL
;
104 eigrp_if_rmap_update_interface (struct interface
*ifp
)
106 struct if_rmap
*if_rmap
;
108 if_rmap
= if_rmap_lookup (ifp
->name
);
110 eigrp_if_rmap_update (if_rmap
);
114 eigrp_routemap_update_redistribute (void)
123 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
125 if (e
->route_map
[i
].name
)
126 e
->route_map
[i
].map
=
127 route_map_lookup_by_name (e
->route_map
[i
].name
);
134 eigrp_rmap_update (const char *notused
)
136 struct interface
*ifp
;
137 struct listnode
*node
, *nnode
;
139 for (ALL_LIST_ELEMENTS (iflist
, node
, nnode
, ifp
))
140 eigrp_if_rmap_update_interface (ifp
);
142 eigrp_routemap_update_redistribute ();
145 /* Add eigrp route map rule. */
147 eigrp_route_match_add (struct vty
*vty
, struct route_map_index
*index
,
148 const char *command
, const char *arg
)
151 ret
= route_map_add_match (index
, command
, arg
);
156 case RMAP_RULE_MISSING
:
157 vty_out (vty
, "%% Can't find rule.%s", VTY_NEWLINE
);
159 case RMAP_COMPILE_ERROR
:
160 vty_out (vty
, "%% Argument is malformed.%s", VTY_NEWLINE
);
167 /* Delete rip route map rule. */
169 eigrp_route_match_delete (struct vty
*vty
, struct route_map_index
*index
,
170 const char *command
, const char *arg
)
173 ret
= route_map_delete_match (index
, command
, arg
);
178 case RMAP_RULE_MISSING
:
179 vty_out (vty
, "%% Can't find rule.%s", VTY_NEWLINE
);
181 case RMAP_COMPILE_ERROR
:
182 vty_out (vty
, "%% Argument is malformed.%s", VTY_NEWLINE
);
189 /* Add eigrp route map rule. */
191 eigrp_route_set_add (struct vty
*vty
, struct route_map_index
*index
,
192 const char *command
, const char *arg
)
196 ret
= route_map_add_set (index
, command
, arg
);
201 case RMAP_RULE_MISSING
:
202 vty_out (vty
, "%% Can't find rule.%s", VTY_NEWLINE
);
204 case RMAP_COMPILE_ERROR
:
205 /* rip, ripng and other protocols share the set metric command
206 but only values from 0 to 16 are valid for rip and ripng
207 if metric is out of range for rip and ripng, it is not for
208 other protocols. Do not return an error */
209 if (strcmp(command
, "metric")) {
210 vty_out (vty
, "%% Argument is malformed.%s", VTY_NEWLINE
);
218 /* Delete eigrp route map rule. */
220 eigrp_route_set_delete (struct vty
*vty
, struct route_map_index
*index
,
221 const char *command
, const char *arg
)
225 ret
= route_map_delete_set (index
, command
, arg
);
230 case RMAP_RULE_MISSING
:
231 vty_out (vty
, "%% Can't find rule.%s", VTY_NEWLINE
);
233 case RMAP_COMPILE_ERROR
:
234 vty_out (vty
, "%% Argument is malformed.%s", VTY_NEWLINE
);
241 /* Hook function for updating route_map assignment. */
244 eigrp_route_map_update (const char *notused
)
252 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
254 if (e
->route_map
[i
].name
)
255 e
->route_map
[i
].map
=
256 route_map_lookup_by_name (e
->route_map
[i
].name
);
263 /* `match metric METRIC' */
264 /* Match function return 1 if match is success else return zero. */
265 static route_map_result_t
266 route_match_metric (void *rule
, struct prefix
*prefix
,
267 route_map_object_t type
, void *object
)
269 // u_int32_t *metric;
271 // struct rip_info *rinfo;
272 // struct eigrp_neighbor_entry *te;
273 // struct eigrp_prefix_entry *pe;
274 // struct listnode *node, *node2, *nnode, *nnode2;
277 // e = eigrp_lookup();
279 // if (type == RMAP_EIGRP)
284 // /* If external metric is available, the route-map should
285 // work on this one (for redistribute purpose) */
286 // /*check = (rinfo->external_metric) ? rinfo->external_metric :
289 // if (check == *metric)
290 // return RMAP_MATCH;
292 // return RMAP_NOMATCH;
297 /* Route map `match metric' match statement. `arg' is METRIC value */
299 route_match_metric_compile (const char *arg
)
301 // u_int32_t *metric;
303 // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
304 // *metric = atoi (arg);
309 // XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
313 /* Free route map's compiled `match metric' value. */
315 route_match_metric_free (void *rule
)
317 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
320 /* Route map commands for metric matching. */
321 struct route_map_rule_cmd route_match_metric_cmd
=
325 route_match_metric_compile
,
326 route_match_metric_free
329 /* `match interface IFNAME' */
330 /* Match function return 1 if match is success else return zero. */
331 static route_map_result_t
332 route_match_interface (void *rule
, struct prefix
*prefix
,
333 route_map_object_t type
, void *object
)
335 // struct rip_info *rinfo;
336 // struct interface *ifp;
339 // if (type == RMAP_EIGRP)
342 // ifp = if_lookup_by_name(ifname);
345 // return RMAP_NOMATCH;
349 // /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex == ifp->ifindex)
350 // return RMAP_MATCH;
352 // return RMAP_NOMATCH;*/
357 /* Route map `match interface' match statement. `arg' is IFNAME value */
358 /* XXX I don`t know if I need to check does interface exist? */
360 route_match_interface_compile (const char *arg
)
362 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
365 /* Free route map's compiled `match interface' value. */
367 route_match_interface_free (void *rule
)
369 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
372 /* Route map commands for interface matching. */
373 struct route_map_rule_cmd route_match_interface_cmd
=
376 route_match_interface
,
377 route_match_interface_compile
,
378 route_match_interface_free
381 /* `match ip next-hop IP_ACCESS_LIST' */
383 /* Match function return 1 if match is success else return zero. */
384 static route_map_result_t
385 route_match_ip_next_hop (void *rule
, struct prefix
*prefix
,
386 route_map_object_t type
, void *object
)
388 // struct access_list *alist;
389 // struct rip_info *rinfo;
390 // struct prefix_ipv4 p;
392 // if (type == RMAP_EIGRP)
395 // p.family = AF_INET;
396 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
397 // p.prefixlen = IPV4_MAX_BITLEN;
399 // alist = access_list_lookup (AFI_IP, (char *) rule);
400 // if (alist == NULL)
401 // return RMAP_NOMATCH;
403 // return (access_list_apply (alist, &p) == FILTER_DENY ?
404 // RMAP_NOMATCH : RMAP_MATCH);
409 /* Route map `ip next-hop' match statement. `arg' should be
412 route_match_ip_next_hop_compile (const char *arg
)
414 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
417 /* Free route map's compiled `. */
419 route_match_ip_next_hop_free (void *rule
)
421 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
424 /* Route map commands for ip next-hop matching. */
425 static struct route_map_rule_cmd route_match_ip_next_hop_cmd
=
428 route_match_ip_next_hop
,
429 route_match_ip_next_hop_compile
,
430 route_match_ip_next_hop_free
433 /* `match ip next-hop prefix-list PREFIX_LIST' */
435 static route_map_result_t
436 route_match_ip_next_hop_prefix_list (void *rule
, struct prefix
*prefix
,
437 route_map_object_t type
, void *object
)
439 // struct prefix_list *plist;
440 // struct rip_info *rinfo;
441 // struct prefix_ipv4 p;
443 // if (type == RMAP_EIGRP)
446 // p.family = AF_INET;
447 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
448 // p.prefixlen = IPV4_MAX_BITLEN;
450 // plist = prefix_list_lookup (AFI_IP, (char *) rule);
451 // if (plist == NULL)
452 // return RMAP_NOMATCH;
454 // return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
455 // RMAP_NOMATCH : RMAP_MATCH);
461 route_match_ip_next_hop_prefix_list_compile (const char *arg
)
463 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
467 route_match_ip_next_hop_prefix_list_free (void *rule
)
469 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
472 static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd
=
474 "ip next-hop prefix-list",
475 route_match_ip_next_hop_prefix_list
,
476 route_match_ip_next_hop_prefix_list_compile
,
477 route_match_ip_next_hop_prefix_list_free
480 /* `match ip address IP_ACCESS_LIST' */
482 /* Match function should return 1 if match is success else return
484 static route_map_result_t
485 route_match_ip_address (void *rule
, struct prefix
*prefix
,
486 route_map_object_t type
, void *object
)
488 struct access_list
*alist
;
490 if (type
== RMAP_EIGRP
)
492 alist
= access_list_lookup (AFI_IP
, (char *) rule
);
496 return (access_list_apply (alist
, prefix
) == FILTER_DENY
?
497 RMAP_NOMATCH
: RMAP_MATCH
);
502 /* Route map `ip address' match statement. `arg' should be
505 route_match_ip_address_compile (const char *arg
)
507 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
510 /* Free route map's compiled `ip address' value. */
512 route_match_ip_address_free (void *rule
)
514 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
517 /* Route map commands for ip address matching. */
518 static struct route_map_rule_cmd route_match_ip_address_cmd
=
521 route_match_ip_address
,
522 route_match_ip_address_compile
,
523 route_match_ip_address_free
526 /* `match ip address prefix-list PREFIX_LIST' */
528 static route_map_result_t
529 route_match_ip_address_prefix_list (void *rule
, struct prefix
*prefix
,
530 route_map_object_t type
, void *object
)
532 struct prefix_list
*plist
;
534 if (type
== RMAP_EIGRP
)
536 plist
= prefix_list_lookup (AFI_IP
, (char *) rule
);
540 return (prefix_list_apply (plist
, prefix
) == PREFIX_DENY
?
541 RMAP_NOMATCH
: RMAP_MATCH
);
547 route_match_ip_address_prefix_list_compile (const char *arg
)
549 return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED
, arg
);
553 route_match_ip_address_prefix_list_free (void *rule
)
555 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
558 static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd
=
560 "ip address prefix-list",
561 route_match_ip_address_prefix_list
,
562 route_match_ip_address_prefix_list_compile
,
563 route_match_ip_address_prefix_list_free
566 /* `match tag TAG' */
567 /* Match function return 1 if match is success else return zero. */
568 static route_map_result_t
569 route_match_tag (void *rule
, struct prefix
*prefix
,
570 route_map_object_t type
, void *object
)
573 // struct rip_info *rinfo;
575 // if (type == RMAP_EIGRP)
580 // /* The information stored by rinfo is host ordered. */
581 // /*if (rinfo->tag == *tag)
582 // return RMAP_MATCH;
584 // return RMAP_NOMATCH;*/
589 /* Route map `match tag' match statement. `arg' is TAG value */
591 route_match_tag_compile (const char *arg
)
595 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
596 // *tag = atoi (arg);
601 /* Free route map's compiled `match tag' value. */
603 route_match_tag_free (void *rule
)
605 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
608 /* Route map commands for tag matching. */
609 struct route_map_rule_cmd route_match_tag_cmd
=
613 route_match_tag_compile
,
617 /* Set metric to attribute. */
618 static route_map_result_t
619 route_set_metric (void *rule
, struct prefix
*prefix
,
620 route_map_object_t type
, void *object
)
622 // if (type == RMAP_RIP)
624 // struct rip_metric_modifier *mod;
625 // struct rip_info *rinfo;
630 // /*if (mod->type == metric_increment)
631 // rinfo->metric_out += mod->metric;
632 // else if (mod->type == metric_decrement)
633 // rinfo->metric_out -= mod->metric;
634 // else if (mod->type == metric_absolute)
635 // rinfo->metric_out = mod->metric;
637 // if ((signed int)rinfo->metric_out < 1)
638 // rinfo->metric_out = 1;
639 // if (rinfo->metric_out > RIP_METRIC_INFINITY)
640 // rinfo->metric_out = RIP_METRIC_INFINITY;*/
642 // rinfo->metric_set = 1;
647 /* set metric compilation. */
649 route_set_metric_compile (const char *arg
)
655 // char *endptr = NULL;
656 // struct rip_metric_modifier *mod;
658 // len = strlen (arg);
664 // /* Examine first character. */
665 // if (arg[0] == '+')
667 // //type = metric_increment;
670 // else if (arg[0] == '-')
672 // //type = metric_decrement;
676 // type = metric_absolute;*/
678 // /* Check beginning with digit string. */
679 // if (*pnt < '0' || *pnt > '9')
682 // /* Convert string to integer. */
683 // metric = strtol (pnt, &endptr, 10);
685 // if (metric == LONG_MAX || *endptr != '\0')
687 // /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
690 // mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
691 // sizeof (struct rip_metric_modifier));
693 // mod->metric = metric;
698 /* Free route map's compiled `set metric' value. */
700 route_set_metric_free (void *rule
)
702 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
705 /* Set metric rule structure. */
706 static struct route_map_rule_cmd route_set_metric_cmd
=
710 route_set_metric_compile
,
711 route_set_metric_free
,
714 /* `set ip next-hop IP_ADDRESS' */
716 /* Set nexthop to object. ojbect must be pointer to struct attr. */
717 static route_map_result_t
718 route_set_ip_nexthop (void *rule
, struct prefix
*prefix
,
719 route_map_object_t type
, void *object
)
721 // struct in_addr *address;
722 // struct rip_info *rinfo;
724 // if(type == RMAP_RIP)
726 // /* Fetch routemap's rule information. */
730 // /* Set next hop value. */
731 // rinfo->nexthop_out = *address;
737 /* Route map `ip nexthop' compile function. Given string is converted
738 to struct in_addr structure. */
740 route_set_ip_nexthop_compile (const char *arg
)
743 // struct in_addr *address;
745 // address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr));
747 // ret = inet_aton (arg, address);
751 // XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
758 /* Free route map's compiled `ip nexthop' value. */
760 route_set_ip_nexthop_free (void *rule
)
762 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
765 /* Route map commands for ip nexthop set. */
766 static struct route_map_rule_cmd route_set_ip_nexthop_cmd
=
769 route_set_ip_nexthop
,
770 route_set_ip_nexthop_compile
,
771 route_set_ip_nexthop_free
776 /* Set tag to object. ojbect must be pointer to struct attr. */
777 static route_map_result_t
778 route_set_tag (void *rule
, struct prefix
*prefix
,
779 route_map_object_t type
, void *object
)
782 // struct rip_info *rinfo;
784 // if(type == RMAP_RIP)
786 // /* Fetch routemap's rule information. */
790 // /* Set next hop value. */
791 // rinfo->tag_out = *tag;
797 /* Route map `tag' compile function. Given string is converted
800 route_set_tag_compile (const char *arg
)
804 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
805 // *tag = atoi (arg);
810 /* Free route map's compiled `ip nexthop' value. */
812 route_set_tag_free (void *rule
)
814 XFREE (MTYPE_ROUTE_MAP_COMPILED
, rule
);
817 /* Route map commands for tag set. */
818 static struct route_map_rule_cmd route_set_tag_cmd
=
822 route_set_tag_compile
,
826 #define MATCH_STR "Match values from routing table\n"
827 #define SET_STR "Set values in destination routing protocol\n"
831 "match metric <0-4294967295>",
833 "Match metric of route\n"
836 return eigrp_route_match_add (vty
, vty
->index
, "metric", argv
[0]);
839 DEFUN (no_match_metric
,
844 "Match metric of route\n")
847 return eigrp_route_match_delete (vty
, vty
->index
, "metric", NULL
);
849 return eigrp_route_match_delete (vty
, vty
->index
, "metric", argv
[0]);
852 ALIAS (no_match_metric
,
853 no_match_metric_val_cmd
,
854 "no match metric <0-4294967295>",
857 "Match metric of route\n"
860 DEFUN (match_interface
,
862 "match interface WORD",
864 "Match first hop interface of route\n"
867 return eigrp_route_match_add (vty
, vty
->index
, "interface", argv
[0]);
870 DEFUN (no_match_interface
,
871 no_match_interface_cmd
,
872 "no match interface",
875 "Match first hop interface of route\n")
878 return eigrp_route_match_delete (vty
, vty
->index
, "interface", NULL
);
880 return eigrp_route_match_delete (vty
, vty
->index
, "interface", argv
[0]);
883 ALIAS (no_match_interface
,
884 no_match_interface_val_cmd
,
885 "no match interface WORD",
888 "Match first hop interface of route\n"
891 DEFUN (match_ip_next_hop
,
892 match_ip_next_hop_cmd
,
893 "match ip next-hop (<1-199>|<1300-2699>|WORD)",
896 "Match next-hop address of route\n"
897 "IP access-list number\n"
898 "IP access-list number (expanded range)\n"
899 "IP Access-list name\n")
901 return eigrp_route_match_add (vty
, vty
->index
, "ip next-hop", argv
[0]);
904 DEFUN (no_match_ip_next_hop
,
905 no_match_ip_next_hop_cmd
,
906 "no match ip next-hop",
910 "Match next-hop address of route\n")
913 return eigrp_route_match_delete (vty
, vty
->index
, "ip next-hop", NULL
);
915 return eigrp_route_match_delete (vty
, vty
->index
, "ip next-hop", argv
[0]);
918 ALIAS (no_match_ip_next_hop
,
919 no_match_ip_next_hop_val_cmd
,
920 "no match ip next-hop (<1-199>|<1300-2699>|WORD)",
924 "Match next-hop address of route\n"
925 "IP access-list number\n"
926 "IP access-list number (expanded range)\n"
927 "IP Access-list name\n")
929 DEFUN (match_ip_next_hop_prefix_list
,
930 match_ip_next_hop_prefix_list_cmd
,
931 "match ip next-hop prefix-list WORD",
934 "Match next-hop address of route\n"
935 "Match entries of prefix-lists\n"
936 "IP prefix-list name\n")
938 return eigrp_route_match_add (vty
, vty
->index
, "ip next-hop prefix-list", argv
[0]);
941 DEFUN (no_match_ip_next_hop_prefix_list
,
942 no_match_ip_next_hop_prefix_list_cmd
,
943 "no match ip next-hop prefix-list",
947 "Match next-hop address of route\n"
948 "Match entries of prefix-lists\n")
951 return eigrp_route_match_delete (vty
, vty
->index
, "ip next-hop prefix-list", NULL
);
953 return eigrp_route_match_delete (vty
, vty
->index
, "ip next-hop prefix-list", argv
[0]);
956 ALIAS (no_match_ip_next_hop_prefix_list
,
957 no_match_ip_next_hop_prefix_list_val_cmd
,
958 "no match ip next-hop prefix-list WORD",
962 "Match next-hop address of route\n"
963 "Match entries of prefix-lists\n"
964 "IP prefix-list name\n")
966 DEFUN (match_ip_address
,
967 match_ip_address_cmd
,
968 "match ip address (<1-199>|<1300-2699>|WORD)",
971 "Match address of route\n"
972 "IP access-list number\n"
973 "IP access-list number (expanded range)\n"
974 "IP Access-list name\n")
976 return eigrp_route_match_add (vty
, vty
->index
, "ip address", argv
[0]);
979 DEFUN (no_match_ip_address
,
980 no_match_ip_address_cmd
,
981 "no match ip address",
985 "Match address of route\n")
988 return eigrp_route_match_delete (vty
, vty
->index
, "ip address", NULL
);
990 return eigrp_route_match_delete (vty
, vty
->index
, "ip address", argv
[0]);
993 ALIAS (no_match_ip_address
,
994 no_match_ip_address_val_cmd
,
995 "no match ip address (<1-199>|<1300-2699>|WORD)",
999 "Match address of route\n"
1000 "IP access-list number\n"
1001 "IP access-list number (expanded range)\n"
1002 "IP Access-list name\n")
1004 DEFUN (match_ip_address_prefix_list
,
1005 match_ip_address_prefix_list_cmd
,
1006 "match ip address prefix-list WORD",
1009 "Match address of route\n"
1010 "Match entries of prefix-lists\n"
1011 "IP prefix-list name\n")
1013 return eigrp_route_match_add (vty
, vty
->index
, "ip address prefix-list", argv
[0]);
1016 DEFUN (no_match_ip_address_prefix_list
,
1017 no_match_ip_address_prefix_list_cmd
,
1018 "no match ip address prefix-list",
1022 "Match address of route\n"
1023 "Match entries of prefix-lists\n")
1026 return eigrp_route_match_delete (vty
, vty
->index
, "ip address prefix-list", NULL
);
1028 return eigrp_route_match_delete (vty
, vty
->index
, "ip address prefix-list", argv
[0]);
1031 ALIAS (no_match_ip_address_prefix_list
,
1032 no_match_ip_address_prefix_list_val_cmd
,
1033 "no match ip address prefix-list WORD",
1037 "Match address of route\n"
1038 "Match entries of prefix-lists\n"
1039 "IP prefix-list name\n")
1043 "match tag <0-65535>",
1045 "Match tag of route\n"
1048 return eigrp_route_match_add (vty
, vty
->index
, "tag", argv
[0]);
1051 DEFUN (no_match_tag
,
1056 "Match tag of route\n")
1059 return eigrp_route_match_delete (vty
, vty
->index
, "tag", NULL
);
1061 return eigrp_route_match_delete (vty
, vty
->index
, "tag", argv
[0]);
1064 ALIAS (no_match_tag
,
1065 no_match_tag_val_cmd
,
1066 "no match tag <0-65535>",
1069 "Match tag of route\n"
1076 "set metric <0-4294967295>",
1078 "Metric value for destination routing protocol\n"
1081 return eigrp_route_set_add (vty
, vty
->index
, "metric", argv
[0]);
1085 set_metric_addsub_cmd
,
1086 "set metric <+/-metric>",
1088 "Metric value for destination routing protocol\n"
1089 "Add or subtract metric\n")
1091 DEFUN (no_set_metric
,
1096 "Metric value for destination routing protocol\n")
1099 return eigrp_route_set_delete (vty
, vty
->index
, "metric", NULL
);
1101 return eigrp_route_set_delete (vty
, vty
->index
, "metric", argv
[0]);
1104 ALIAS (no_set_metric
,
1105 no_set_metric_val_cmd
,
1106 "no set metric (<0-4294967295>|<+/-metric>)",
1109 "Metric value for destination routing protocol\n"
1111 "Add or subtract metric\n")
1113 DEFUN (set_ip_nexthop
,
1115 "set ip next-hop A.B.C.D",
1118 "Next hop address\n"
1119 "IP address of next hop\n")
1124 ret
= str2sockunion (argv
[0], &su
);
1127 vty_out (vty
, "%% Malformed next-hop address%s", VTY_NEWLINE
);
1131 return eigrp_route_set_add (vty
, vty
->index
, "ip next-hop", argv
[0]);
1134 DEFUN (no_set_ip_nexthop
,
1135 no_set_ip_nexthop_cmd
,
1136 "no set ip next-hop",
1140 "Next hop address\n")
1143 return eigrp_route_set_delete (vty
, vty
->index
, "ip next-hop", NULL
);
1145 return eigrp_route_set_delete (vty
, vty
->index
, "ip next-hop", argv
[0]);
1148 ALIAS (no_set_ip_nexthop
,
1149 no_set_ip_nexthop_val_cmd
,
1150 "no set ip next-hop A.B.C.D",
1154 "Next hop address\n"
1155 "IP address of next hop\n")
1159 "set tag <0-65535>",
1161 "Tag value for routing protocol\n"
1164 return eigrp_route_set_add (vty
, vty
->index
, "tag", argv
[0]);
1172 "Tag value for routing protocol\n")
1175 return eigrp_route_set_delete (vty
, vty
->index
, "tag", NULL
);
1177 return eigrp_route_set_delete (vty
, vty
->index
, "tag", argv
[0]);
1182 "no set tag <0-65535>",
1185 "Tag value for routing protocol\n"
1189 /* Route-map init */
1191 eigrp_route_map_init ()
1194 route_map_init_vty ();
1195 route_map_add_hook (eigrp_route_map_update
);
1196 route_map_delete_hook (eigrp_route_map_update
);
1198 /*route_map_install_match (&route_match_metric_cmd);
1199 route_map_install_match (&route_match_interface_cmd);*/
1200 /*route_map_install_match (&route_match_ip_next_hop_cmd);
1201 route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd);
1202 route_map_install_match (&route_match_ip_address_cmd);
1203 route_map_install_match (&route_match_ip_address_prefix_list_cmd);*/
1204 /*route_map_install_match (&route_match_tag_cmd);*/
1206 /*route_map_install_set (&route_set_metric_cmd);
1207 route_map_install_set (&route_set_ip_nexthop_cmd);
1208 route_map_install_set (&route_set_tag_cmd);*/
1210 /*install_element (RMAP_NODE, &route_match_metric_cmd);
1211 install_element (RMAP_NODE, &no_match_metric_cmd);
1212 install_element (RMAP_NODE, &no_match_metric_val_cmd);
1213 install_element (RMAP_NODE, &route_match_interface_cmd);
1214 install_element (RMAP_NODE, &no_match_interface_cmd);
1215 install_element (RMAP_NODE, &no_match_interface_val_cmd);
1216 install_element (RMAP_NODE, &route_match_ip_next_hop_cmd);
1217 install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
1218 install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
1219 install_element (RMAP_NODE, &route_match_ip_next_hop_prefix_list_cmd);
1220 install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
1221 install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd);*/
1222 /*install_element (RMAP_NODE, &route_match_ip_address_cmd);
1223 install_element (RMAP_NODE, &no_match_ip_address_cmd);
1224 install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
1225 install_element (RMAP_NODE, &route_match_ip_address_prefix_list_cmd);
1226 install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
1227 install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd);*/
1228 /*install_element (RMAP_NODE, &route_match_tag_cmd);
1229 install_element (RMAP_NODE, &no_match_tag_cmd);
1230 install_element (RMAP_NODE, &no_match_tag_val_cmd);*/
1232 /*install_element (RMAP_NODE, &set_metric_cmd);
1233 install_element (RMAP_NODE, &set_metric_addsub_cmd);
1234 install_element (RMAP_NODE, &no_set_metric_cmd);
1235 install_element (RMAP_NODE, &no_set_metric_val_cmd);
1236 install_element (RMAP_NODE, &set_ip_nexthop_cmd);
1237 install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
1238 install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
1239 install_element (RMAP_NODE, &set_tag_cmd);
1240 install_element (RMAP_NODE, &no_set_tag_cmd);
1241 install_element (RMAP_NODE, &no_set_tag_val_cmd);*/