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
;
146 case RMAP_COMPILE_ERROR
:
147 vty_out(vty
, "%% Argument is malformed.\n");
148 return CMD_WARNING_CONFIG_FAILED
;
150 case RMAP_COMPILE_SUCCESS
:
152 * Intentionally not handling these cases
160 /* Delete rip route map rule. */
161 static int eigrp_route_match_delete(struct vty
*vty
,
162 struct route_map_index
*index
,
163 const char *command
, const char *arg
)
165 enum rmap_compile_rets ret
;
167 ret
= route_map_delete_match(index
, command
, arg
, type
);
169 case RMAP_RULE_MISSING
:
170 vty_out(vty
, "%% Can't find rule.\n");
171 return CMD_WARNING_CONFIG_FAILED
;
173 case RMAP_COMPILE_ERROR
:
174 vty_out(vty
, "%% Argument is malformed.\n");
175 return CMD_WARNING_CONFIG_FAILED
;
177 case RMAP_COMPILE_SUCCESS
:
179 * These cases intentionally ignored
187 /* Add eigrp route map rule. */
188 static int eigrp_route_set_add(struct vty
*vty
, struct route_map_index
*index
,
189 const char *command
, const char *arg
)
191 enum rmap_compile_rets ret
;
193 ret
= route_map_add_set(index
, command
, arg
);
195 case RMAP_RULE_MISSING
:
196 vty_out(vty
, "%% Can't find rule.\n");
197 return CMD_WARNING_CONFIG_FAILED
;
199 case RMAP_COMPILE_ERROR
:
201 * rip, ripng and other protocols share the set metric command
202 * but only values from 0 to 16 are valid for rip and ripng
203 * if metric is out of range for rip and ripng, it is
204 * not for other protocols. Do not return an error
206 if (strcmp(command
, "metric")) {
207 vty_out(vty
, "%% Argument is malformed.\n");
208 return CMD_WARNING_CONFIG_FAILED
;
211 case RMAP_COMPILE_SUCCESS
:
213 * These cases intentionally left blank here
221 /* Delete eigrp route map rule. */
222 static int eigrp_route_set_delete(struct vty
*vty
,
223 struct route_map_index
*index
,
224 const char *command
, const char *arg
)
226 enum rmap_compile_rets ret
;
228 ret
= route_map_delete_set(index
, command
, arg
);
230 case RMAP_RULE_MISSING
:
231 vty_out(vty
, "%% Can't find rule.\n");
232 return CMD_WARNING_CONFIG_FAILED
;
234 case RMAP_COMPILE_ERROR
:
235 vty_out(vty
, "%% Argument is malformed.\n");
236 return CMD_WARNING_CONFIG_FAILED
;
238 case RMAP_COMPILE_SUCCESS
:
240 * These cases intentionally not handled
248 /* Hook function for updating route_map assignment. */
250 void eigrp_route_map_update(const char *notused
)
257 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
258 if (e
->route_map
[i
].name
)
259 e
->route_map
[i
].map
= route_map_lookup_by_name(
260 e
->route_map
[i
].name
);
266 /* `match metric METRIC' */
267 /* Match function return 1 if match is success else return zero. */
268 static enum route_map_cmd_result_t
269 route_match_metric(void *rule
, struct prefix
*prefix
, route_map_object_t type
,
274 // struct rip_info *rinfo;
275 // struct eigrp_nexthop_entry *te;
276 // struct eigrp_prefix_entry *pe;
277 // struct listnode *node, *node2, *nnode, *nnode2;
280 // e = eigrp_lookup();
282 // if (type == RMAP_EIGRP)
287 // /* If external metric is available, the route-map should
288 // work on this one (for redistribute purpose) */
289 // /*check = (rinfo->external_metric) ? rinfo->external_metric :
292 // if (check == *metric)
293 // return RMAP_MATCH;
295 // return RMAP_NOMATCH;
300 /* Route map `match metric' match statement. `arg' is METRIC value */
301 static void *route_match_metric_compile(const char *arg
)
305 // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (uint32_t));
306 // *metric = atoi (arg);
311 // XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
315 /* Free route map's compiled `match metric' value. */
316 static void 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
= {
323 "metric", route_match_metric
, route_match_metric_compile
,
324 route_match_metric_free
};
326 /* `match interface IFNAME' */
327 /* Match function return 1 if match is success else return zero. */
328 static enum route_map_cmd_result_t
329 route_match_interface(void *rule
, struct prefix
*prefix
,
330 route_map_object_t type
, void *object
)
332 // struct rip_info *rinfo;
333 // struct interface *ifp;
336 // if (type == RMAP_EIGRP)
339 // ifp = if_lookup_by_name(ifname);
342 // return RMAP_NOMATCH;
346 // /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex ==
348 // return RMAP_MATCH;
350 // return RMAP_NOMATCH;*/
355 /* Route map `match interface' match statement. `arg' is IFNAME value */
356 /* XXX I don`t know if I need to check does interface exist? */
357 static void *route_match_interface_compile(const char *arg
)
359 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
362 /* Free route map's compiled `match interface' value. */
363 static void route_match_interface_free(void *rule
)
365 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
368 /* Route map commands for interface matching. */
369 struct route_map_rule_cmd route_match_interface_cmd
= {
370 "interface", route_match_interface
, route_match_interface_compile
,
371 route_match_interface_free
};
373 /* `match ip next-hop IP_ACCESS_LIST' */
375 /* Match function return 1 if match is success else return zero. */
376 static enum route_map_cmd_result_t
377 route_match_ip_next_hop(void *rule
, struct prefix
*prefix
,
378 route_map_object_t type
, void *object
)
380 // struct access_list *alist;
381 // struct rip_info *rinfo;
382 // struct prefix_ipv4 p;
384 // if (type == RMAP_EIGRP)
387 // p.family = AF_INET;
388 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop :
390 // p.prefixlen = IPV4_MAX_BITLEN;
392 // alist = access_list_lookup (AFI_IP, (char *) rule);
393 // if (alist == NULL)
394 // return RMAP_NOMATCH;
396 // return (access_list_apply (alist, &p) == FILTER_DENY ?
397 // RMAP_NOMATCH : RMAP_MATCH);
402 /* Route map `ip next-hop' match statement. `arg' should be
404 static void *route_match_ip_next_hop_compile(const char *arg
)
406 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
409 /* Free route map's compiled `. */
410 static void route_match_ip_next_hop_free(void *rule
)
412 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
415 /* Route map commands for ip next-hop matching. */
416 static struct route_map_rule_cmd route_match_ip_next_hop_cmd
= {
417 "ip next-hop", route_match_ip_next_hop
, route_match_ip_next_hop_compile
,
418 route_match_ip_next_hop_free
};
420 /* `match ip next-hop prefix-list PREFIX_LIST' */
422 static enum route_map_cmd_result_t
423 route_match_ip_next_hop_prefix_list(void *rule
, struct prefix
*prefix
,
424 route_map_object_t type
, void *object
)
426 // struct prefix_list *plist;
427 // struct rip_info *rinfo;
428 // struct prefix_ipv4 p;
430 // if (type == RMAP_EIGRP)
433 // p.family = AF_INET;
434 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop :
436 // p.prefixlen = IPV4_MAX_BITLEN;
438 // plist = prefix_list_lookup (AFI_IP, (char *) rule);
439 // if (plist == NULL)
440 // return RMAP_NOMATCH;
442 // return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
443 // RMAP_NOMATCH : RMAP_MATCH);
448 static void *route_match_ip_next_hop_prefix_list_compile(const char *arg
)
450 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
453 static void route_match_ip_next_hop_prefix_list_free(void *rule
)
455 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
458 static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd
= {
459 "ip next-hop prefix-list", route_match_ip_next_hop_prefix_list
,
460 route_match_ip_next_hop_prefix_list_compile
,
461 route_match_ip_next_hop_prefix_list_free
};
463 /* `match ip address IP_ACCESS_LIST' */
465 /* Match function should return 1 if match is success else return
467 static enum route_map_cmd_result_t
468 route_match_ip_address(void *rule
, struct prefix
*prefix
,
469 route_map_object_t type
, void *object
)
471 struct access_list
*alist
;
473 if (type
== RMAP_EIGRP
) {
474 alist
= access_list_lookup(AFI_IP
, (char *)rule
);
478 return (access_list_apply(alist
, prefix
) == FILTER_DENY
485 /* Route map `ip address' match statement. `arg' should be
487 static void *route_match_ip_address_compile(const char *arg
)
489 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
492 /* Free route map's compiled `ip address' value. */
493 static void route_match_ip_address_free(void *rule
)
495 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
498 /* Route map commands for ip address matching. */
499 static struct route_map_rule_cmd route_match_ip_address_cmd
= {
500 "ip address", route_match_ip_address
, route_match_ip_address_compile
,
501 route_match_ip_address_free
};
503 /* `match ip address prefix-list PREFIX_LIST' */
505 static enum route_map_cmd_result_t
506 route_match_ip_address_prefix_list(void *rule
, struct prefix
*prefix
,
507 route_map_object_t type
, void *object
)
509 struct prefix_list
*plist
;
511 if (type
== RMAP_EIGRP
) {
512 plist
= prefix_list_lookup(AFI_IP
, (char *)rule
);
516 return (prefix_list_apply(plist
, prefix
) == PREFIX_DENY
523 static void *route_match_ip_address_prefix_list_compile(const char *arg
)
525 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
528 static void route_match_ip_address_prefix_list_free(void *rule
)
530 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
533 static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd
= {
534 "ip address prefix-list", route_match_ip_address_prefix_list
,
535 route_match_ip_address_prefix_list_compile
,
536 route_match_ip_address_prefix_list_free
};
538 /* `match tag TAG' */
539 /* Match function return 1 if match is success else return zero. */
540 static enum route_map_cmd_result_t
541 route_match_tag(void *rule
, struct prefix
*prefix
, route_map_object_t type
,
544 // unsigned short *tag;
545 // struct rip_info *rinfo;
547 // if (type == RMAP_EIGRP)
552 // /* The information stored by rinfo is host ordered. */
553 // /*if (rinfo->tag == *tag)
554 // return RMAP_MATCH;
556 // return RMAP_NOMATCH;*/
561 /* Route map `match tag' match statement. `arg' is TAG value */
562 static void *route_match_tag_compile(const char *arg
)
564 // unsigned short *tag;
566 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short));
567 // *tag = atoi (arg);
572 /* Free route map's compiled `match tag' value. */
573 static void route_match_tag_free(void *rule
)
575 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
578 /* Route map commands for tag matching. */
579 struct route_map_rule_cmd route_match_tag_cmd
= {
580 "tag", route_match_tag
, route_match_tag_compile
, route_match_tag_free
};
582 /* Set metric to attribute. */
583 static enum route_map_cmd_result_t
584 route_set_metric(void *rule
, struct prefix
*prefix
,
585 route_map_object_t type
, void *object
)
587 // if (type == RMAP_RIP)
589 // struct rip_metric_modifier *mod;
590 // struct rip_info *rinfo;
595 // /*if (mod->type == metric_increment)
596 // rinfo->metric_out += mod->metric;
597 // else if (mod->type == metric_decrement)
598 // rinfo->metric_out -= mod->metric;
599 // else if (mod->type == metric_absolute)
600 // rinfo->metric_out = mod->metric;
602 // if ((signed int)rinfo->metric_out < 1)
603 // rinfo->metric_out = 1;
604 // if (rinfo->metric_out > RIP_METRIC_INFINITY)
605 // rinfo->metric_out = RIP_METRIC_INFINITY;*/
607 // rinfo->metric_set = 1;
612 /* set metric compilation. */
613 static void *route_set_metric_compile(const char *arg
)
619 // char *endptr = NULL;
620 // struct rip_metric_modifier *mod;
622 // len = strlen (arg);
628 // /* Examine first character. */
629 // if (arg[0] == '+')
631 // //type = metric_increment;
634 // else if (arg[0] == '-')
636 // //type = metric_decrement;
640 // type = metric_absolute;*/
642 // /* Check beginning with digit string. */
643 // if (*pnt < '0' || *pnt > '9')
646 // /* Convert string to integer. */
647 // metric = strtol (pnt, &endptr, 10);
649 // if (metric == LONG_MAX || *endptr != '\0')
651 // /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
654 // mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
655 // sizeof (struct rip_metric_modifier));
657 // mod->metric = metric;
662 /* Free route map's compiled `set metric' value. */
663 static void route_set_metric_free(void *rule
)
665 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
668 /* Set metric rule structure. */
669 static struct route_map_rule_cmd route_set_metric_cmd
= {
670 "metric", route_set_metric
, route_set_metric_compile
,
671 route_set_metric_free
,
674 /* `set ip next-hop IP_ADDRESS' */
676 /* Set nexthop to object. ojbect must be pointer to struct attr. */
677 static enum route_map_cmd_result_t
678 route_set_ip_nexthop(void *rule
, struct prefix
*prefix
,
679 route_map_object_t type
, void *object
)
681 // struct in_addr *address;
682 // struct rip_info *rinfo;
684 // if(type == RMAP_RIP)
686 // /* Fetch routemap's rule information. */
690 // /* Set next hop value. */
691 // rinfo->nexthop_out = *address;
697 /* Route map `ip nexthop' compile function. Given string is converted
698 to struct in_addr structure. */
699 static void *route_set_ip_nexthop_compile(const char *arg
)
702 // struct in_addr *address;
704 // address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct
707 // ret = inet_aton (arg, address);
711 // XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
718 /* Free route map's compiled `ip nexthop' value. */
719 static void route_set_ip_nexthop_free(void *rule
)
721 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
724 /* Route map commands for ip nexthop set. */
725 static struct route_map_rule_cmd route_set_ip_nexthop_cmd
= {
726 "ip next-hop", route_set_ip_nexthop
, route_set_ip_nexthop_compile
,
727 route_set_ip_nexthop_free
};
731 /* Set tag to object. ojbect must be pointer to struct attr. */
732 static enum route_map_cmd_result_t
733 route_set_tag(void *rule
, struct prefix
*prefix
,
734 route_map_object_t type
, void *object
)
736 // unsigned short *tag;
737 // struct rip_info *rinfo;
739 // if(type == RMAP_RIP)
741 // /* Fetch routemap's rule information. */
745 // /* Set next hop value. */
746 // rinfo->tag_out = *tag;
752 /* Route map `tag' compile function. Given string is converted
753 to unsigned short. */
754 static void *route_set_tag_compile(const char *arg
)
756 // unsigned short *tag;
758 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short));
759 // *tag = atoi (arg);
764 /* Free route map's compiled `ip nexthop' value. */
765 static void route_set_tag_free(void *rule
)
767 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
770 /* Route map commands for tag set. */
771 static struct route_map_rule_cmd route_set_tag_cmd
= {
772 "tag", route_set_tag
, route_set_tag_compile
, route_set_tag_free
};
774 #define MATCH_STR "Match values from routing table\n"
775 #define SET_STR "Set values in destination routing protocol\n"
779 "match metric (0-4294967295)",
781 "Match metric of route\n"
784 return eigrp_route_match_add(vty
, vty
->index
, "metric", argv
[0]);
787 DEFUN (no_match_metric
,
792 "Match metric of route\n")
795 return eigrp_route_match_delete(vty
, vty
->index
, "metric",
798 return eigrp_route_match_delete(vty
, vty
->index
, "metric", argv
[0]);
801 ALIAS(no_match_metric
, no_match_metric_val_cmd
,
802 "no match metric (0-4294967295)", NO_STR MATCH_STR
803 "Match metric of route\n"
806 DEFUN (match_interface
,
808 "match interface WORD",
810 "Match first hop interface of route\n"
813 return eigrp_route_match_add(vty
, vty
->index
, "interface", argv
[0]);
816 DEFUN (no_match_interface
,
817 no_match_interface_cmd
,
818 "no match interface",
821 "Match first hop interface of route\n")
824 return eigrp_route_match_delete(vty
, vty
->index
, "interface",
827 return eigrp_route_match_delete(vty
, vty
->index
, "interface", argv
[0]);
830 ALIAS(no_match_interface
, no_match_interface_val_cmd
, "no match interface WORD",
832 "Match first hop interface of route\n"
835 DEFUN (match_ip_next_hop
,
836 match_ip_next_hop_cmd
,
837 "match ip next-hop ((1-199)|(1300-2699)|WORD)",
840 "Match next-hop address of route\n"
841 "IP access-list number\n"
842 "IP access-list number (expanded range)\n"
843 "IP Access-list name\n")
845 return eigrp_route_match_add(vty
, vty
->index
, "ip next-hop", argv
[0]);
848 DEFUN (no_match_ip_next_hop
,
849 no_match_ip_next_hop_cmd
,
850 "no match ip next-hop",
854 "Match next-hop address of route\n")
857 return eigrp_route_match_delete(vty
, vty
->index
, "ip next-hop",
860 return eigrp_route_match_delete(vty
, vty
->index
, "ip next-hop",
864 ALIAS(no_match_ip_next_hop
, no_match_ip_next_hop_val_cmd
,
865 "no match ip next-hop ((1-199)|(1300-2699)|WORD)", NO_STR MATCH_STR IP_STR
866 "Match next-hop address of route\n"
867 "IP access-list number\n"
868 "IP access-list number (expanded range)\n"
869 "IP Access-list name\n")
871 DEFUN (match_ip_next_hop_prefix_list
,
872 match_ip_next_hop_prefix_list_cmd
,
873 "match ip next-hop prefix-list WORD",
876 "Match next-hop address of route\n"
877 "Match entries of prefix-lists\n"
878 "IP prefix-list name\n")
880 return eigrp_route_match_add(vty
, vty
->index
, "ip next-hop prefix-list",
884 DEFUN (no_match_ip_next_hop_prefix_list
,
885 no_match_ip_next_hop_prefix_list_cmd
,
886 "no match ip next-hop prefix-list",
890 "Match next-hop address of route\n"
891 "Match entries of prefix-lists\n")
894 return eigrp_route_match_delete(
895 vty
, vty
->index
, "ip next-hop prefix-list", NULL
);
897 return eigrp_route_match_delete(vty
, vty
->index
,
898 "ip next-hop prefix-list", argv
[0]);
901 ALIAS(no_match_ip_next_hop_prefix_list
,
902 no_match_ip_next_hop_prefix_list_val_cmd
,
903 "no match ip next-hop prefix-list WORD", NO_STR MATCH_STR IP_STR
904 "Match next-hop address of route\n"
905 "Match entries of prefix-lists\n"
906 "IP prefix-list name\n")
908 DEFUN (match_ip_address
,
909 match_ip_address_cmd
,
910 "match ip address ((1-199)|(1300-2699)|WORD)",
913 "Match address of route\n"
914 "IP access-list number\n"
915 "IP access-list number (expanded range)\n"
916 "IP Access-list name\n")
918 return eigrp_route_match_add(vty
, vty
->index
, "ip address", argv
[0]);
921 DEFUN (no_match_ip_address
,
922 no_match_ip_address_cmd
,
923 "no match ip address",
927 "Match address of route\n")
930 return eigrp_route_match_delete(vty
, vty
->index
, "ip address",
933 return eigrp_route_match_delete(vty
, vty
->index
, "ip address", argv
[0]);
936 ALIAS(no_match_ip_address
, no_match_ip_address_val_cmd
,
937 "no match ip address ((1-199)|(1300-2699)|WORD)", NO_STR MATCH_STR IP_STR
938 "Match address of route\n"
939 "IP access-list number\n"
940 "IP access-list number (expanded range)\n"
941 "IP Access-list name\n")
943 DEFUN (match_ip_address_prefix_list
,
944 match_ip_address_prefix_list_cmd
,
945 "match ip address prefix-list WORD",
948 "Match address of route\n"
949 "Match entries of prefix-lists\n"
950 "IP prefix-list name\n")
952 return eigrp_route_match_add(vty
, vty
->index
, "ip address prefix-list",
956 DEFUN (no_match_ip_address_prefix_list
,
957 no_match_ip_address_prefix_list_cmd
,
958 "no match ip address prefix-list",
962 "Match address of route\n"
963 "Match entries of prefix-lists\n")
966 return eigrp_route_match_delete(vty
, vty
->index
,
967 "ip address prefix-list", NULL
);
969 return eigrp_route_match_delete(vty
, vty
->index
,
970 "ip address prefix-list", argv
[0]);
973 ALIAS(no_match_ip_address_prefix_list
, no_match_ip_address_prefix_list_val_cmd
,
974 "no match ip address prefix-list WORD", NO_STR MATCH_STR IP_STR
975 "Match address of route\n"
976 "Match entries of prefix-lists\n"
977 "IP prefix-list name\n")
981 "match tag (0-65535)",
983 "Match tag of route\n"
986 return eigrp_route_match_add(vty
, vty
->index
, "tag", argv
[0]);
994 "Match tag of route\n")
997 return eigrp_route_match_delete(vty
, vty
->index
, "tag", NULL
);
999 return eigrp_route_match_delete(vty
, vty
->index
, "tag", argv
[0]);
1002 ALIAS(no_match_tag
, no_match_tag_val_cmd
, "no match tag (0-65535)",
1004 "Match tag of route\n"
1011 "set metric (0-4294967295)",
1013 "Metric value for destination routing protocol\n"
1016 return eigrp_route_set_add(vty
, vty
->index
, "metric", argv
[0]);
1019 ALIAS(set_metric
, set_metric_addsub_cmd
, "set metric <+/-metric>", SET_STR
1020 "Metric value for destination routing protocol\n"
1021 "Add or subtract metric\n")
1023 DEFUN (no_set_metric
,
1028 "Metric value for destination routing protocol\n")
1031 return eigrp_route_set_delete(vty
, vty
->index
, "metric", NULL
);
1033 return eigrp_route_set_delete(vty
, vty
->index
, "metric", argv
[0]);
1036 ALIAS(no_set_metric
, no_set_metric_val_cmd
,
1037 "no set metric ((0-4294967295)|<+/-metric>)", NO_STR SET_STR
1038 "Metric value for destination routing protocol\n"
1040 "Add or subtract metric\n")
1042 DEFUN (set_ip_nexthop
,
1044 "set ip next-hop A.B.C.D",
1047 "Next hop address\n"
1048 "IP address of next hop\n")
1053 ret
= str2sockunion(argv
[0], &su
);
1055 vty_out(vty
, "%% Malformed next-hop address\n");
1056 return CMD_WARNING_CONFIG_FAILED
;
1059 return eigrp_route_set_add(vty
, vty
->index
, "ip next-hop", argv
[0]);
1062 DEFUN (no_set_ip_nexthop
,
1063 no_set_ip_nexthop_cmd
,
1064 "no set ip next-hop",
1068 "Next hop address\n")
1071 return eigrp_route_set_delete(vty
, vty
->index
, "ip next-hop",
1074 return eigrp_route_set_delete(vty
, vty
->index
, "ip next-hop", argv
[0]);
1077 ALIAS(no_set_ip_nexthop
, no_set_ip_nexthop_val_cmd
,
1078 "no set ip next-hop A.B.C.D", NO_STR SET_STR IP_STR
1079 "Next hop address\n"
1080 "IP address of next hop\n")
1084 "set tag (0-65535)",
1086 "Tag value for routing protocol\n"
1089 return eigrp_route_set_add(vty
, vty
->index
, "tag", argv
[0]);
1097 "Tag value for routing protocol\n")
1100 return eigrp_route_set_delete(vty
, vty
->index
, "tag", NULL
);
1102 return eigrp_route_set_delete(vty
, vty
->index
, "tag", argv
[0]);
1105 ALIAS(no_set_tag
, no_set_tag_val_cmd
, "no set tag (0-65535)", NO_STR SET_STR
1106 "Tag value for routing protocol\n"
1110 /* Route-map init */
1111 void eigrp_route_map_init()
1114 route_map_init_vty();
1115 route_map_add_hook(eigrp_route_map_update
);
1116 route_map_delete_hook(eigrp_route_map_update
);
1118 /*route_map_install_match (&route_match_metric_cmd);
1119 route_map_install_match (&route_match_interface_cmd);*/
1120 /*route_map_install_match (&route_match_ip_next_hop_cmd);
1121 route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd);
1122 route_map_install_match (&route_match_ip_address_cmd);
1123 route_map_install_match (&route_match_ip_address_prefix_list_cmd);*/
1124 /*route_map_install_match (&route_match_tag_cmd);*/
1126 /*route_map_install_set (&route_set_metric_cmd);
1127 route_map_install_set (&route_set_ip_nexthop_cmd);
1128 route_map_install_set (&route_set_tag_cmd);*/
1130 /*install_element (RMAP_NODE, &route_match_metric_cmd);
1131 install_element (RMAP_NODE, &no_match_metric_cmd);
1132 install_element (RMAP_NODE, &no_match_metric_val_cmd);
1133 install_element (RMAP_NODE, &route_match_interface_cmd);
1134 install_element (RMAP_NODE, &no_match_interface_cmd);
1135 install_element (RMAP_NODE, &no_match_interface_val_cmd);
1136 install_element (RMAP_NODE, &route_match_ip_next_hop_cmd);
1137 install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
1138 install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
1139 install_element (RMAP_NODE, &route_match_ip_next_hop_prefix_list_cmd);
1140 install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
1141 install_element (RMAP_NODE,
1142 &no_match_ip_next_hop_prefix_list_val_cmd);*/
1143 /*install_element (RMAP_NODE, &route_match_ip_address_cmd);
1144 install_element (RMAP_NODE, &no_match_ip_address_cmd);
1145 install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
1146 install_element (RMAP_NODE, &route_match_ip_address_prefix_list_cmd);
1147 install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
1148 install_element (RMAP_NODE,
1149 &no_match_ip_address_prefix_list_val_cmd);*/
1150 /*install_element (RMAP_NODE, &route_match_tag_cmd);
1151 install_element (RMAP_NODE, &no_match_tag_cmd);
1152 install_element (RMAP_NODE, &no_match_tag_val_cmd);*/
1154 /*install_element (RMAP_NODE, &set_metric_cmd);
1155 install_element (RMAP_NODE, &set_metric_addsub_cmd);
1156 install_element (RMAP_NODE, &no_set_metric_cmd);
1157 install_element (RMAP_NODE, &no_set_metric_val_cmd);
1158 install_element (RMAP_NODE, &set_ip_nexthop_cmd);
1159 install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
1160 install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
1161 install_element (RMAP_NODE, &set_tag_cmd);
1162 install_element (RMAP_NODE, &no_set_tag_cmd);
1163 install_element (RMAP_NODE, &no_set_tag_val_cmd);*/