1 /* Prefix list functions.
2 * Copyright (C) 1999 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published
8 * by the Free Software Foundation; either version 2, or (at your
9 * option) any later version.
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
28 #include "sockunion.h"
33 #include "plist_int.h"
35 /* List of struct prefix_list. */
36 struct prefix_list_list
38 struct prefix_list *head;
39 struct prefix_list *tail;
42 /* Master structure of prefix_list. */
45 /* List of prefix_list which name is number. */
46 struct prefix_list_list num;
48 /* List of prefix_list which name is string. */
49 struct prefix_list_list str;
51 /* Whether sequential number is used. */
54 /* The latest update. */
55 struct prefix_list *recent;
57 /* Hook function which is executed when new prefix_list is added. */
58 void (*add_hook) (struct prefix_list *);
60 /* Hook function which is executed when prefix_list is deleted. */
61 void (*delete_hook) (struct prefix_list *);
64 /* Static structure of IPv4 prefix_list's master. */
65 static struct prefix_master prefix_master_ipv4 =
75 /* Static structure of IPv6 prefix-list's master. */
76 static struct prefix_master prefix_master_ipv6 =
86 /* Static structure of BGP ORF prefix_list's master. */
87 static struct prefix_master prefix_master_orf_v4 =
96 /* Static structure of BGP ORF prefix_list's master. */
97 static struct prefix_master prefix_master_orf_v6 =
106 static struct prefix_master *
107 prefix_master_get (afi_t afi, int orf)
110 return orf ? &prefix_master_orf_v4 : &prefix_master_ipv4;
112 return orf ? &prefix_master_orf_v6 : &prefix_master_ipv6;
116 const char *prefix_list_name (struct prefix_list *plist)
121 /* Lookup prefix_list from list of prefix_list by name. */
122 static struct prefix_list *
123 prefix_list_lookup_do (afi_t afi, int orf, const char *name)
125 struct prefix_list *plist;
126 struct prefix_master *master;
131 master = prefix_master_get (afi, orf);
135 for (plist = master->num.head; plist; plist = plist->next)
136 if (strcmp (plist->name, name) == 0)
139 for (plist = master->str.head; plist; plist = plist->next)
140 if (strcmp (plist->name, name) == 0)
147 prefix_list_lookup (afi_t afi, const char *name)
149 return prefix_list_lookup_do (afi, 0, name);
153 prefix_bgp_orf_lookup (afi_t afi, const char *name)
155 return prefix_list_lookup_do (afi, 1, name);
158 static struct prefix_list *
159 prefix_list_new (void)
161 struct prefix_list *new;
163 new = XCALLOC (MTYPE_PREFIX_LIST, sizeof (struct prefix_list));
168 prefix_list_free (struct prefix_list *plist)
170 XFREE (MTYPE_PREFIX_LIST, plist);
173 static struct prefix_list_entry *
174 prefix_list_entry_new (void)
176 struct prefix_list_entry *new;
178 new = XCALLOC (MTYPE_PREFIX_LIST_ENTRY, sizeof (struct prefix_list_entry));
183 prefix_list_entry_free (struct prefix_list_entry *pentry)
185 XFREE (MTYPE_PREFIX_LIST_ENTRY, pentry);
188 /* Insert new prefix list to list of prefix_list. Each prefix_list
189 is sorted by the name. */
190 static struct prefix_list *
191 prefix_list_insert (afi_t afi, int orf, const char *name)
195 struct prefix_list *plist;
196 struct prefix_list *point;
197 struct prefix_list_list *list;
198 struct prefix_master *master;
200 master = prefix_master_get (afi, orf);
204 /* Allocate new prefix_list and copy given name. */
205 plist = prefix_list_new ();
206 plist->name = XSTRDUP (MTYPE_PREFIX_LIST_STR, name);
207 plist->master = master;
209 /* If name is made by all digit character. We treat it as
211 for (number = 0, i = 0; i < strlen (name); i++)
213 if (isdigit ((int) name[i]))
214 number = (number * 10) + (name[i] - '0');
219 /* In case of name is all digit character */
220 if (i == strlen (name))
222 plist->type = PREFIX_TYPE_NUMBER;
224 /* Set prefix_list to number list. */
227 for (point = list->head; point; point = point->next)
228 if (atol (point->name) >= number)
233 plist->type = PREFIX_TYPE_STRING;
235 /* Set prefix_list to string list. */
238 /* Set point to insertion point. */
239 for (point = list->head; point; point = point->next)
240 if (strcmp (point->name, name) >= 0)
244 /* In case of this is the first element of master. */
245 if (list->head == NULL)
247 list->head = list->tail = plist;
251 /* In case of insertion is made at the tail of access_list. */
254 plist->prev = list->tail;
255 list->tail->next = plist;
260 /* In case of insertion is made at the head of access_list. */
261 if (point == list->head)
263 plist->next = list->head;
264 list->head->prev = plist;
269 /* Insertion is made at middle of the access_list. */
271 plist->prev = point->prev;
274 point->prev->next = plist;
280 static struct prefix_list *
281 prefix_list_get (afi_t afi, int orf, const char *name)
283 struct prefix_list *plist;
285 plist = prefix_list_lookup_do (afi, orf, name);
288 plist = prefix_list_insert (afi, orf, name);
292 /* Delete prefix-list from prefix_list_master and free it. */
294 prefix_list_delete (struct prefix_list *plist)
296 struct prefix_list_list *list;
297 struct prefix_master *master;
298 struct prefix_list_entry *pentry;
299 struct prefix_list_entry *next;
301 /* If prefix-list contain prefix_list_entry free all of it. */
302 for (pentry = plist->head; pentry; pentry = next)
305 prefix_list_entry_free (pentry);
309 master = plist->master;
311 if (plist->type == PREFIX_TYPE_NUMBER)
317 plist->next->prev = plist->prev;
319 list->tail = plist->prev;
322 plist->prev->next = plist->next;
324 list->head = plist->next;
327 XFREE (MTYPE_TMP, plist->desc);
329 /* Make sure master's recent changed prefix-list information is
331 master->recent = NULL;
334 XFREE (MTYPE_PREFIX_LIST_STR, plist->name);
336 prefix_list_free (plist);
338 if (master->delete_hook)
339 (*master->delete_hook) (NULL);
342 static struct prefix_list_entry *
343 prefix_list_entry_make (struct prefix *prefix, enum prefix_list_type type,
344 int seq, int le, int ge, int any)
346 struct prefix_list_entry *pentry;
348 pentry = prefix_list_entry_new ();
353 prefix_copy (&pentry->prefix, prefix);
362 /* Add hook function. */
364 prefix_list_add_hook (void (*func) (struct prefix_list *plist))
366 prefix_master_ipv4.add_hook = func;
368 prefix_master_ipv6.add_hook = func;
369 #endif /* HAVE_IPV6 */
372 /* Delete hook function. */
374 prefix_list_delete_hook (void (*func) (struct prefix_list *plist))
376 prefix_master_ipv4.delete_hook = func;
378 prefix_master_ipv6.delete_hook = func;
379 #endif /* HAVE_IPVt6 */
382 /* Calculate new sequential number. */
384 prefix_new_seq_get (struct prefix_list *plist)
388 struct prefix_list_entry *pentry;
392 for (pentry = plist->head; pentry; pentry = pentry->next)
394 if (maxseq < pentry->seq)
395 maxseq = pentry->seq;
398 newseq = ((maxseq / 5) * 5) + 5;
403 /* Return prefix list entry which has same seq number. */
404 static struct prefix_list_entry *
405 prefix_seq_check (struct prefix_list *plist, int seq)
407 struct prefix_list_entry *pentry;
409 for (pentry = plist->head; pentry; pentry = pentry->next)
410 if (pentry->seq == seq)
415 static struct prefix_list_entry *
416 prefix_list_entry_lookup (struct prefix_list *plist, struct prefix *prefix,
417 enum prefix_list_type type, int seq, int le, int ge)
419 struct prefix_list_entry *pentry;
421 for (pentry = plist->head; pentry; pentry = pentry->next)
422 if (prefix_same (&pentry->prefix, prefix) && pentry->type == type)
424 if (seq >= 0 && pentry->seq != seq)
427 if (pentry->le != le)
429 if (pentry->ge != ge)
439 prefix_list_entry_delete (struct prefix_list *plist,
440 struct prefix_list_entry *pentry,
443 if (plist == NULL || pentry == NULL)
446 pentry->prev->next = pentry->next;
448 plist->head = pentry->next;
450 pentry->next->prev = pentry->prev;
452 plist->tail = pentry->prev;
454 prefix_list_entry_free (pentry);
460 if (plist->master->delete_hook)
461 (*plist->master->delete_hook) (plist);
463 if (plist->head == NULL && plist->tail == NULL && plist->desc == NULL)
464 prefix_list_delete (plist);
466 plist->master->recent = plist;
471 prefix_list_entry_add (struct prefix_list *plist,
472 struct prefix_list_entry *pentry)
474 struct prefix_list_entry *replace;
475 struct prefix_list_entry *point;
477 /* Automatic asignment of seq no. */
478 if (pentry->seq == -1)
479 pentry->seq = prefix_new_seq_get (plist);
481 /* Is there any same seq prefix list entry? */
482 replace = prefix_seq_check (plist, pentry->seq);
484 prefix_list_entry_delete (plist, replace, 0);
486 /* Check insert point. */
487 for (point = plist->head; point; point = point->next)
488 if (point->seq >= pentry->seq)
491 /* In case of this is the first element of the list. */
492 pentry->next = point;
497 point->prev->next = pentry;
499 plist->head = pentry;
501 pentry->prev = point->prev;
502 point->prev = pentry;
507 plist->tail->next = pentry;
509 plist->head = pentry;
511 pentry->prev = plist->tail;
512 plist->tail = pentry;
515 /* Increment count. */
518 /* Run hook function. */
519 if (plist->master->add_hook)
520 (*plist->master->add_hook) (plist);
522 plist->master->recent = plist;
525 /* Return string of prefix_list_type. */
527 prefix_list_type_str (struct prefix_list_entry *pentry)
529 switch (pentry->type)
541 prefix_list_entry_match (struct prefix_list_entry *pentry, struct prefix *p)
545 ret = prefix_match (&pentry->prefix, p);
549 /* In case of le nor ge is specified, exact match is performed. */
550 if (! pentry->le && ! pentry->ge)
552 if (pentry->prefix.prefixlen != p->prefixlen)
558 if (p->prefixlen > pentry->le)
562 if (p->prefixlen < pentry->ge)
568 enum prefix_list_type
569 prefix_list_apply (struct prefix_list *plist, void *object)
571 struct prefix_list_entry *pentry;
574 p = (struct prefix *) object;
579 if (plist->count == 0)
580 return PREFIX_PERMIT;
582 for (pentry = plist->head; pentry; pentry = pentry->next)
585 if (prefix_list_entry_match (pentry, p))
595 static void __attribute__ ((unused))
596 prefix_list_print (struct prefix_list *plist)
598 struct prefix_list_entry *pentry;
603 printf ("ip prefix-list %s: %d entries\n", plist->name, plist->count);
605 for (pentry = plist->head; pentry; pentry = pentry->next)
608 printf ("any %s\n", prefix_list_type_str (pentry));
616 printf (" seq %d %s %s/%d",
618 prefix_list_type_str (pentry),
619 inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
622 printf (" ge %d", pentry->ge);
624 printf (" le %d", pentry->le);
630 /* Retrun 1 when plist already include pentry policy. */
631 static struct prefix_list_entry *
632 prefix_entry_dup_check (struct prefix_list *plist,
633 struct prefix_list_entry *new)
635 struct prefix_list_entry *pentry;
639 seq = prefix_new_seq_get (plist);
643 for (pentry = plist->head; pentry; pentry = pentry->next)
645 if (prefix_same (&pentry->prefix, &new->prefix)
646 && pentry->type == new->type
647 && pentry->le == new->le
648 && pentry->ge == new->ge
649 && pentry->seq != seq)
656 vty_invalid_prefix_range (struct vty *vty, const char *prefix)
658 vty_out (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value%s",
659 prefix, VTY_NEWLINE);
664 vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name,
665 const char *seq, const char *typestr,
666 const char *prefix, const char *ge, const char *le)
669 enum prefix_list_type type;
670 struct prefix_list *plist;
671 struct prefix_list_entry *pentry;
672 struct prefix_list_entry *dup;
679 /* This code only works for IP. Provide a safe-guard and user-visible
682 if (!(afi == AFI_IP || afi == AFI_IP6))
684 vty_out (vty, "%% prefix must be IPv4 or IPv6!%s", VTY_NEWLINE);
688 /* Sequential number. */
692 /* ge and le number */
698 /* Check filter type. */
699 if (strncmp ("permit", typestr, 1) == 0)
700 type = PREFIX_PERMIT;
701 else if (strncmp ("deny", typestr, 1) == 0)
705 vty_out (vty, "%% prefix type must be permit or deny%s", VTY_NEWLINE);
709 /* "any" is special token for matching any IPv4 addresses. */
713 if (strncmp ("any", prefix, strlen (prefix)) == 0)
715 ret = str2prefix_ipv4 ("0.0.0.0/0", (struct prefix_ipv4 *) &p);
717 lenum = IPV4_MAX_BITLEN;
721 ret = str2prefix_ipv4 (prefix, (struct prefix_ipv4 *) &p);
725 vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE);
730 if (strncmp ("any", prefix, strlen (prefix)) == 0)
732 ret = str2prefix_ipv6 ("::/0", (struct prefix_ipv6 *) &p);
734 lenum = IPV6_MAX_BITLEN;
738 ret = str2prefix_ipv6 (prefix, (struct prefix_ipv6 *) &p);
742 vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE);
748 vty_out (vty, "%% Unrecognized AFI (%d)%s", afi, VTY_NEWLINE);
753 /* ge and le check. */
754 if (genum && (genum <= p.prefixlen))
755 return vty_invalid_prefix_range (vty, prefix);
757 if (lenum && (lenum <= p.prefixlen))
758 return vty_invalid_prefix_range (vty, prefix);
760 if (lenum && (genum > lenum))
761 return vty_invalid_prefix_range (vty, prefix);
763 if (genum && (lenum == (afi == AFI_IP ? 32 : 128)))
766 /* Get prefix_list with name. */
767 plist = prefix_list_get (afi, 0, name);
769 /* Make prefix entry. */
770 pentry = prefix_list_entry_make (&p, type, seqnum, lenum, genum, any);
772 /* Check same policy. */
773 dup = prefix_entry_dup_check (plist, pentry);
777 prefix_list_entry_free (pentry);
778 vty_out (vty, "%% Insertion failed - prefix-list entry exists:%s",
780 vty_out (vty, " seq %d %s %s", dup->seq, typestr, prefix);
782 vty_out (vty, " ge %d", genum);
784 vty_out (vty, " le %d", lenum);
785 vty_out (vty, "%s", VTY_NEWLINE);
789 /* Install new filter to the access_list. */
790 prefix_list_entry_add (plist, pentry);
796 vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name,
797 const char *seq, const char *typestr,
798 const char *prefix, const char *ge, const char *le)
801 enum prefix_list_type type;
802 struct prefix_list *plist;
803 struct prefix_list_entry *pentry;
809 /* Check prefix list name. */
810 plist = prefix_list_lookup (afi, name);
813 vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
817 /* Only prefix-list name specified, delete the entire prefix-list. */
818 if (seq == NULL && typestr == NULL && prefix == NULL &&
819 ge == NULL && le == NULL)
821 prefix_list_delete (plist);
825 /* We must have, at a minimum, both the type and prefix here */
826 if ((typestr == NULL) || (prefix == NULL))
828 vty_out (vty, "%% Both prefix and type required%s", VTY_NEWLINE);
832 /* Check sequence number. */
836 /* ge and le number */
842 /* Check of filter type. */
843 if (strncmp ("permit", typestr, 1) == 0)
844 type = PREFIX_PERMIT;
845 else if (strncmp ("deny", typestr, 1) == 0)
849 vty_out (vty, "%% prefix type must be permit or deny%s", VTY_NEWLINE);
853 /* "any" is special token for matching any IPv4 addresses. */
856 if (strncmp ("any", prefix, strlen (prefix)) == 0)
858 ret = str2prefix_ipv4 ("0.0.0.0/0", (struct prefix_ipv4 *) &p);
860 lenum = IPV4_MAX_BITLEN;
863 ret = str2prefix_ipv4 (prefix, (struct prefix_ipv4 *) &p);
867 vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE);
872 else if (afi == AFI_IP6)
874 if (strncmp ("any", prefix, strlen (prefix)) == 0)
876 ret = str2prefix_ipv6 ("::/0", (struct prefix_ipv6 *) &p);
878 lenum = IPV6_MAX_BITLEN;
881 ret = str2prefix_ipv6 (prefix, (struct prefix_ipv6 *) &p);
885 vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE);
889 #endif /* HAVE_IPV6 */
891 /* Lookup prefix entry. */
892 pentry = prefix_list_entry_lookup(plist, &p, type, seqnum, lenum, genum);
896 vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
900 /* Install new filter to the access_list. */
901 prefix_list_entry_delete (plist, pentry, 1);
907 vty_prefix_list_desc_unset (struct vty *vty, afi_t afi, const char *name)
909 struct prefix_list *plist;
911 plist = prefix_list_lookup (afi, name);
914 vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
920 XFREE (MTYPE_TMP, plist->desc);
924 if (plist->head == NULL && plist->tail == NULL && plist->desc == NULL)
925 prefix_list_delete (plist);
941 vty_show_prefix_entry (struct vty *vty, afi_t afi, struct prefix_list *plist,
942 struct prefix_master *master, enum display_type dtype,
945 struct prefix_list_entry *pentry;
947 /* Print the name of the protocol */
949 vty_out (vty, "%s: ", zlog_proto_names[zlog_default->protocol]);
951 if (dtype == normal_display)
953 vty_out (vty, "ip%s prefix-list %s: %d entries%s",
954 afi == AFI_IP ? "" : "v6",
955 plist->name, plist->count, VTY_NEWLINE);
957 vty_out (vty, " Description: %s%s", plist->desc, VTY_NEWLINE);
959 else if (dtype == summary_display || dtype == detail_display)
961 vty_out (vty, "ip%s prefix-list %s:%s",
962 afi == AFI_IP ? "" : "v6", plist->name, VTY_NEWLINE);
965 vty_out (vty, " Description: %s%s", plist->desc, VTY_NEWLINE);
967 vty_out (vty, " count: %d, range entries: %d, sequences: %d - %d%s",
968 plist->count, plist->rangecount,
969 plist->head ? plist->head->seq : 0,
970 plist->tail ? plist->tail->seq : 0,
974 if (dtype != summary_display)
976 for (pentry = plist->head; pentry; pentry = pentry->next)
978 if (dtype == sequential_display && pentry->seq != seqnum)
984 vty_out (vty, "seq %d ", pentry->seq);
986 vty_out (vty, "%s ", prefix_list_type_str (pentry));
989 vty_out (vty, "any");
992 struct prefix *p = &pentry->prefix;
995 vty_out (vty, "%s/%d",
996 inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
1000 vty_out (vty, " ge %d", pentry->ge);
1002 vty_out (vty, " le %d", pentry->le);
1005 if (dtype == detail_display || dtype == sequential_display)
1006 vty_out (vty, " (hit count: %ld, refcount: %ld)",
1007 pentry->hitcnt, pentry->refcnt);
1009 vty_out (vty, "%s", VTY_NEWLINE);
1015 vty_show_prefix_list (struct vty *vty, afi_t afi, const char *name,
1016 const char *seq, enum display_type dtype)
1018 struct prefix_list *plist;
1019 struct prefix_master *master;
1022 master = prefix_master_get (afi, 0);
1027 seqnum = atoi (seq);
1031 plist = prefix_list_lookup (afi, name);
1034 vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
1037 vty_show_prefix_entry (vty, afi, plist, master, dtype, seqnum);
1041 if (dtype == detail_display || dtype == summary_display)
1044 vty_out (vty, "Prefix-list with the last deletion/insertion: %s%s",
1045 master->recent->name, VTY_NEWLINE);
1048 for (plist = master->num.head; plist; plist = plist->next)
1049 vty_show_prefix_entry (vty, afi, plist, master, dtype, seqnum);
1051 for (plist = master->str.head; plist; plist = plist->next)
1052 vty_show_prefix_entry (vty, afi, plist, master, dtype, seqnum);
1059 vty_show_prefix_list_prefix (struct vty *vty, afi_t afi, const char *name,
1060 const char *prefix, enum display_type type)
1062 struct prefix_list *plist;
1063 struct prefix_list_entry *pentry;
1068 plist = prefix_list_lookup (afi, name);
1071 vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
1075 ret = str2prefix (prefix, &p);
1078 vty_out (vty, "%% prefix is malformed%s", VTY_NEWLINE);
1082 for (pentry = plist->head; pentry; pentry = pentry->next)
1086 if (type == normal_display || type == first_match_display)
1087 if (prefix_same (&p, &pentry->prefix))
1090 if (type == longer_display)
1091 if (prefix_match (&p, &pentry->prefix))
1096 vty_out (vty, " seq %d %s ",
1098 prefix_list_type_str (pentry));
1101 vty_out (vty, "any");
1104 struct prefix *p = &pentry->prefix;
1107 vty_out (vty, "%s/%d",
1108 inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
1112 vty_out (vty, " ge %d", pentry->ge);
1114 vty_out (vty, " le %d", pentry->le);
1117 if (type == normal_display || type == first_match_display)
1118 vty_out (vty, " (hit count: %ld, refcount: %ld)",
1119 pentry->hitcnt, pentry->refcnt);
1121 vty_out (vty, "%s", VTY_NEWLINE);
1123 if (type == first_match_display)
1131 vty_clear_prefix_list (struct vty *vty, afi_t afi, const char *name,
1134 struct prefix_master *master;
1135 struct prefix_list *plist;
1136 struct prefix_list_entry *pentry;
1140 master = prefix_master_get (afi, 0);
1144 if (name == NULL && prefix == NULL)
1146 for (plist = master->num.head; plist; plist = plist->next)
1147 for (pentry = plist->head; pentry; pentry = pentry->next)
1150 for (plist = master->str.head; plist; plist = plist->next)
1151 for (pentry = plist->head; pentry; pentry = pentry->next)
1156 plist = prefix_list_lookup (afi, name);
1159 vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
1165 ret = str2prefix (prefix, &p);
1168 vty_out (vty, "%% prefix is malformed%s", VTY_NEWLINE);
1173 for (pentry = plist->head; pentry; pentry = pentry->next)
1177 if (prefix_match (&pentry->prefix, &p))
1187 DEFUN (ip_prefix_list,
1189 "ip prefix-list WORD (deny|permit) (A.B.C.D/M|any)",
1192 "Name of a prefix list\n"
1193 "Specify packets to reject\n"
1194 "Specify packets to forward\n"
1195 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1196 "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
1198 return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL,
1199 argv[1], argv[2], NULL, NULL);
1202 DEFUN (ip_prefix_list_ge,
1203 ip_prefix_list_ge_cmd,
1204 "ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32>",
1207 "Name of a prefix list\n"
1208 "Specify packets to reject\n"
1209 "Specify packets to forward\n"
1210 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1211 "Minimum prefix length to be matched\n"
1212 "Minimum prefix length\n")
1214 return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1],
1215 argv[2], argv[3], NULL);
1218 DEFUN (ip_prefix_list_ge_le,
1219 ip_prefix_list_ge_le_cmd,
1220 "ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32> le <0-32>",
1223 "Name of a prefix list\n"
1224 "Specify packets to reject\n"
1225 "Specify packets to forward\n"
1226 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1227 "Minimum prefix length to be matched\n"
1228 "Minimum prefix length\n"
1229 "Maximum prefix length to be matched\n"
1230 "Maximum prefix length\n")
1232 return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1],
1233 argv[2], argv[3], argv[4]);
1236 DEFUN (ip_prefix_list_le,
1237 ip_prefix_list_le_cmd,
1238 "ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32>",
1241 "Name of a prefix list\n"
1242 "Specify packets to reject\n"
1243 "Specify packets to forward\n"
1244 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1245 "Maximum prefix length to be matched\n"
1246 "Maximum prefix length\n")
1248 return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1],
1249 argv[2], NULL, argv[3]);
1252 DEFUN (ip_prefix_list_le_ge,
1253 ip_prefix_list_le_ge_cmd,
1254 "ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32> ge <0-32>",
1257 "Name of a prefix list\n"
1258 "Specify packets to reject\n"
1259 "Specify packets to forward\n"
1260 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1261 "Maximum prefix length to be matched\n"
1262 "Maximum prefix length\n"
1263 "Minimum prefix length to be matched\n"
1264 "Minimum prefix length\n")
1266 return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1],
1267 argv[2], argv[4], argv[3]);
1270 DEFUN (ip_prefix_list_seq,
1271 ip_prefix_list_seq_cmd,
1272 "ip prefix-list WORD seq <1-4294967295> (deny|permit) (A.B.C.D/M|any)",
1275 "Name of a prefix list\n"
1276 "sequence number of an entry\n"
1278 "Specify packets to reject\n"
1279 "Specify packets to forward\n"
1280 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1281 "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
1283 return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1284 argv[3], NULL, NULL);
1287 DEFUN (ip_prefix_list_seq_ge,
1288 ip_prefix_list_seq_ge_cmd,
1289 "ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32>",
1292 "Name of a prefix list\n"
1293 "sequence number of an entry\n"
1295 "Specify packets to reject\n"
1296 "Specify packets to forward\n"
1297 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1298 "Minimum prefix length to be matched\n"
1299 "Minimum prefix length\n")
1301 return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1302 argv[3], argv[4], NULL);
1305 DEFUN (ip_prefix_list_seq_ge_le,
1306 ip_prefix_list_seq_ge_le_cmd,
1307 "ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32> le <0-32>",
1310 "Name of a prefix list\n"
1311 "sequence number of an entry\n"
1313 "Specify packets to reject\n"
1314 "Specify packets to forward\n"
1315 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1316 "Minimum prefix length to be matched\n"
1317 "Minimum prefix length\n"
1318 "Maximum prefix length to be matched\n"
1319 "Maximum prefix length\n")
1321 return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1322 argv[3], argv[4], argv[5]);
1325 DEFUN (ip_prefix_list_seq_le,
1326 ip_prefix_list_seq_le_cmd,
1327 "ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32>",
1330 "Name of a prefix list\n"
1331 "sequence number of an entry\n"
1333 "Specify packets to reject\n"
1334 "Specify packets to forward\n"
1335 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1336 "Maximum prefix length to be matched\n"
1337 "Maximum prefix length\n")
1339 return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1340 argv[3], NULL, argv[4]);
1343 DEFUN (ip_prefix_list_seq_le_ge,
1344 ip_prefix_list_seq_le_ge_cmd,
1345 "ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32> ge <0-32>",
1348 "Name of a prefix list\n"
1349 "sequence number of an entry\n"
1351 "Specify packets to reject\n"
1352 "Specify packets to forward\n"
1353 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1354 "Maximum prefix length to be matched\n"
1355 "Maximum prefix length\n"
1356 "Minimum prefix length to be matched\n"
1357 "Minimum prefix length\n")
1359 return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1360 argv[3], argv[5], argv[4]);
1363 DEFUN (no_ip_prefix_list,
1364 no_ip_prefix_list_cmd,
1365 "no ip prefix-list WORD",
1369 "Name of a prefix list\n")
1371 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, NULL,
1375 DEFUN (no_ip_prefix_list_prefix,
1376 no_ip_prefix_list_prefix_cmd,
1377 "no ip prefix-list WORD (deny|permit) (A.B.C.D/M|any)",
1381 "Name of a prefix list\n"
1382 "Specify packets to reject\n"
1383 "Specify packets to forward\n"
1384 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1385 "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
1387 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1388 argv[2], NULL, NULL);
1391 DEFUN (no_ip_prefix_list_ge,
1392 no_ip_prefix_list_ge_cmd,
1393 "no ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32>",
1397 "Name of a prefix list\n"
1398 "Specify packets to reject\n"
1399 "Specify packets to forward\n"
1400 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1401 "Minimum prefix length to be matched\n"
1402 "Minimum prefix length\n")
1404 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1405 argv[2], argv[3], NULL);
1408 DEFUN (no_ip_prefix_list_ge_le,
1409 no_ip_prefix_list_ge_le_cmd,
1410 "no ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32> le <0-32>",
1414 "Name of a prefix list\n"
1415 "Specify packets to reject\n"
1416 "Specify packets to forward\n"
1417 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1418 "Minimum prefix length to be matched\n"
1419 "Minimum prefix length\n"
1420 "Maximum prefix length to be matched\n"
1421 "Maximum prefix length\n")
1423 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1424 argv[2], argv[3], argv[4]);
1427 DEFUN (no_ip_prefix_list_le,
1428 no_ip_prefix_list_le_cmd,
1429 "no ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32>",
1433 "Name of a prefix list\n"
1434 "Specify packets to reject\n"
1435 "Specify packets to forward\n"
1436 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1437 "Maximum prefix length to be matched\n"
1438 "Maximum prefix length\n")
1440 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1441 argv[2], NULL, argv[3]);
1444 DEFUN (no_ip_prefix_list_le_ge,
1445 no_ip_prefix_list_le_ge_cmd,
1446 "no ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32> ge <0-32>",
1450 "Name of a prefix list\n"
1451 "Specify packets to reject\n"
1452 "Specify packets to forward\n"
1453 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1454 "Maximum prefix length to be matched\n"
1455 "Maximum prefix length\n"
1456 "Minimum prefix length to be matched\n"
1457 "Minimum prefix length\n")
1459 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1460 argv[2], argv[4], argv[3]);
1463 DEFUN (no_ip_prefix_list_seq,
1464 no_ip_prefix_list_seq_cmd,
1465 "no ip prefix-list WORD seq <1-4294967295> (deny|permit) (A.B.C.D/M|any)",
1469 "Name of a prefix list\n"
1470 "sequence number of an entry\n"
1472 "Specify packets to reject\n"
1473 "Specify packets to forward\n"
1474 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1475 "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
1477 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1478 argv[3], NULL, NULL);
1481 DEFUN (no_ip_prefix_list_seq_ge,
1482 no_ip_prefix_list_seq_ge_cmd,
1483 "no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32>",
1487 "Name of a prefix list\n"
1488 "sequence number of an entry\n"
1490 "Specify packets to reject\n"
1491 "Specify packets to forward\n"
1492 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1493 "Minimum prefix length to be matched\n"
1494 "Minimum prefix length\n")
1496 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1497 argv[3], argv[4], NULL);
1500 DEFUN (no_ip_prefix_list_seq_ge_le,
1501 no_ip_prefix_list_seq_ge_le_cmd,
1502 "no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32> le <0-32>",
1506 "Name of a prefix list\n"
1507 "sequence number of an entry\n"
1509 "Specify packets to reject\n"
1510 "Specify packets to forward\n"
1511 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1512 "Minimum prefix length to be matched\n"
1513 "Minimum prefix length\n"
1514 "Maximum prefix length to be matched\n"
1515 "Maximum prefix length\n")
1517 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1518 argv[3], argv[4], argv[5]);
1521 DEFUN (no_ip_prefix_list_seq_le,
1522 no_ip_prefix_list_seq_le_cmd,
1523 "no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32>",
1527 "Name of a prefix list\n"
1528 "sequence number of an entry\n"
1530 "Specify packets to reject\n"
1531 "Specify packets to forward\n"
1532 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1533 "Maximum prefix length to be matched\n"
1534 "Maximum prefix length\n")
1536 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1537 argv[3], NULL, argv[4]);
1540 DEFUN (no_ip_prefix_list_seq_le_ge,
1541 no_ip_prefix_list_seq_le_ge_cmd,
1542 "no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32> ge <0-32>",
1546 "Name of a prefix list\n"
1547 "sequence number of an entry\n"
1549 "Specify packets to reject\n"
1550 "Specify packets to forward\n"
1551 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1552 "Maximum prefix length to be matched\n"
1553 "Maximum prefix length\n"
1554 "Minimum prefix length to be matched\n"
1555 "Minimum prefix length\n")
1557 return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1558 argv[3], argv[5], argv[4]);
1561 DEFUN (ip_prefix_list_sequence_number,
1562 ip_prefix_list_sequence_number_cmd,
1563 "ip prefix-list sequence-number",
1566 "Include/exclude sequence numbers in NVGEN\n")
1568 prefix_master_ipv4.seqnum = 1;
1572 DEFUN (no_ip_prefix_list_sequence_number,
1573 no_ip_prefix_list_sequence_number_cmd,
1574 "no ip prefix-list sequence-number",
1578 "Include/exclude sequence numbers in NVGEN\n")
1580 prefix_master_ipv4.seqnum = 0;
1584 DEFUN (ip_prefix_list_description,
1585 ip_prefix_list_description_cmd,
1586 "ip prefix-list WORD description .LINE",
1589 "Name of a prefix list\n"
1590 "Prefix-list specific description\n"
1591 "Up to 80 characters describing this prefix-list\n")
1593 struct prefix_list *plist;
1595 plist = prefix_list_get (AFI_IP, 0, argv[0]);
1599 XFREE (MTYPE_TMP, plist->desc);
1602 plist->desc = argv_concat(argv, argc, 1);
1607 DEFUN (no_ip_prefix_list_description,
1608 no_ip_prefix_list_description_cmd,
1609 "no ip prefix-list WORD description",
1613 "Name of a prefix list\n"
1614 "Prefix-list specific description\n")
1616 return vty_prefix_list_desc_unset (vty, AFI_IP, argv[0]);
1619 ALIAS (no_ip_prefix_list_description,
1620 no_ip_prefix_list_description_arg_cmd,
1621 "no ip prefix-list WORD description .LINE",
1625 "Name of a prefix list\n"
1626 "Prefix-list specific description\n"
1627 "Up to 80 characters describing this prefix-list\n")
1629 DEFUN (show_ip_prefix_list,
1630 show_ip_prefix_list_cmd,
1631 "show ip prefix-list",
1636 return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, normal_display);
1639 DEFUN (show_ip_prefix_list_name,
1640 show_ip_prefix_list_name_cmd,
1641 "show ip prefix-list WORD",
1645 "Name of a prefix list\n")
1647 return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, normal_display);
1650 DEFUN (show_ip_prefix_list_name_seq,
1651 show_ip_prefix_list_name_seq_cmd,
1652 "show ip prefix-list WORD seq <1-4294967295>",
1656 "Name of a prefix list\n"
1657 "sequence number of an entry\n"
1658 "Sequence number\n")
1660 return vty_show_prefix_list (vty, AFI_IP, argv[0], argv[1], sequential_display);
1663 DEFUN (show_ip_prefix_list_prefix,
1664 show_ip_prefix_list_prefix_cmd,
1665 "show ip prefix-list WORD A.B.C.D/M",
1669 "Name of a prefix list\n"
1670 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
1672 return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], normal_display);
1675 DEFUN (show_ip_prefix_list_prefix_longer,
1676 show_ip_prefix_list_prefix_longer_cmd,
1677 "show ip prefix-list WORD A.B.C.D/M longer",
1681 "Name of a prefix list\n"
1682 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1683 "Lookup longer prefix\n")
1685 return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], longer_display);
1688 DEFUN (show_ip_prefix_list_prefix_first_match,
1689 show_ip_prefix_list_prefix_first_match_cmd,
1690 "show ip prefix-list WORD A.B.C.D/M first-match",
1694 "Name of a prefix list\n"
1695 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1696 "First matched prefix\n")
1698 return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], first_match_display);
1701 DEFUN (show_ip_prefix_list_summary,
1702 show_ip_prefix_list_summary_cmd,
1703 "show ip prefix-list summary",
1707 "Summary of prefix lists\n")
1709 return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, summary_display);
1712 DEFUN (show_ip_prefix_list_summary_name,
1713 show_ip_prefix_list_summary_name_cmd,
1714 "show ip prefix-list summary WORD",
1718 "Summary of prefix lists\n"
1719 "Name of a prefix list\n")
1721 return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, summary_display);
1725 DEFUN (show_ip_prefix_list_detail,
1726 show_ip_prefix_list_detail_cmd,
1727 "show ip prefix-list detail",
1731 "Detail of prefix lists\n")
1733 return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, detail_display);
1736 DEFUN (show_ip_prefix_list_detail_name,
1737 show_ip_prefix_list_detail_name_cmd,
1738 "show ip prefix-list detail WORD",
1742 "Detail of prefix lists\n"
1743 "Name of a prefix list\n")
1745 return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, detail_display);
1748 DEFUN (clear_ip_prefix_list,
1749 clear_ip_prefix_list_cmd,
1750 "clear ip prefix-list",
1755 return vty_clear_prefix_list (vty, AFI_IP, NULL, NULL);
1758 DEFUN (clear_ip_prefix_list_name,
1759 clear_ip_prefix_list_name_cmd,
1760 "clear ip prefix-list WORD",
1764 "Name of a prefix list\n")
1766 return vty_clear_prefix_list (vty, AFI_IP, argv[0], NULL);
1769 DEFUN (clear_ip_prefix_list_name_prefix,
1770 clear_ip_prefix_list_name_prefix_cmd,
1771 "clear ip prefix-list WORD A.B.C.D/M",
1775 "Name of a prefix list\n"
1776 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
1778 return vty_clear_prefix_list (vty, AFI_IP, argv[0], argv[1]);
1782 DEFUN (ipv6_prefix_list,
1783 ipv6_prefix_list_cmd,
1784 "ipv6 prefix-list WORD (deny|permit) (X:X::X:X/M|any)",
1787 "Name of a prefix list\n"
1788 "Specify packets to reject\n"
1789 "Specify packets to forward\n"
1790 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1791 "Any prefix match. Same as \"::0/0 le 128\"\n")
1793 return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL,
1794 argv[1], argv[2], NULL, NULL);
1797 DEFUN (ipv6_prefix_list_ge,
1798 ipv6_prefix_list_ge_cmd,
1799 "ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128>",
1802 "Name of a prefix list\n"
1803 "Specify packets to reject\n"
1804 "Specify packets to forward\n"
1805 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1806 "Minimum prefix length to be matched\n"
1807 "Minimum prefix length\n")
1809 return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1],
1810 argv[2], argv[3], NULL);
1813 DEFUN (ipv6_prefix_list_ge_le,
1814 ipv6_prefix_list_ge_le_cmd,
1815 "ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128> le <0-128>",
1818 "Name of a prefix list\n"
1819 "Specify packets to reject\n"
1820 "Specify packets to forward\n"
1821 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1822 "Minimum prefix length to be matched\n"
1823 "Minimum prefix length\n"
1824 "Maximum prefix length to be matched\n"
1825 "Maximum prefix length\n")
1828 return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1],
1829 argv[2], argv[3], argv[4]);
1832 DEFUN (ipv6_prefix_list_le,
1833 ipv6_prefix_list_le_cmd,
1834 "ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128>",
1837 "Name of a prefix list\n"
1838 "Specify packets to reject\n"
1839 "Specify packets to forward\n"
1840 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1841 "Maximum prefix length to be matched\n"
1842 "Maximum prefix length\n")
1844 return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1],
1845 argv[2], NULL, argv[3]);
1848 DEFUN (ipv6_prefix_list_le_ge,
1849 ipv6_prefix_list_le_ge_cmd,
1850 "ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128> ge <0-128>",
1853 "Name of a prefix list\n"
1854 "Specify packets to reject\n"
1855 "Specify packets to forward\n"
1856 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1857 "Maximum prefix length to be matched\n"
1858 "Maximum prefix length\n"
1859 "Minimum prefix length to be matched\n"
1860 "Minimum prefix length\n")
1862 return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1],
1863 argv[2], argv[4], argv[3]);
1866 DEFUN (ipv6_prefix_list_seq,
1867 ipv6_prefix_list_seq_cmd,
1868 "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) (X:X::X:X/M|any)",
1871 "Name of a prefix list\n"
1872 "sequence number of an entry\n"
1874 "Specify packets to reject\n"
1875 "Specify packets to forward\n"
1876 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1877 "Any prefix match. Same as \"::0/0 le 128\"\n")
1879 return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1880 argv[3], NULL, NULL);
1883 DEFUN (ipv6_prefix_list_seq_ge,
1884 ipv6_prefix_list_seq_ge_cmd,
1885 "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128>",
1888 "Name of a prefix list\n"
1889 "sequence number of an entry\n"
1891 "Specify packets to reject\n"
1892 "Specify packets to forward\n"
1893 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1894 "Minimum prefix length to be matched\n"
1895 "Minimum prefix length\n")
1897 return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1898 argv[3], argv[4], NULL);
1901 DEFUN (ipv6_prefix_list_seq_ge_le,
1902 ipv6_prefix_list_seq_ge_le_cmd,
1903 "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128> le <0-128>",
1906 "Name of a prefix list\n"
1907 "sequence number of an entry\n"
1909 "Specify packets to reject\n"
1910 "Specify packets to forward\n"
1911 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1912 "Minimum prefix length to be matched\n"
1913 "Minimum prefix length\n"
1914 "Maximum prefix length to be matched\n"
1915 "Maximum prefix length\n")
1917 return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1918 argv[3], argv[4], argv[5]);
1921 DEFUN (ipv6_prefix_list_seq_le,
1922 ipv6_prefix_list_seq_le_cmd,
1923 "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128>",
1926 "Name of a prefix list\n"
1927 "sequence number of an entry\n"
1929 "Specify packets to reject\n"
1930 "Specify packets to forward\n"
1931 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1932 "Maximum prefix length to be matched\n"
1933 "Maximum prefix length\n")
1935 return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1936 argv[3], NULL, argv[4]);
1939 DEFUN (ipv6_prefix_list_seq_le_ge,
1940 ipv6_prefix_list_seq_le_ge_cmd,
1941 "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128> ge <0-128>",
1944 "Name of a prefix list\n"
1945 "sequence number of an entry\n"
1947 "Specify packets to reject\n"
1948 "Specify packets to forward\n"
1949 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1950 "Maximum prefix length to be matched\n"
1951 "Maximum prefix length\n"
1952 "Minimum prefix length to be matched\n"
1953 "Minimum prefix length\n")
1955 return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1956 argv[3], argv[5], argv[4]);
1959 DEFUN (no_ipv6_prefix_list,
1960 no_ipv6_prefix_list_cmd,
1961 "no ipv6 prefix-list WORD",
1965 "Name of a prefix list\n")
1967 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, NULL,
1971 DEFUN (no_ipv6_prefix_list_prefix,
1972 no_ipv6_prefix_list_prefix_cmd,
1973 "no ipv6 prefix-list WORD (deny|permit) (X:X::X:X/M|any)",
1977 "Name of a prefix list\n"
1978 "Specify packets to reject\n"
1979 "Specify packets to forward\n"
1980 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1981 "Any prefix match. Same as \"::0/0 le 128\"\n")
1983 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
1984 argv[2], NULL, NULL);
1987 DEFUN (no_ipv6_prefix_list_ge,
1988 no_ipv6_prefix_list_ge_cmd,
1989 "no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128>",
1993 "Name of a prefix list\n"
1994 "Specify packets to reject\n"
1995 "Specify packets to forward\n"
1996 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1997 "Minimum prefix length to be matched\n"
1998 "Minimum prefix length\n")
2000 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
2001 argv[2], argv[3], NULL);
2004 DEFUN (no_ipv6_prefix_list_ge_le,
2005 no_ipv6_prefix_list_ge_le_cmd,
2006 "no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128> le <0-128>",
2010 "Name of a prefix list\n"
2011 "Specify packets to reject\n"
2012 "Specify packets to forward\n"
2013 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2014 "Minimum prefix length to be matched\n"
2015 "Minimum prefix length\n"
2016 "Maximum prefix length to be matched\n"
2017 "Maximum prefix length\n")
2019 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
2020 argv[2], argv[3], argv[4]);
2023 DEFUN (no_ipv6_prefix_list_le,
2024 no_ipv6_prefix_list_le_cmd,
2025 "no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128>",
2029 "Name of a prefix list\n"
2030 "Specify packets to reject\n"
2031 "Specify packets to forward\n"
2032 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2033 "Maximum prefix length to be matched\n"
2034 "Maximum prefix length\n")
2036 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
2037 argv[2], NULL, argv[3]);
2040 DEFUN (no_ipv6_prefix_list_le_ge,
2041 no_ipv6_prefix_list_le_ge_cmd,
2042 "no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128> ge <0-128>",
2046 "Name of a prefix list\n"
2047 "Specify packets to reject\n"
2048 "Specify packets to forward\n"
2049 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2050 "Maximum prefix length to be matched\n"
2051 "Maximum prefix length\n"
2052 "Minimum prefix length to be matched\n"
2053 "Minimum prefix length\n")
2055 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
2056 argv[2], argv[4], argv[3]);
2059 DEFUN (no_ipv6_prefix_list_seq,
2060 no_ipv6_prefix_list_seq_cmd,
2061 "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) (X:X::X:X/M|any)",
2065 "Name of a prefix list\n"
2066 "sequence number of an entry\n"
2068 "Specify packets to reject\n"
2069 "Specify packets to forward\n"
2070 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2071 "Any prefix match. Same as \"::0/0 le 128\"\n")
2073 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2074 argv[3], NULL, NULL);
2077 DEFUN (no_ipv6_prefix_list_seq_ge,
2078 no_ipv6_prefix_list_seq_ge_cmd,
2079 "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128>",
2083 "Name of a prefix list\n"
2084 "sequence number of an entry\n"
2086 "Specify packets to reject\n"
2087 "Specify packets to forward\n"
2088 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2089 "Minimum prefix length to be matched\n"
2090 "Minimum prefix length\n")
2092 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2093 argv[3], argv[4], NULL);
2096 DEFUN (no_ipv6_prefix_list_seq_ge_le,
2097 no_ipv6_prefix_list_seq_ge_le_cmd,
2098 "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128> le <0-128>",
2102 "Name of a prefix list\n"
2103 "sequence number of an entry\n"
2105 "Specify packets to reject\n"
2106 "Specify packets to forward\n"
2107 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2108 "Minimum prefix length to be matched\n"
2109 "Minimum prefix length\n"
2110 "Maximum prefix length to be matched\n"
2111 "Maximum prefix length\n")
2113 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2114 argv[3], argv[4], argv[5]);
2117 DEFUN (no_ipv6_prefix_list_seq_le,
2118 no_ipv6_prefix_list_seq_le_cmd,
2119 "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128>",
2123 "Name of a prefix list\n"
2124 "sequence number of an entry\n"
2126 "Specify packets to reject\n"
2127 "Specify packets to forward\n"
2128 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2129 "Maximum prefix length to be matched\n"
2130 "Maximum prefix length\n")
2132 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2133 argv[3], NULL, argv[4]);
2136 DEFUN (no_ipv6_prefix_list_seq_le_ge,
2137 no_ipv6_prefix_list_seq_le_ge_cmd,
2138 "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128> ge <0-128>",
2142 "Name of a prefix list\n"
2143 "sequence number of an entry\n"
2145 "Specify packets to reject\n"
2146 "Specify packets to forward\n"
2147 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2148 "Maximum prefix length to be matched\n"
2149 "Maximum prefix length\n"
2150 "Minimum prefix length to be matched\n"
2151 "Minimum prefix length\n")
2153 return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2154 argv[3], argv[5], argv[4]);
2157 DEFUN (ipv6_prefix_list_sequence_number,
2158 ipv6_prefix_list_sequence_number_cmd,
2159 "ipv6 prefix-list sequence-number",
2162 "Include/exclude sequence numbers in NVGEN\n")
2164 prefix_master_ipv6.seqnum = 1;
2168 DEFUN (no_ipv6_prefix_list_sequence_number,
2169 no_ipv6_prefix_list_sequence_number_cmd,
2170 "no ipv6 prefix-list sequence-number",
2174 "Include/exclude sequence numbers in NVGEN\n")
2176 prefix_master_ipv6.seqnum = 0;
2180 DEFUN (ipv6_prefix_list_description,
2181 ipv6_prefix_list_description_cmd,
2182 "ipv6 prefix-list WORD description .LINE",
2185 "Name of a prefix list\n"
2186 "Prefix-list specific description\n"
2187 "Up to 80 characters describing this prefix-list\n")
2189 struct prefix_list *plist;
2191 plist = prefix_list_get (AFI_IP6, 0, argv[0]);
2195 XFREE (MTYPE_TMP, plist->desc);
2198 plist->desc = argv_concat(argv, argc, 1);
2203 DEFUN (no_ipv6_prefix_list_description,
2204 no_ipv6_prefix_list_description_cmd,
2205 "no ipv6 prefix-list WORD description",
2209 "Name of a prefix list\n"
2210 "Prefix-list specific description\n")
2212 return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[0]);
2215 ALIAS (no_ipv6_prefix_list_description,
2216 no_ipv6_prefix_list_description_arg_cmd,
2217 "no ipv6 prefix-list WORD description .LINE",
2221 "Name of a prefix list\n"
2222 "Prefix-list specific description\n"
2223 "Up to 80 characters describing this prefix-list\n")
2225 DEFUN (show_ipv6_prefix_list,
2226 show_ipv6_prefix_list_cmd,
2227 "show ipv6 prefix-list",
2232 return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, normal_display);
2235 DEFUN (show_ipv6_prefix_list_name,
2236 show_ipv6_prefix_list_name_cmd,
2237 "show ipv6 prefix-list WORD",
2241 "Name of a prefix list\n")
2243 return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, normal_display);
2246 DEFUN (show_ipv6_prefix_list_name_seq,
2247 show_ipv6_prefix_list_name_seq_cmd,
2248 "show ipv6 prefix-list WORD seq <1-4294967295>",
2252 "Name of a prefix list\n"
2253 "sequence number of an entry\n"
2254 "Sequence number\n")
2256 return vty_show_prefix_list (vty, AFI_IP6, argv[0], argv[1], sequential_display);
2259 DEFUN (show_ipv6_prefix_list_prefix,
2260 show_ipv6_prefix_list_prefix_cmd,
2261 "show ipv6 prefix-list WORD X:X::X:X/M",
2265 "Name of a prefix list\n"
2266 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
2268 return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], normal_display);
2271 DEFUN (show_ipv6_prefix_list_prefix_longer,
2272 show_ipv6_prefix_list_prefix_longer_cmd,
2273 "show ipv6 prefix-list WORD X:X::X:X/M longer",
2277 "Name of a prefix list\n"
2278 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2279 "Lookup longer prefix\n")
2281 return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], longer_display);
2284 DEFUN (show_ipv6_prefix_list_prefix_first_match,
2285 show_ipv6_prefix_list_prefix_first_match_cmd,
2286 "show ipv6 prefix-list WORD X:X::X:X/M first-match",
2290 "Name of a prefix list\n"
2291 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2292 "First matched prefix\n")
2294 return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], first_match_display);
2297 DEFUN (show_ipv6_prefix_list_summary,
2298 show_ipv6_prefix_list_summary_cmd,
2299 "show ipv6 prefix-list summary",
2303 "Summary of prefix lists\n")
2305 return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, summary_display);
2308 DEFUN (show_ipv6_prefix_list_summary_name,
2309 show_ipv6_prefix_list_summary_name_cmd,
2310 "show ipv6 prefix-list summary WORD",
2314 "Summary of prefix lists\n"
2315 "Name of a prefix list\n")
2317 return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, summary_display);
2320 DEFUN (show_ipv6_prefix_list_detail,
2321 show_ipv6_prefix_list_detail_cmd,
2322 "show ipv6 prefix-list detail",
2326 "Detail of prefix lists\n")
2328 return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, detail_display);
2331 DEFUN (show_ipv6_prefix_list_detail_name,
2332 show_ipv6_prefix_list_detail_name_cmd,
2333 "show ipv6 prefix-list detail WORD",
2337 "Detail of prefix lists\n"
2338 "Name of a prefix list\n")
2340 return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, detail_display);
2343 DEFUN (clear_ipv6_prefix_list,
2344 clear_ipv6_prefix_list_cmd,
2345 "clear ipv6 prefix-list",
2350 return vty_clear_prefix_list (vty, AFI_IP6, NULL, NULL);
2353 DEFUN (clear_ipv6_prefix_list_name,
2354 clear_ipv6_prefix_list_name_cmd,
2355 "clear ipv6 prefix-list WORD",
2359 "Name of a prefix list\n")
2361 return vty_clear_prefix_list (vty, AFI_IP6, argv[0], NULL);
2364 DEFUN (clear_ipv6_prefix_list_name_prefix,
2365 clear_ipv6_prefix_list_name_prefix_cmd,
2366 "clear ipv6 prefix-list WORD X:X::X:X/M",
2370 "Name of a prefix list\n"
2371 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
2373 return vty_clear_prefix_list (vty, AFI_IP6, argv[0], argv[1]);
2375 #endif /* HAVE_IPV6 */
2377 /* Configuration write function. */
2379 config_write_prefix_afi (afi_t afi, struct vty *vty)
2381 struct prefix_list *plist;
2382 struct prefix_list_entry *pentry;
2383 struct prefix_master *master;
2386 master = prefix_master_get (afi, 0);
2390 if (! master->seqnum)
2392 vty_out (vty, "no ip%s prefix-list sequence-number%s",
2393 afi == AFI_IP ? "" : "v6", VTY_NEWLINE);
2394 vty_out (vty, "!%s", VTY_NEWLINE);
2397 for (plist = master->num.head; plist; plist = plist->next)
2401 vty_out (vty, "ip%s prefix-list %s description %s%s",
2402 afi == AFI_IP ? "" : "v6",
2403 plist->name, plist->desc, VTY_NEWLINE);
2407 for (pentry = plist->head; pentry; pentry = pentry->next)
2409 vty_out (vty, "ip%s prefix-list %s ",
2410 afi == AFI_IP ? "" : "v6",
2414 vty_out (vty, "seq %d ", pentry->seq);
2416 vty_out (vty, "%s ", prefix_list_type_str (pentry));
2419 vty_out (vty, "any");
2422 struct prefix *p = &pentry->prefix;
2425 vty_out (vty, "%s/%d",
2426 inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
2430 vty_out (vty, " ge %d", pentry->ge);
2432 vty_out (vty, " le %d", pentry->le);
2434 vty_out (vty, "%s", VTY_NEWLINE);
2437 /* vty_out (vty, "!%s", VTY_NEWLINE); */
2440 for (plist = master->str.head; plist; plist = plist->next)
2444 vty_out (vty, "ip%s prefix-list %s description %s%s",
2445 afi == AFI_IP ? "" : "v6",
2446 plist->name, plist->desc, VTY_NEWLINE);
2450 for (pentry = plist->head; pentry; pentry = pentry->next)
2452 vty_out (vty, "ip%s prefix-list %s ",
2453 afi == AFI_IP ? "" : "v6",
2457 vty_out (vty, "seq %d ", pentry->seq);
2459 vty_out (vty, "%s", prefix_list_type_str (pentry));
2462 vty_out (vty, " any");
2465 struct prefix *p = &pentry->prefix;
2468 vty_out (vty, " %s/%d",
2469 inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
2473 vty_out (vty, " ge %d", pentry->ge);
2475 vty_out (vty, " le %d", pentry->le);
2477 vty_out (vty, "%s", VTY_NEWLINE);
2486 prefix_bgp_orf_entry (struct stream *s, struct prefix_list *plist,
2487 u_char init_flag, u_char permit_flag, u_char deny_flag)
2489 struct prefix_list_entry *pentry;
2494 for (pentry = plist->head; pentry; pentry = pentry->next)
2496 u_char flag = init_flag;
2497 struct prefix *p = &pentry->prefix;
2499 flag |= (pentry->type == PREFIX_PERMIT ?
2500 permit_flag : deny_flag);
2501 stream_putc (s, flag);
2502 stream_putl (s, (u_int32_t)pentry->seq);
2503 stream_putc (s, (u_char)pentry->ge);
2504 stream_putc (s, (u_char)pentry->le);
2505 stream_put_prefix (s, p);
2512 prefix_bgp_orf_set (char *name, afi_t afi, struct orf_prefix *orfp,
2513 int permit, int set)
2515 struct prefix_list *plist;
2516 struct prefix_list_entry *pentry;
2518 /* ge and le value check */
2519 if (orfp->ge && orfp->ge <= orfp->p.prefixlen)
2521 if (orfp->le && orfp->le <= orfp->p.prefixlen)
2523 if (orfp->le && orfp->ge > orfp->le)
2526 if (orfp->ge && orfp->le == (afi == AFI_IP ? 32 : 128))
2529 plist = prefix_list_get (afi, 1, name);
2535 pentry = prefix_list_entry_make (&orfp->p,
2536 (permit ? PREFIX_PERMIT : PREFIX_DENY),
2537 orfp->seq, orfp->le, orfp->ge, 0);
2539 if (prefix_entry_dup_check (plist, pentry))
2541 prefix_list_entry_free (pentry);
2545 prefix_list_entry_add (plist, pentry);
2549 pentry = prefix_list_entry_lookup (plist, &orfp->p,
2550 (permit ? PREFIX_PERMIT : PREFIX_DENY),
2551 orfp->seq, orfp->le, orfp->ge);
2556 prefix_list_entry_delete (plist, pentry, 1);
2563 prefix_bgp_orf_remove_all (afi_t afi, char *name)
2565 struct prefix_list *plist;
2567 plist = prefix_bgp_orf_lookup (afi, name);
2569 prefix_list_delete (plist);
2572 /* return prefix count */
2574 prefix_bgp_show_prefix_list (struct vty *vty, afi_t afi, char *name)
2576 struct prefix_list *plist;
2577 struct prefix_list_entry *pentry;
2579 plist = prefix_bgp_orf_lookup (afi, name);
2584 return plist->count;
2586 vty_out (vty, "ip%s prefix-list %s: %d entries%s",
2587 afi == AFI_IP ? "" : "v6",
2588 plist->name, plist->count, VTY_NEWLINE);
2590 for (pentry = plist->head; pentry; pentry = pentry->next)
2592 struct prefix *p = &pentry->prefix;
2595 vty_out (vty, " seq %d %s %s/%d", pentry->seq,
2596 prefix_list_type_str (pentry),
2597 inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
2601 vty_out (vty, " ge %d", pentry->ge);
2603 vty_out (vty, " le %d", pentry->le);
2605 vty_out (vty, "%s", VTY_NEWLINE);
2607 return plist->count;
2611 prefix_list_reset_afi (afi_t afi, int orf)
2613 struct prefix_list *plist;
2614 struct prefix_list *next;
2615 struct prefix_master *master;
2617 master = prefix_master_get (afi, orf);
2621 for (plist = master->num.head; plist; plist = next)
2624 prefix_list_delete (plist);
2626 for (plist = master->str.head; plist; plist = next)
2629 prefix_list_delete (plist);
2632 assert (master->num.head == NULL);
2633 assert (master->num.tail == NULL);
2635 assert (master->str.head == NULL);
2636 assert (master->str.tail == NULL);
2639 master->recent = NULL;
2643 /* Prefix-list node. */
2644 static struct cmd_node prefix_node =
2647 "", /* Prefix list has no interface. */
2652 config_write_prefix_ipv4 (struct vty *vty)
2654 return config_write_prefix_afi (AFI_IP, vty);
2658 prefix_list_init_ipv4 (void)
2660 install_node (&prefix_node, config_write_prefix_ipv4);
2662 install_element (CONFIG_NODE, &ip_prefix_list_cmd);
2663 install_element (CONFIG_NODE, &ip_prefix_list_ge_cmd);
2664 install_element (CONFIG_NODE, &ip_prefix_list_ge_le_cmd);
2665 install_element (CONFIG_NODE, &ip_prefix_list_le_cmd);
2666 install_element (CONFIG_NODE, &ip_prefix_list_le_ge_cmd);
2667 install_element (CONFIG_NODE, &ip_prefix_list_seq_cmd);
2668 install_element (CONFIG_NODE, &ip_prefix_list_seq_ge_cmd);
2669 install_element (CONFIG_NODE, &ip_prefix_list_seq_ge_le_cmd);
2670 install_element (CONFIG_NODE, &ip_prefix_list_seq_le_cmd);
2671 install_element (CONFIG_NODE, &ip_prefix_list_seq_le_ge_cmd);
2673 install_element (CONFIG_NODE, &no_ip_prefix_list_cmd);
2674 install_element (CONFIG_NODE, &no_ip_prefix_list_prefix_cmd);
2675 install_element (CONFIG_NODE, &no_ip_prefix_list_ge_cmd);
2676 install_element (CONFIG_NODE, &no_ip_prefix_list_ge_le_cmd);
2677 install_element (CONFIG_NODE, &no_ip_prefix_list_le_cmd);
2678 install_element (CONFIG_NODE, &no_ip_prefix_list_le_ge_cmd);
2679 install_element (CONFIG_NODE, &no_ip_prefix_list_seq_cmd);
2680 install_element (CONFIG_NODE, &no_ip_prefix_list_seq_ge_cmd);
2681 install_element (CONFIG_NODE, &no_ip_prefix_list_seq_ge_le_cmd);
2682 install_element (CONFIG_NODE, &no_ip_prefix_list_seq_le_cmd);
2683 install_element (CONFIG_NODE, &no_ip_prefix_list_seq_le_ge_cmd);
2685 install_element (CONFIG_NODE, &ip_prefix_list_description_cmd);
2686 install_element (CONFIG_NODE, &no_ip_prefix_list_description_cmd);
2687 install_element (CONFIG_NODE, &no_ip_prefix_list_description_arg_cmd);
2689 install_element (CONFIG_NODE, &ip_prefix_list_sequence_number_cmd);
2690 install_element (CONFIG_NODE, &no_ip_prefix_list_sequence_number_cmd);
2692 install_element (VIEW_NODE, &show_ip_prefix_list_cmd);
2693 install_element (VIEW_NODE, &show_ip_prefix_list_name_cmd);
2694 install_element (VIEW_NODE, &show_ip_prefix_list_name_seq_cmd);
2695 install_element (VIEW_NODE, &show_ip_prefix_list_prefix_cmd);
2696 install_element (VIEW_NODE, &show_ip_prefix_list_prefix_longer_cmd);
2697 install_element (VIEW_NODE, &show_ip_prefix_list_prefix_first_match_cmd);
2698 install_element (VIEW_NODE, &show_ip_prefix_list_summary_cmd);
2699 install_element (VIEW_NODE, &show_ip_prefix_list_summary_name_cmd);
2700 install_element (VIEW_NODE, &show_ip_prefix_list_detail_cmd);
2701 install_element (VIEW_NODE, &show_ip_prefix_list_detail_name_cmd);
2703 install_element (ENABLE_NODE, &clear_ip_prefix_list_cmd);
2704 install_element (ENABLE_NODE, &clear_ip_prefix_list_name_cmd);
2705 install_element (ENABLE_NODE, &clear_ip_prefix_list_name_prefix_cmd);
2708 /* Prefix-list node. */
2709 static struct cmd_node prefix_ipv6_node =
2712 "", /* Prefix list has no interface. */
2717 config_write_prefix_ipv6 (struct vty *vty)
2719 return config_write_prefix_afi (AFI_IP6, vty);
2723 prefix_list_init_ipv6 (void)
2725 install_node (&prefix_ipv6_node, config_write_prefix_ipv6);
2727 install_element (CONFIG_NODE, &ipv6_prefix_list_cmd);
2728 install_element (CONFIG_NODE, &ipv6_prefix_list_ge_cmd);
2729 install_element (CONFIG_NODE, &ipv6_prefix_list_ge_le_cmd);
2730 install_element (CONFIG_NODE, &ipv6_prefix_list_le_cmd);
2731 install_element (CONFIG_NODE, &ipv6_prefix_list_le_ge_cmd);
2732 install_element (CONFIG_NODE, &ipv6_prefix_list_seq_cmd);
2733 install_element (CONFIG_NODE, &ipv6_prefix_list_seq_ge_cmd);
2734 install_element (CONFIG_NODE, &ipv6_prefix_list_seq_ge_le_cmd);
2735 install_element (CONFIG_NODE, &ipv6_prefix_list_seq_le_cmd);
2736 install_element (CONFIG_NODE, &ipv6_prefix_list_seq_le_ge_cmd);
2738 install_element (CONFIG_NODE, &no_ipv6_prefix_list_cmd);
2739 install_element (CONFIG_NODE, &no_ipv6_prefix_list_prefix_cmd);
2740 install_element (CONFIG_NODE, &no_ipv6_prefix_list_ge_cmd);
2741 install_element (CONFIG_NODE, &no_ipv6_prefix_list_ge_le_cmd);
2742 install_element (CONFIG_NODE, &no_ipv6_prefix_list_le_cmd);
2743 install_element (CONFIG_NODE, &no_ipv6_prefix_list_le_ge_cmd);
2744 install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_cmd);
2745 install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_ge_cmd);
2746 install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_ge_le_cmd);
2747 install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_le_cmd);
2748 install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_le_ge_cmd);
2750 install_element (CONFIG_NODE, &ipv6_prefix_list_description_cmd);
2751 install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_cmd);
2752 install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_arg_cmd);
2754 install_element (CONFIG_NODE, &ipv6_prefix_list_sequence_number_cmd);
2755 install_element (CONFIG_NODE, &no_ipv6_prefix_list_sequence_number_cmd);
2757 install_element (VIEW_NODE, &show_ipv6_prefix_list_cmd);
2758 install_element (VIEW_NODE, &show_ipv6_prefix_list_name_cmd);
2759 install_element (VIEW_NODE, &show_ipv6_prefix_list_name_seq_cmd);
2760 install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_cmd);
2761 install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_longer_cmd);
2762 install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_first_match_cmd);
2763 install_element (VIEW_NODE, &show_ipv6_prefix_list_summary_cmd);
2764 install_element (VIEW_NODE, &show_ipv6_prefix_list_summary_name_cmd);
2765 install_element (VIEW_NODE, &show_ipv6_prefix_list_detail_cmd);
2766 install_element (VIEW_NODE, &show_ipv6_prefix_list_detail_name_cmd);
2768 install_element (ENABLE_NODE, &clear_ipv6_prefix_list_cmd);
2769 install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_cmd);
2770 install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_prefix_cmd);
2776 prefix_list_init_ipv4 ();
2778 prefix_list_init_ipv6 ();
2779 #endif /* HAVE_IPV6 */
2783 prefix_list_reset ()
2785 prefix_list_reset_afi (AFI_IP, 0);
2786 prefix_list_reset_afi (AFI_IP6, 0);
2787 prefix_list_reset_afi (AFI_IP, 1);
2788 prefix_list_reset_afi (AFI_IP6, 1);