2 * EIGRP Filter Functions.
3 * Copyright (C) 2013-2015
15 * Note: This file contains skeleton for all possible matches and sets,
16 * but they are hidden in comment block and not properly implemented.
17 * At this time, the only function we consider useful for our use
18 * in distribute command in EIGRP is matching destination IP (with both
19 * access and prefix list).
22 * This file is part of GNU Zebra.
24 * GNU Zebra is free software; you can redistribute it and/or modify it
25 * under the terms of the GNU General Public License as published by the
26 * Free Software Foundation; either version 2, or (at your option) any
29 * GNU Zebra is distributed in the hope that it will be useful, but
30 * WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 * General Public License for more details.
34 * You should have received a copy of the GNU General Public License along
35 * with this program; see the file COPYING; if not, write to the Free Software
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
48 #include "sockunion.h" /* for inet_aton () */
51 #include "eigrpd/eigrpd.h"
52 #include "eigrpd/eigrp_structs.h"
53 #include "eigrpd/eigrp_const.h"
54 #include "eigrpd/eigrp_macros.h"
55 #include "eigrpd/eigrp_routemap.h"
57 void eigrp_if_rmap_update(struct if_rmap
*if_rmap
)
59 struct interface
*ifp
;
60 struct eigrp_interface
*ei
, *ei2
;
61 struct listnode
*node
, *nnode
;
62 struct route_map
*rmap
;
65 ifp
= if_lookup_by_name(if_rmap
->ifname
);
71 for (ALL_LIST_ELEMENTS(e
->eiflist
, node
, nnode
, ei2
)) {
72 if (strcmp(ei2
->ifp
->name
, ifp
->name
) == 0) {
78 if (if_rmap
->routemap
[IF_RMAP_IN
]) {
79 rmap
= route_map_lookup_by_name(if_rmap
->routemap
[IF_RMAP_IN
]);
81 ei
->routemap
[IF_RMAP_IN
] = rmap
;
83 ei
->routemap
[IF_RMAP_IN
] = NULL
;
85 ei
->routemap
[EIGRP_FILTER_IN
] = NULL
;
87 if (if_rmap
->routemap
[IF_RMAP_OUT
]) {
88 rmap
= route_map_lookup_by_name(if_rmap
->routemap
[IF_RMAP_OUT
]);
90 ei
->routemap
[IF_RMAP_OUT
] = rmap
;
92 ei
->routemap
[IF_RMAP_OUT
] = NULL
;
94 ei
->routemap
[EIGRP_FILTER_OUT
] = NULL
;
97 void eigrp_if_rmap_update_interface(struct interface
*ifp
)
99 struct if_rmap
*if_rmap
;
101 if_rmap
= if_rmap_lookup(ifp
->name
);
103 eigrp_if_rmap_update(if_rmap
);
106 void eigrp_routemap_update_redistribute(void)
114 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
115 if (e
->route_map
[i
].name
)
116 e
->route_map
[i
].map
= route_map_lookup_by_name(
117 e
->route_map
[i
].name
);
123 void eigrp_rmap_update(const char *notused
)
125 struct interface
*ifp
;
126 struct listnode
*node
, *nnode
;
128 for (ALL_LIST_ELEMENTS(iflist
, node
, nnode
, ifp
))
129 eigrp_if_rmap_update_interface(ifp
);
131 eigrp_routemap_update_redistribute();
134 /* Add eigrp route map rule. */
135 static int eigrp_route_match_add(struct vty
*vty
, struct route_map_index
*index
,
136 const char *command
, const char *arg
)
139 ret
= route_map_add_match(index
, command
, arg
, type
);
141 case RMAP_RULE_MISSING
:
142 vty_out(vty
, "%% Can't find rule.\n");
143 return CMD_WARNING_CONFIG_FAILED
;
145 case RMAP_COMPILE_ERROR
:
146 vty_out(vty
, "%% Argument is malformed.\n");
147 return CMD_WARNING_CONFIG_FAILED
;
149 case RMAP_COMPILE_SUCCESS
:
156 /* Delete rip route map rule. */
157 static int eigrp_route_match_delete(struct vty
*vty
,
158 struct route_map_index
*index
,
159 const char *command
, const char *arg
)
162 ret
= route_map_delete_match(index
, command
, arg
);
164 case RMAP_RULE_MISSING
:
165 vty_out(vty
, "%% Can't find rule.\n");
166 return CMD_WARNING_CONFIG_FAILED
;
168 case RMAP_COMPILE_ERROR
:
169 vty_out(vty
, "%% Argument is malformed.\n");
170 return CMD_WARNING_CONFIG_FAILED
;
172 case RMAP_COMPILE_SUCCESS
:
179 /* Add eigrp route map rule. */
180 static int eigrp_route_set_add(struct vty
*vty
, struct route_map_index
*index
,
181 const char *command
, const char *arg
)
185 ret
= route_map_add_set(index
, command
, arg
);
187 case RMAP_RULE_MISSING
:
188 vty_out(vty
, "%% Can't find rule.\n");
189 return CMD_WARNING_CONFIG_FAILED
;
191 case RMAP_COMPILE_ERROR
:
193 * rip, ripng and other protocols share the set metric command
194 * but only values from 0 to 16 are valid for rip and ripng
195 * if metric is out of range for rip and ripng, it is
196 * not for other protocols. Do not return an error
198 if (strcmp(command
, "metric")) {
199 vty_out(vty
, "%% Argument is malformed.\n");
200 return CMD_WARNING_CONFIG_FAILED
;
203 case RMAP_COMPILE_SUCCESS
:
210 /* Delete eigrp route map rule. */
211 static int eigrp_route_set_delete(struct vty
*vty
,
212 struct route_map_index
*index
,
213 const char *command
, const char *arg
)
217 ret
= route_map_delete_set(index
, command
, arg
);
219 case RMAP_RULE_MISSING
:
220 vty_out(vty
, "%% Can't find rule.\n");
221 return CMD_WARNING_CONFIG_FAILED
;
223 case RMAP_COMPILE_ERROR
:
224 vty_out(vty
, "%% Argument is malformed.\n");
225 return CMD_WARNING_CONFIG_FAILED
;
227 case RMAP_COMPILE_SUCCESS
:
234 /* Hook function for updating route_map assignment. */
236 void eigrp_route_map_update(const char *notused
)
243 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
244 if (e
->route_map
[i
].name
)
245 e
->route_map
[i
].map
= route_map_lookup_by_name(
246 e
->route_map
[i
].name
);
252 /* `match metric METRIC' */
253 /* Match function return 1 if match is success else return zero. */
254 static route_map_result_t
route_match_metric(void *rule
, struct prefix
*prefix
,
255 route_map_object_t type
,
260 // struct rip_info *rinfo;
261 // struct eigrp_nexthop_entry *te;
262 // struct eigrp_prefix_entry *pe;
263 // struct listnode *node, *node2, *nnode, *nnode2;
266 // e = eigrp_lookup();
268 // if (type == RMAP_EIGRP)
273 // /* If external metric is available, the route-map should
274 // work on this one (for redistribute purpose) */
275 // /*check = (rinfo->external_metric) ? rinfo->external_metric :
278 // if (check == *metric)
279 // return RMAP_MATCH;
281 // return RMAP_NOMATCH;
286 /* Route map `match metric' match statement. `arg' is METRIC value */
287 static void *route_match_metric_compile(const char *arg
)
291 // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (uint32_t));
292 // *metric = atoi (arg);
297 // XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
301 /* Free route map's compiled `match metric' value. */
302 static void route_match_metric_free(void *rule
)
304 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
307 /* Route map commands for metric matching. */
308 struct route_map_rule_cmd route_match_metric_cmd
= {
309 "metric", route_match_metric
, route_match_metric_compile
,
310 route_match_metric_free
};
312 /* `match interface IFNAME' */
313 /* Match function return 1 if match is success else return zero. */
314 static route_map_result_t
route_match_interface(void *rule
,
315 struct prefix
*prefix
,
316 route_map_object_t type
,
319 // struct rip_info *rinfo;
320 // struct interface *ifp;
323 // if (type == RMAP_EIGRP)
326 // ifp = if_lookup_by_name(ifname);
329 // return RMAP_NOMATCH;
333 // /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex ==
335 // return RMAP_MATCH;
337 // return RMAP_NOMATCH;*/
342 /* Route map `match interface' match statement. `arg' is IFNAME value */
343 /* XXX I don`t know if I need to check does interface exist? */
344 static void *route_match_interface_compile(const char *arg
)
346 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
349 /* Free route map's compiled `match interface' value. */
350 static void route_match_interface_free(void *rule
)
352 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
355 /* Route map commands for interface matching. */
356 struct route_map_rule_cmd route_match_interface_cmd
= {
357 "interface", route_match_interface
, route_match_interface_compile
,
358 route_match_interface_free
};
360 /* `match ip next-hop IP_ACCESS_LIST' */
362 /* Match function return 1 if match is success else return zero. */
363 static route_map_result_t
route_match_ip_next_hop(void *rule
,
364 struct prefix
*prefix
,
365 route_map_object_t type
,
368 // struct access_list *alist;
369 // struct rip_info *rinfo;
370 // struct prefix_ipv4 p;
372 // if (type == RMAP_EIGRP)
375 // p.family = AF_INET;
376 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop :
378 // p.prefixlen = IPV4_MAX_BITLEN;
380 // alist = access_list_lookup (AFI_IP, (char *) rule);
381 // if (alist == NULL)
382 // return RMAP_NOMATCH;
384 // return (access_list_apply (alist, &p) == FILTER_DENY ?
385 // RMAP_NOMATCH : RMAP_MATCH);
390 /* Route map `ip next-hop' match statement. `arg' should be
392 static void *route_match_ip_next_hop_compile(const char *arg
)
394 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
397 /* Free route map's compiled `. */
398 static void route_match_ip_next_hop_free(void *rule
)
400 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
403 /* Route map commands for ip next-hop matching. */
404 static struct route_map_rule_cmd route_match_ip_next_hop_cmd
= {
405 "ip next-hop", route_match_ip_next_hop
, route_match_ip_next_hop_compile
,
406 route_match_ip_next_hop_free
};
408 /* `match ip next-hop prefix-list PREFIX_LIST' */
410 static route_map_result_t
411 route_match_ip_next_hop_prefix_list(void *rule
, struct prefix
*prefix
,
412 route_map_object_t type
, void *object
)
414 // struct prefix_list *plist;
415 // struct rip_info *rinfo;
416 // struct prefix_ipv4 p;
418 // if (type == RMAP_EIGRP)
421 // p.family = AF_INET;
422 // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop :
424 // p.prefixlen = IPV4_MAX_BITLEN;
426 // plist = prefix_list_lookup (AFI_IP, (char *) rule);
427 // if (plist == NULL)
428 // return RMAP_NOMATCH;
430 // return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
431 // RMAP_NOMATCH : RMAP_MATCH);
436 static void *route_match_ip_next_hop_prefix_list_compile(const char *arg
)
438 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
441 static void route_match_ip_next_hop_prefix_list_free(void *rule
)
443 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
446 static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd
= {
447 "ip next-hop prefix-list", route_match_ip_next_hop_prefix_list
,
448 route_match_ip_next_hop_prefix_list_compile
,
449 route_match_ip_next_hop_prefix_list_free
};
451 /* `match ip address IP_ACCESS_LIST' */
453 /* Match function should return 1 if match is success else return
455 static route_map_result_t
route_match_ip_address(void *rule
,
456 struct prefix
*prefix
,
457 route_map_object_t type
,
460 struct access_list
*alist
;
462 if (type
== RMAP_EIGRP
) {
463 alist
= access_list_lookup(AFI_IP
, (char *)rule
);
467 return (access_list_apply(alist
, prefix
) == FILTER_DENY
474 /* Route map `ip address' match statement. `arg' should be
476 static void *route_match_ip_address_compile(const char *arg
)
478 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
481 /* Free route map's compiled `ip address' value. */
482 static void route_match_ip_address_free(void *rule
)
484 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
487 /* Route map commands for ip address matching. */
488 static struct route_map_rule_cmd route_match_ip_address_cmd
= {
489 "ip address", route_match_ip_address
, route_match_ip_address_compile
,
490 route_match_ip_address_free
};
492 /* `match ip address prefix-list PREFIX_LIST' */
494 static route_map_result_t
495 route_match_ip_address_prefix_list(void *rule
, struct prefix
*prefix
,
496 route_map_object_t type
, void *object
)
498 struct prefix_list
*plist
;
500 if (type
== RMAP_EIGRP
) {
501 plist
= prefix_list_lookup(AFI_IP
, (char *)rule
);
505 return (prefix_list_apply(plist
, prefix
) == PREFIX_DENY
512 static void *route_match_ip_address_prefix_list_compile(const char *arg
)
514 return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED
, arg
);
517 static void route_match_ip_address_prefix_list_free(void *rule
)
519 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
522 static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd
= {
523 "ip address prefix-list", route_match_ip_address_prefix_list
,
524 route_match_ip_address_prefix_list_compile
,
525 route_match_ip_address_prefix_list_free
};
527 /* `match tag TAG' */
528 /* Match function return 1 if match is success else return zero. */
529 static route_map_result_t
route_match_tag(void *rule
, struct prefix
*prefix
,
530 route_map_object_t type
, void *object
)
532 // unsigned short *tag;
533 // struct rip_info *rinfo;
535 // if (type == RMAP_EIGRP)
540 // /* The information stored by rinfo is host ordered. */
541 // /*if (rinfo->tag == *tag)
542 // return RMAP_MATCH;
544 // return RMAP_NOMATCH;*/
549 /* Route map `match tag' match statement. `arg' is TAG value */
550 static void *route_match_tag_compile(const char *arg
)
552 // unsigned short *tag;
554 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short));
555 // *tag = atoi (arg);
560 /* Free route map's compiled `match tag' value. */
561 static void route_match_tag_free(void *rule
)
563 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
566 /* Route map commands for tag matching. */
567 struct route_map_rule_cmd route_match_tag_cmd
= {
568 "tag", route_match_tag
, route_match_tag_compile
, route_match_tag_free
};
570 /* Set metric to attribute. */
571 static route_map_result_t
route_set_metric(void *rule
, struct prefix
*prefix
,
572 route_map_object_t type
,
575 // if (type == RMAP_RIP)
577 // struct rip_metric_modifier *mod;
578 // struct rip_info *rinfo;
583 // /*if (mod->type == metric_increment)
584 // rinfo->metric_out += mod->metric;
585 // else if (mod->type == metric_decrement)
586 // rinfo->metric_out -= mod->metric;
587 // else if (mod->type == metric_absolute)
588 // rinfo->metric_out = mod->metric;
590 // if ((signed int)rinfo->metric_out < 1)
591 // rinfo->metric_out = 1;
592 // if (rinfo->metric_out > RIP_METRIC_INFINITY)
593 // rinfo->metric_out = RIP_METRIC_INFINITY;*/
595 // rinfo->metric_set = 1;
600 /* set metric compilation. */
601 static void *route_set_metric_compile(const char *arg
)
607 // char *endptr = NULL;
608 // struct rip_metric_modifier *mod;
610 // len = strlen (arg);
616 // /* Examine first character. */
617 // if (arg[0] == '+')
619 // //type = metric_increment;
622 // else if (arg[0] == '-')
624 // //type = metric_decrement;
628 // type = metric_absolute;*/
630 // /* Check beginning with digit string. */
631 // if (*pnt < '0' || *pnt > '9')
634 // /* Convert string to integer. */
635 // metric = strtol (pnt, &endptr, 10);
637 // if (metric == LONG_MAX || *endptr != '\0')
639 // /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
642 // mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
643 // sizeof (struct rip_metric_modifier));
645 // mod->metric = metric;
650 /* Free route map's compiled `set metric' value. */
651 static void route_set_metric_free(void *rule
)
653 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
656 /* Set metric rule structure. */
657 static struct route_map_rule_cmd route_set_metric_cmd
= {
658 "metric", route_set_metric
, route_set_metric_compile
,
659 route_set_metric_free
,
662 /* `set ip next-hop IP_ADDRESS' */
664 /* Set nexthop to object. ojbect must be pointer to struct attr. */
665 static route_map_result_t
route_set_ip_nexthop(void *rule
,
666 struct prefix
*prefix
,
667 route_map_object_t type
,
670 // struct in_addr *address;
671 // struct rip_info *rinfo;
673 // if(type == RMAP_RIP)
675 // /* Fetch routemap's rule information. */
679 // /* Set next hop value. */
680 // rinfo->nexthop_out = *address;
686 /* Route map `ip nexthop' compile function. Given string is converted
687 to struct in_addr structure. */
688 static void *route_set_ip_nexthop_compile(const char *arg
)
691 // struct in_addr *address;
693 // address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct
696 // ret = inet_aton (arg, address);
700 // XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
707 /* Free route map's compiled `ip nexthop' value. */
708 static void route_set_ip_nexthop_free(void *rule
)
710 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
713 /* Route map commands for ip nexthop set. */
714 static struct route_map_rule_cmd route_set_ip_nexthop_cmd
= {
715 "ip next-hop", route_set_ip_nexthop
, route_set_ip_nexthop_compile
,
716 route_set_ip_nexthop_free
};
720 /* Set tag to object. ojbect must be pointer to struct attr. */
721 static route_map_result_t
route_set_tag(void *rule
, struct prefix
*prefix
,
722 route_map_object_t type
, void *object
)
724 // unsigned short *tag;
725 // struct rip_info *rinfo;
727 // if(type == RMAP_RIP)
729 // /* Fetch routemap's rule information. */
733 // /* Set next hop value. */
734 // rinfo->tag_out = *tag;
740 /* Route map `tag' compile function. Given string is converted
741 to unsigned short. */
742 static void *route_set_tag_compile(const char *arg
)
744 // unsigned short *tag;
746 // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short));
747 // *tag = atoi (arg);
752 /* Free route map's compiled `ip nexthop' value. */
753 static void route_set_tag_free(void *rule
)
755 XFREE(MTYPE_ROUTE_MAP_COMPILED
, rule
);
758 /* Route map commands for tag set. */
759 static struct route_map_rule_cmd route_set_tag_cmd
= {
760 "tag", route_set_tag
, route_set_tag_compile
, route_set_tag_free
};
762 #define MATCH_STR "Match values from routing table\n"
763 #define SET_STR "Set values in destination routing protocol\n"
767 "match metric (0-4294967295)",
769 "Match metric of route\n"
772 return eigrp_route_match_add(vty
, vty
->index
, "metric", argv
[0]);
775 DEFUN (no_match_metric
,
780 "Match metric of route\n")
783 return eigrp_route_match_delete(vty
, vty
->index
, "metric",
786 return eigrp_route_match_delete(vty
, vty
->index
, "metric", argv
[0]);
789 ALIAS(no_match_metric
, no_match_metric_val_cmd
,
790 "no match metric (0-4294967295)", NO_STR MATCH_STR
791 "Match metric of route\n"
794 DEFUN (match_interface
,
796 "match interface WORD",
798 "Match first hop interface of route\n"
801 return eigrp_route_match_add(vty
, vty
->index
, "interface", argv
[0]);
804 DEFUN (no_match_interface
,
805 no_match_interface_cmd
,
806 "no match interface",
809 "Match first hop interface of route\n")
812 return eigrp_route_match_delete(vty
, vty
->index
, "interface",
815 return eigrp_route_match_delete(vty
, vty
->index
, "interface", argv
[0]);
818 ALIAS(no_match_interface
, no_match_interface_val_cmd
, "no match interface WORD",
820 "Match first hop interface of route\n"
823 DEFUN (match_ip_next_hop
,
824 match_ip_next_hop_cmd
,
825 "match ip next-hop ((1-199)|(1300-2699)|WORD)",
828 "Match next-hop address of route\n"
829 "IP access-list number\n"
830 "IP access-list number (expanded range)\n"
831 "IP Access-list name\n")
833 return eigrp_route_match_add(vty
, vty
->index
, "ip next-hop", argv
[0]);
836 DEFUN (no_match_ip_next_hop
,
837 no_match_ip_next_hop_cmd
,
838 "no match ip next-hop",
842 "Match next-hop address of route\n")
845 return eigrp_route_match_delete(vty
, vty
->index
, "ip next-hop",
848 return eigrp_route_match_delete(vty
, vty
->index
, "ip next-hop",
852 ALIAS(no_match_ip_next_hop
, no_match_ip_next_hop_val_cmd
,
853 "no match ip next-hop ((1-199)|(1300-2699)|WORD)", NO_STR MATCH_STR IP_STR
854 "Match next-hop address of route\n"
855 "IP access-list number\n"
856 "IP access-list number (expanded range)\n"
857 "IP Access-list name\n")
859 DEFUN (match_ip_next_hop_prefix_list
,
860 match_ip_next_hop_prefix_list_cmd
,
861 "match ip next-hop prefix-list WORD",
864 "Match next-hop address of route\n"
865 "Match entries of prefix-lists\n"
866 "IP prefix-list name\n")
868 return eigrp_route_match_add(vty
, vty
->index
, "ip next-hop prefix-list",
872 DEFUN (no_match_ip_next_hop_prefix_list
,
873 no_match_ip_next_hop_prefix_list_cmd
,
874 "no match ip next-hop prefix-list",
878 "Match next-hop address of route\n"
879 "Match entries of prefix-lists\n")
882 return eigrp_route_match_delete(
883 vty
, vty
->index
, "ip next-hop prefix-list", NULL
);
885 return eigrp_route_match_delete(vty
, vty
->index
,
886 "ip next-hop prefix-list", argv
[0]);
889 ALIAS(no_match_ip_next_hop_prefix_list
,
890 no_match_ip_next_hop_prefix_list_val_cmd
,
891 "no match ip next-hop prefix-list WORD", NO_STR MATCH_STR IP_STR
892 "Match next-hop address of route\n"
893 "Match entries of prefix-lists\n"
894 "IP prefix-list name\n")
896 DEFUN (match_ip_address
,
897 match_ip_address_cmd
,
898 "match ip address ((1-199)|(1300-2699)|WORD)",
901 "Match address of route\n"
902 "IP access-list number\n"
903 "IP access-list number (expanded range)\n"
904 "IP Access-list name\n")
906 return eigrp_route_match_add(vty
, vty
->index
, "ip address", argv
[0]);
909 DEFUN (no_match_ip_address
,
910 no_match_ip_address_cmd
,
911 "no match ip address",
915 "Match address of route\n")
918 return eigrp_route_match_delete(vty
, vty
->index
, "ip address",
921 return eigrp_route_match_delete(vty
, vty
->index
, "ip address", argv
[0]);
924 ALIAS(no_match_ip_address
, no_match_ip_address_val_cmd
,
925 "no match ip address ((1-199)|(1300-2699)|WORD)", NO_STR MATCH_STR IP_STR
926 "Match address of route\n"
927 "IP access-list number\n"
928 "IP access-list number (expanded range)\n"
929 "IP Access-list name\n")
931 DEFUN (match_ip_address_prefix_list
,
932 match_ip_address_prefix_list_cmd
,
933 "match ip address prefix-list WORD",
936 "Match address of route\n"
937 "Match entries of prefix-lists\n"
938 "IP prefix-list name\n")
940 return eigrp_route_match_add(vty
, vty
->index
, "ip address prefix-list",
944 DEFUN (no_match_ip_address_prefix_list
,
945 no_match_ip_address_prefix_list_cmd
,
946 "no match ip address prefix-list",
950 "Match address of route\n"
951 "Match entries of prefix-lists\n")
954 return eigrp_route_match_delete(vty
, vty
->index
,
955 "ip address prefix-list", NULL
);
957 return eigrp_route_match_delete(vty
, vty
->index
,
958 "ip address prefix-list", argv
[0]);
961 ALIAS(no_match_ip_address_prefix_list
, no_match_ip_address_prefix_list_val_cmd
,
962 "no match ip address prefix-list WORD", NO_STR MATCH_STR IP_STR
963 "Match address of route\n"
964 "Match entries of prefix-lists\n"
965 "IP prefix-list name\n")
969 "match tag (0-65535)",
971 "Match tag of route\n"
974 return eigrp_route_match_add(vty
, vty
->index
, "tag", argv
[0]);
982 "Match tag of route\n")
985 return eigrp_route_match_delete(vty
, vty
->index
, "tag", NULL
);
987 return eigrp_route_match_delete(vty
, vty
->index
, "tag", argv
[0]);
990 ALIAS(no_match_tag
, no_match_tag_val_cmd
, "no match tag (0-65535)",
992 "Match tag of route\n"
999 "set metric (0-4294967295)",
1001 "Metric value for destination routing protocol\n"
1004 return eigrp_route_set_add(vty
, vty
->index
, "metric", argv
[0]);
1007 ALIAS(set_metric
, set_metric_addsub_cmd
, "set metric <+/-metric>", SET_STR
1008 "Metric value for destination routing protocol\n"
1009 "Add or subtract metric\n")
1011 DEFUN (no_set_metric
,
1016 "Metric value for destination routing protocol\n")
1019 return eigrp_route_set_delete(vty
, vty
->index
, "metric", NULL
);
1021 return eigrp_route_set_delete(vty
, vty
->index
, "metric", argv
[0]);
1024 ALIAS(no_set_metric
, no_set_metric_val_cmd
,
1025 "no set metric ((0-4294967295)|<+/-metric>)", NO_STR SET_STR
1026 "Metric value for destination routing protocol\n"
1028 "Add or subtract metric\n")
1030 DEFUN (set_ip_nexthop
,
1032 "set ip next-hop A.B.C.D",
1035 "Next hop address\n"
1036 "IP address of next hop\n")
1041 ret
= str2sockunion(argv
[0], &su
);
1043 vty_out(vty
, "%% Malformed next-hop address\n");
1044 return CMD_WARNING_CONFIG_FAILED
;
1047 return eigrp_route_set_add(vty
, vty
->index
, "ip next-hop", argv
[0]);
1050 DEFUN (no_set_ip_nexthop
,
1051 no_set_ip_nexthop_cmd
,
1052 "no set ip next-hop",
1056 "Next hop address\n")
1059 return eigrp_route_set_delete(vty
, vty
->index
, "ip next-hop",
1062 return eigrp_route_set_delete(vty
, vty
->index
, "ip next-hop", argv
[0]);
1065 ALIAS(no_set_ip_nexthop
, no_set_ip_nexthop_val_cmd
,
1066 "no set ip next-hop A.B.C.D", NO_STR SET_STR IP_STR
1067 "Next hop address\n"
1068 "IP address of next hop\n")
1072 "set tag (0-65535)",
1074 "Tag value for routing protocol\n"
1077 return eigrp_route_set_add(vty
, vty
->index
, "tag", argv
[0]);
1085 "Tag value for routing protocol\n")
1088 return eigrp_route_set_delete(vty
, vty
->index
, "tag", NULL
);
1090 return eigrp_route_set_delete(vty
, vty
->index
, "tag", argv
[0]);
1093 ALIAS(no_set_tag
, no_set_tag_val_cmd
, "no set tag (0-65535)", NO_STR SET_STR
1094 "Tag value for routing protocol\n"
1098 /* Route-map init */
1099 void eigrp_route_map_init()
1102 route_map_init_vty();
1103 route_map_add_hook(eigrp_route_map_update
);
1104 route_map_delete_hook(eigrp_route_map_update
);
1106 /*route_map_install_match (&route_match_metric_cmd);
1107 route_map_install_match (&route_match_interface_cmd);*/
1108 /*route_map_install_match (&route_match_ip_next_hop_cmd);
1109 route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd);
1110 route_map_install_match (&route_match_ip_address_cmd);
1111 route_map_install_match (&route_match_ip_address_prefix_list_cmd);*/
1112 /*route_map_install_match (&route_match_tag_cmd);*/
1114 /*route_map_install_set (&route_set_metric_cmd);
1115 route_map_install_set (&route_set_ip_nexthop_cmd);
1116 route_map_install_set (&route_set_tag_cmd);*/
1118 /*install_element (RMAP_NODE, &route_match_metric_cmd);
1119 install_element (RMAP_NODE, &no_match_metric_cmd);
1120 install_element (RMAP_NODE, &no_match_metric_val_cmd);
1121 install_element (RMAP_NODE, &route_match_interface_cmd);
1122 install_element (RMAP_NODE, &no_match_interface_cmd);
1123 install_element (RMAP_NODE, &no_match_interface_val_cmd);
1124 install_element (RMAP_NODE, &route_match_ip_next_hop_cmd);
1125 install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
1126 install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
1127 install_element (RMAP_NODE, &route_match_ip_next_hop_prefix_list_cmd);
1128 install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
1129 install_element (RMAP_NODE,
1130 &no_match_ip_next_hop_prefix_list_val_cmd);*/
1131 /*install_element (RMAP_NODE, &route_match_ip_address_cmd);
1132 install_element (RMAP_NODE, &no_match_ip_address_cmd);
1133 install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
1134 install_element (RMAP_NODE, &route_match_ip_address_prefix_list_cmd);
1135 install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
1136 install_element (RMAP_NODE,
1137 &no_match_ip_address_prefix_list_val_cmd);*/
1138 /*install_element (RMAP_NODE, &route_match_tag_cmd);
1139 install_element (RMAP_NODE, &no_match_tag_cmd);
1140 install_element (RMAP_NODE, &no_match_tag_val_cmd);*/
1142 /*install_element (RMAP_NODE, &set_metric_cmd);
1143 install_element (RMAP_NODE, &set_metric_addsub_cmd);
1144 install_element (RMAP_NODE, &no_set_metric_cmd);
1145 install_element (RMAP_NODE, &no_set_metric_val_cmd);
1146 install_element (RMAP_NODE, &set_ip_nexthop_cmd);
1147 install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
1148 install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
1149 install_element (RMAP_NODE, &set_tag_cmd);
1150 install_element (RMAP_NODE, &no_set_tag_cmd);
1151 install_element (RMAP_NODE, &no_set_tag_val_cmd);*/