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"
31
/* Each prefix-list's entry. */
32
struct prefix_list_entry
39
enum prefix_list_type type;
47
struct prefix_list_entry *next;
48
struct prefix_list_entry *prev;
51
/* List of struct prefix_list. */
52
struct prefix_list_list
54
struct prefix_list *head;
55
struct prefix_list *tail;
58
/* Master structure of prefix_list. */
61
/* List of prefix_list which name is number. */
62
struct prefix_list_list num;
64
/* List of prefix_list which name is string. */
65
struct prefix_list_list str;
67
/* Whether sequential number is used. */
70
/* The latest update. */
71
struct prefix_list *recent;
73
/* Hook function which is executed when new prefix_list is added. */
76
/* Hook function which is executed when prefix_list is deleted. */
77
void (*delete_hook) ();
80
/* Static structure of IPv4 prefix_list's master. */
81
static struct prefix_master prefix_master_ipv4 =
91
/* Static structure of IPv6 prefix-list's master. */
92
static struct prefix_master prefix_master_ipv6 =
100
#endif /* HAVE_IPV6*/
102
/* Static structure of BGP ORF prefix_list's master. */
103
static struct prefix_master prefix_master_orf =
112
struct prefix_master *
113
prefix_master_get (afi_t afi)
116
return &prefix_master_ipv4;
118
else if (afi == AFI_IP6)
119
return &prefix_master_ipv6;
120
#endif /* HAVE_IPV6 */
121
else if (afi == AFI_ORF_PREFIX)
122
return &prefix_master_orf;
126
/* Lookup prefix_list from list of prefix_list by name. */
128
prefix_list_lookup (afi_t afi, char *name)
130
struct prefix_list *plist;
131
struct prefix_master *master;
136
master = prefix_master_get (afi);
140
for (plist = master->num.head; plist; plist = plist->next)
141
if (strcmp (plist->name, name) == 0)
144
for (plist = master->str.head; plist; plist = plist->next)
145
if (strcmp (plist->name, name) == 0)
154
struct prefix_list *new;
156
new = XCALLOC (MTYPE_PREFIX_LIST, sizeof (struct prefix_list));
161
prefix_list_free (struct prefix_list *plist)
163
XFREE (MTYPE_PREFIX_LIST, plist);
166
struct prefix_list_entry *
167
prefix_list_entry_new ()
169
struct prefix_list_entry *new;
171
new = XCALLOC (MTYPE_PREFIX_LIST_ENTRY, sizeof (struct prefix_list_entry));
176
prefix_list_entry_free (struct prefix_list_entry *pentry)
178
XFREE (MTYPE_PREFIX_LIST_ENTRY, pentry);
181
/* Insert new prefix list to list of prefix_list. Each prefix_list
182
is sorted by the name. */
184
prefix_list_insert (afi_t afi, char *name)
188
struct prefix_list *plist;
189
struct prefix_list *point;
190
struct prefix_list_list *list;
191
struct prefix_master *master;
193
master = prefix_master_get (afi);
197
/* Allocate new prefix_list and copy given name. */
198
plist = prefix_list_new ();
199
plist->name = XSTRDUP (MTYPE_PREFIX_LIST_STR, name);
200
plist->master = master;
202
/* If name is made by all digit character. We treat it as
204
for (number = 0, i = 0; i < strlen (name); i++)
206
if (isdigit ((int) name[i]))
207
number = (number * 10) + (name[i] - '0');
212
/* In case of name is all digit character */
213
if (i == strlen (name))
215
plist->type = PREFIX_TYPE_NUMBER;
217
/* Set prefix_list to number list. */
220
for (point = list->head; point; point = point->next)
221
if (atol (point->name) >= number)
226
plist->type = PREFIX_TYPE_STRING;
228
/* Set prefix_list to string list. */
231
/* Set point to insertion point. */
232
for (point = list->head; point; point = point->next)
233
if (strcmp (point->name, name) >= 0)
237
/* In case of this is the first element of master. */
238
if (list->head == NULL)
240
list->head = list->tail = plist;
244
/* In case of insertion is made at the tail of access_list. */
247
plist->prev = list->tail;
248
list->tail->next = plist;
253
/* In case of insertion is made at the head of access_list. */
254
if (point == list->head)
256
plist->next = list->head;
257
list->head->prev = plist;
262
/* Insertion is made at middle of the access_list. */
264
plist->prev = point->prev;
267
point->prev->next = plist;
274
prefix_list_get (afi_t afi, char *name)
276
struct prefix_list *plist;
278
plist = prefix_list_lookup (afi, name);
281
plist = prefix_list_insert (afi, name);
285
/* Delete prefix-list from prefix_list_master and free it. */
287
prefix_list_delete (struct prefix_list *plist)
289
struct prefix_list_list *list;
290
struct prefix_master *master;
291
struct prefix_list_entry *pentry;
292
struct prefix_list_entry *next;
294
/* If prefix-list contain prefix_list_entry free all of it. */
295
for (pentry = plist->head; pentry; pentry = next)
298
prefix_list_entry_free (pentry);
302
master = plist->master;
304
if (plist->type == PREFIX_TYPE_NUMBER)
310
plist->next->prev = plist->prev;
312
list->tail = plist->prev;
315
plist->prev->next = plist->next;
317
list->head = plist->next;
320
XFREE (MTYPE_TMP, plist->desc);
322
/* Make sure master's recent changed prefix-list information is
324
master->recent = NULL;
327
XFREE (MTYPE_PREFIX_LIST_STR, plist->name);
329
prefix_list_free (plist);
331
if (master->delete_hook)
332
(*master->delete_hook) ();
335
struct prefix_list_entry *
336
prefix_list_entry_make (struct prefix *prefix, enum prefix_list_type type,
337
int seq, int le, int ge, int any)
339
struct prefix_list_entry *pentry;
341
pentry = prefix_list_entry_new ();
346
prefix_copy (&pentry->prefix, prefix);
355
/* Add hook function. */
357
prefix_list_add_hook (void (*func) (struct prefix_list *plist))
359
prefix_master_ipv4.add_hook = func;
361
prefix_master_ipv6.add_hook = func;
362
#endif /* HAVE_IPV6 */
365
/* Delete hook function. */
367
prefix_list_delete_hook (void (*func) (struct prefix_list *plist))
369
prefix_master_ipv4.delete_hook = func;
371
prefix_master_ipv6.delete_hook = func;
372
#endif /* HAVE_IPVt6 */
375
/* Calculate new sequential number. */
377
prefix_new_seq_get (struct prefix_list *plist)
381
struct prefix_list_entry *pentry;
385
for (pentry = plist->head; pentry; pentry = pentry->next)
387
if (maxseq < pentry->seq)
388
maxseq = pentry->seq;
391
newseq = ((maxseq / 5) * 5) + 5;
396
/* Return prefix list entry which has same seq number. */
397
struct prefix_list_entry *
398
prefix_seq_check (struct prefix_list *plist, int seq)
400
struct prefix_list_entry *pentry;
402
for (pentry = plist->head; pentry; pentry = pentry->next)
403
if (pentry->seq == seq)
408
struct prefix_list_entry *
409
prefix_list_entry_lookup (struct prefix_list *plist, struct prefix *prefix,
410
enum prefix_list_type type, int seq, int le, int ge)
412
struct prefix_list_entry *pentry;
414
for (pentry = plist->head; pentry; pentry = pentry->next)
415
if (prefix_same (&pentry->prefix, prefix) && pentry->type == type)
417
if (seq >= 0 && pentry->seq != seq)
420
if (pentry->le != le)
422
if (pentry->ge != ge)
432
prefix_list_entry_delete (struct prefix_list *plist,
433
struct prefix_list_entry *pentry,
436
if (plist == NULL || pentry == NULL)
439
pentry->prev->next = pentry->next;
441
plist->head = pentry->next;
443
pentry->next->prev = pentry->prev;
445
plist->tail = pentry->prev;
447
prefix_list_entry_free (pentry);
453
if (plist->master->delete_hook)
454
(*plist->master->delete_hook) (plist);
456
if (plist->head == NULL && plist->tail == NULL && plist->desc == NULL)
457
prefix_list_delete (plist);
459
plist->master->recent = plist;
464
prefix_list_entry_add (struct prefix_list *plist,
465
struct prefix_list_entry *pentry)
467
struct prefix_list_entry *replace;
468
struct prefix_list_entry *point;
470
/* Automatic asignment of seq no. */
471
if (pentry->seq == -1)
472
pentry->seq = prefix_new_seq_get (plist);
474
/* Is there any same seq prefix list entry? */
475
replace = prefix_seq_check (plist, pentry->seq);
477
prefix_list_entry_delete (plist, replace, 0);
479
/* Check insert point. */
480
for (point = plist->head; point; point = point->next)
481
if (point->seq >= pentry->seq)
484
/* In case of this is the first element of the list. */
485
pentry->next = point;
490
point->prev->next = pentry;
492
plist->head = pentry;
494
pentry->prev = point->prev;
495
point->prev = pentry;
500
plist->tail->next = pentry;
502
plist->head = pentry;
504
pentry->prev = plist->tail;
505
plist->tail = pentry;
508
/* Increment count. */
511
/* Run hook function. */
512
if (plist->master->add_hook)
513
(*plist->master->add_hook) (plist);
515
plist->master->recent = plist;
518
/* Return string of prefix_list_type. */
520
prefix_list_type_str (struct prefix_list_entry *pentry)
522
switch (pentry->type)
537
prefix_list_entry_match (struct prefix_list_entry *pentry, struct prefix *p)
541
ret = prefix_match (&pentry->prefix, p);
545
/* In case of le nor ge is specified, exact match is performed. */
546
if (! pentry->le && ! pentry->ge)
548
if (pentry->prefix.prefixlen != p->prefixlen)
554
if (p->prefixlen > pentry->le)
558
if (p->prefixlen < pentry->ge)
564
enum prefix_list_type
565
prefix_list_apply (struct prefix_list *plist, void *object)
567
struct prefix_list_entry *pentry;
570
p = (struct prefix *) object;
575
if (plist->count == 0)
576
return PREFIX_PERMIT;
578
for (pentry = plist->head; pentry; pentry = pentry->next)
581
if (prefix_list_entry_match (pentry, p))
592
prefix_list_print (struct prefix_list *plist)
594
struct prefix_list_entry *pentry;
599
printf ("ip prefix-list %s: %d entries\n", plist->name, plist->count);
601
for (pentry = plist->head; pentry; pentry = pentry->next)
604
printf ("any %s\n", prefix_list_type_str (pentry));
612
printf (" seq %d %s %s/%d",
614
prefix_list_type_str (pentry),
615
inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
618
printf (" ge %d", pentry->ge);
620
printf (" le %d", pentry->le);
626
/* Retrun 1 when plist already include pentry policy. */
627
struct prefix_list_entry *
628
prefix_entry_dup_check (struct prefix_list *plist,
629
struct prefix_list_entry *new)
631
struct prefix_list_entry *pentry;
635
seq = prefix_new_seq_get (plist);
639
for (pentry = plist->head; pentry; pentry = pentry->next)
641
if (prefix_same (&pentry->prefix, &new->prefix)
642
&& pentry->type == new->type
643
&& pentry->le == new->le
644
&& pentry->ge == new->ge
645
&& pentry->seq != seq)
652
vty_invalid_prefix_range (struct vty *vty, char *prefix)
654
vty_out (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value%s",
655
prefix, VTY_NEWLINE);
660
vty_prefix_list_install (struct vty *vty, afi_t afi,
661
char *name, char *seq, char *typestr,
662
char *prefix, char *ge, char *le)
665
enum prefix_list_type type;
666
struct prefix_list *plist;
667
struct prefix_list_entry *pentry;
668
struct prefix_list_entry *dup;
675
/* Sequential number. */
679
/* ge and le number */
685
/* Check filter type. */
686
if (strncmp ("permit", typestr, 1) == 0)
687
type = PREFIX_PERMIT;
688
else if (strncmp ("deny", typestr, 1) == 0)
692
vty_out (vty, "%% prefix type must be permit or deny%s", VTY_NEWLINE);
696
/* "any" is special token for matching any IPv4 addresses. */
699
if (strncmp ("any", prefix, strlen (prefix)) == 0)
701
ret = str2prefix_ipv4 ("0.0.0.0/0", (struct prefix_ipv4 *) &p);
703
lenum = IPV4_MAX_BITLEN;
707
ret = str2prefix_ipv4 (prefix, (struct prefix_ipv4 *) &p);
711
vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE);
716
else if (afi == AFI_IP6)
718
if (strncmp ("any", prefix, strlen (prefix)) == 0)
720
ret = str2prefix_ipv6 ("::/0", (struct prefix_ipv6 *) &p);
722
lenum = IPV6_MAX_BITLEN;
726
ret = str2prefix_ipv6 (prefix, (struct prefix_ipv6 *) &p);
730
vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE);
734
#endif /* HAVE_IPV6 */
736
/* ge and le check. */
737
if (genum && genum <= p.prefixlen)
738
return vty_invalid_prefix_range (vty, prefix);
740
if (lenum && lenum <= p.prefixlen)
741
return vty_invalid_prefix_range (vty, prefix);
743
if (lenum && genum > lenum)
744
return vty_invalid_prefix_range (vty, prefix);
746
if (genum && lenum == (afi == AFI_IP ? 32 : 128))
749
/* Get prefix_list with name. */
750
plist = prefix_list_get (afi, name);
752
/* Make prefix entry. */
753
pentry = prefix_list_entry_make (&p, type, seqnum, lenum, genum, any);
755
/* Check same policy. */
756
dup = prefix_entry_dup_check (plist, pentry);
760
prefix_list_entry_free (pentry);
761
vty_out (vty, "%% Insertion failed - prefix-list entry exists:%s",
763
vty_out (vty, " seq %d %s %s", dup->seq, typestr, prefix);
765
vty_out (vty, " ge %d", genum);
767
vty_out (vty, " le %d", lenum);
768
vty_out (vty, "%s", VTY_NEWLINE);
772
/* Install new filter to the access_list. */
773
prefix_list_entry_add (plist, pentry);
779
vty_prefix_list_uninstall (struct vty *vty, afi_t afi,
780
char *name, char *seq, char *typestr,
781
char *prefix, char *ge, char *le)
784
enum prefix_list_type type;
785
struct prefix_list *plist;
786
struct prefix_list_entry *pentry;
792
/* Check prefix list name. */
793
plist = prefix_list_lookup (afi, name);
796
vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
800
/* Only prefix-list name specified, delete the entire prefix-list. */
801
if (seq == NULL && typestr == NULL && prefix == NULL &&
802
ge == NULL && le == NULL)
804
prefix_list_delete (plist);
808
/* Check sequence number. */
812
/* ge and le number */
818
/* Check of filter type. */
819
if (strncmp ("permit", typestr, 1) == 0)
820
type = PREFIX_PERMIT;
821
else if (strncmp ("deny", typestr, 1) == 0)
825
vty_out (vty, "%% prefix type must be permit or deny%s", VTY_NEWLINE);
829
/* "any" is special token for matching any IPv4 addresses. */
832
if (strncmp ("any", prefix, strlen (prefix)) == 0)
834
ret = str2prefix_ipv4 ("0.0.0.0/0", (struct prefix_ipv4 *) &p);
836
lenum = IPV4_MAX_BITLEN;
839
ret = str2prefix_ipv4 (prefix, (struct prefix_ipv4 *) &p);
843
vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE);
848
else if (afi == AFI_IP6)
850
if (strncmp ("any", prefix, strlen (prefix)) == 0)
852
ret = str2prefix_ipv6 ("::/0", (struct prefix_ipv6 *) &p);
854
lenum = IPV6_MAX_BITLEN;
857
ret = str2prefix_ipv6 (prefix, (struct prefix_ipv6 *) &p);
861
vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE);
865
#endif /* HAVE_IPV6 */
867
/* Lookup prefix entry. */
868
pentry = prefix_list_entry_lookup(plist, &p, type, seqnum, lenum, genum);
872
vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
876
/* Install new filter to the access_list. */
877
prefix_list_entry_delete (plist, pentry, 1);
883
vty_prefix_list_desc_unset (struct vty *vty, afi_t afi, char *name)
885
struct prefix_list *plist;
887
plist = prefix_list_lookup (afi, name);
890
vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
896
XFREE (MTYPE_TMP, plist->desc);
900
if (plist->head == NULL && plist->tail == NULL && plist->desc == NULL)
901
prefix_list_delete (plist);
917
vty_show_prefix_entry (struct vty *vty, afi_t afi, struct prefix_list *plist,
918
struct prefix_master *master, enum display_type dtype,
921
struct prefix_list_entry *pentry;
923
if (dtype == normal_display)
925
vty_out (vty, "ip%s prefix-list %s: %d entries%s",
926
afi == AFI_IP ? "" : "v6",
927
plist->name, plist->count, VTY_NEWLINE);
929
vty_out (vty, " Description: %s%s", plist->desc, VTY_NEWLINE);
931
else if (dtype == summary_display || dtype == detail_display)
933
vty_out (vty, "ip%s prefix-list %s:%s",
934
afi == AFI_IP ? "" : "v6", plist->name, VTY_NEWLINE);
937
vty_out (vty, " Description: %s%s", plist->desc, VTY_NEWLINE);
939
vty_out (vty, " count: %d, range entries: %d, sequences: %d - %d%s",
940
plist->count, plist->rangecount,
941
plist->head ? plist->head->seq : 0,
942
plist->tail ? plist->tail->seq : 0,
946
if (dtype != summary_display)
948
for (pentry = plist->head; pentry; pentry = pentry->next)
950
if (dtype == sequential_display && pentry->seq != seqnum)
956
vty_out (vty, "seq %d ", pentry->seq);
958
vty_out (vty, "%s ", prefix_list_type_str (pentry));
961
vty_out (vty, "any");
964
struct prefix *p = &pentry->prefix;
967
vty_out (vty, "%s/%d",
968
inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
972
vty_out (vty, " ge %d", pentry->ge);
974
vty_out (vty, " le %d", pentry->le);
977
if (dtype == detail_display || dtype == sequential_display)
978
vty_out (vty, " (hit count: %ld, refcount: %ld)",
979
pentry->hitcnt, pentry->refcnt);
981
vty_out (vty, "%s", VTY_NEWLINE);
987
vty_show_prefix_list (struct vty *vty, afi_t afi, char *name,
988
char *seq, enum display_type dtype)
990
struct prefix_list *plist;
991
struct prefix_master *master;
994
master = prefix_master_get (afi);
1003
plist = prefix_list_lookup (afi, name);
1006
vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
1009
vty_show_prefix_entry (vty, afi, plist, master, dtype, seqnum);
1013
if (dtype == detail_display || dtype == summary_display)
1016
vty_out (vty, "Prefix-list with the last deletion/insertion: %s%s",
1017
master->recent->name, VTY_NEWLINE);
1020
for (plist = master->num.head; plist; plist = plist->next)
1021
vty_show_prefix_entry (vty, afi, plist, master, dtype, seqnum);
1023
for (plist = master->str.head; plist; plist = plist->next)
1024
vty_show_prefix_entry (vty, afi, plist, master, dtype, seqnum);
1031
vty_show_prefix_list_prefix (struct vty *vty, afi_t afi, char *name,
1032
char *prefix, enum display_type type)
1034
struct prefix_list *plist;
1035
struct prefix_list_entry *pentry;
1040
plist = prefix_list_lookup (afi, name);
1043
vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
1047
ret = str2prefix (prefix, &p);
1050
vty_out (vty, "%% prefix is malformed%s", VTY_NEWLINE);
1054
for (pentry = plist->head; pentry; pentry = pentry->next)
1058
if (type == normal_display || type == first_match_display)
1059
if (prefix_same (&p, &pentry->prefix))
1062
if (type == longer_display)
1063
if (prefix_match (&p, &pentry->prefix))
1068
vty_out (vty, " seq %d %s ",
1070
prefix_list_type_str (pentry));
1073
vty_out (vty, "any");
1076
struct prefix *p = &pentry->prefix;
1079
vty_out (vty, "%s/%d",
1080
inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
1084
vty_out (vty, " ge %d", pentry->ge);
1086
vty_out (vty, " le %d", pentry->le);
1089
if (type == normal_display || type == first_match_display)
1090
vty_out (vty, " (hit count: %ld, refcount: %ld)",
1091
pentry->hitcnt, pentry->refcnt);
1093
vty_out (vty, "%s", VTY_NEWLINE);
1095
if (type == first_match_display)
1103
vty_clear_prefix_list (struct vty *vty, afi_t afi, char *name, char *prefix)
1105
struct prefix_master *master;
1106
struct prefix_list *plist;
1107
struct prefix_list_entry *pentry;
1111
master = prefix_master_get (afi);
1115
if (name == NULL && prefix == NULL)
1117
for (plist = master->num.head; plist; plist = plist->next)
1118
for (pentry = plist->head; pentry; pentry = pentry->next)
1121
for (plist = master->str.head; plist; plist = plist->next)
1122
for (pentry = plist->head; pentry; pentry = pentry->next)
1127
plist = prefix_list_lookup (afi, name);
1130
vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
1136
ret = str2prefix (prefix, &p);
1139
vty_out (vty, "%% prefix is malformed%s", VTY_NEWLINE);
1144
for (pentry = plist->head; pentry; pentry = pentry->next)
1148
if (prefix_match (&pentry->prefix, &p))
1158
DEFUN (ip_prefix_list,
1160
"ip prefix-list WORD (deny|permit) (A.B.C.D/M|any)",
1163
"Name of a prefix list\n"
1164
"Specify packets to reject\n"
1165
"Specify packets to forward\n"
1166
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1167
"Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
1169
return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL,
1170
argv[1], argv[2], NULL, NULL);
1173
DEFUN (ip_prefix_list_ge,
1174
ip_prefix_list_ge_cmd,
1175
"ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32>",
1178
"Name of a prefix list\n"
1179
"Specify packets to reject\n"
1180
"Specify packets to forward\n"
1181
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1182
"Minimum prefix length to be matched\n"
1183
"Minimum prefix length\n")
1185
return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1],
1186
argv[2], argv[3], NULL);
1189
DEFUN (ip_prefix_list_ge_le,
1190
ip_prefix_list_ge_le_cmd,
1191
"ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32> le <0-32>",
1194
"Name of a prefix list\n"
1195
"Specify packets to reject\n"
1196
"Specify packets to forward\n"
1197
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1198
"Minimum prefix length to be matched\n"
1199
"Minimum prefix length\n"
1200
"Maximum prefix length to be matched\n"
1201
"Maximum prefix length\n")
1203
return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1],
1204
argv[2], argv[3], argv[4]);
1207
DEFUN (ip_prefix_list_le,
1208
ip_prefix_list_le_cmd,
1209
"ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32>",
1212
"Name of a prefix list\n"
1213
"Specify packets to reject\n"
1214
"Specify packets to forward\n"
1215
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1216
"Maximum prefix length to be matched\n"
1217
"Maximum prefix length\n")
1219
return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1],
1220
argv[2], NULL, argv[3]);
1223
DEFUN (ip_prefix_list_le_ge,
1224
ip_prefix_list_le_ge_cmd,
1225
"ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32> ge <0-32>",
1228
"Name of a prefix list\n"
1229
"Specify packets to reject\n"
1230
"Specify packets to forward\n"
1231
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1232
"Maximum prefix length to be matched\n"
1233
"Maximum prefix length\n"
1234
"Minimum prefix length to be matched\n"
1235
"Minimum prefix length\n")
1237
return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1],
1238
argv[2], argv[4], argv[3]);
1241
DEFUN (ip_prefix_list_seq,
1242
ip_prefix_list_seq_cmd,
1243
"ip prefix-list WORD seq <1-4294967295> (deny|permit) (A.B.C.D/M|any)",
1246
"Name of a prefix list\n"
1247
"sequence number of an entry\n"
1249
"Specify packets to reject\n"
1250
"Specify packets to forward\n"
1251
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1252
"Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
1254
return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1255
argv[3], NULL, NULL);
1258
DEFUN (ip_prefix_list_seq_ge,
1259
ip_prefix_list_seq_ge_cmd,
1260
"ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32>",
1263
"Name of a prefix list\n"
1264
"sequence number of an entry\n"
1266
"Specify packets to reject\n"
1267
"Specify packets to forward\n"
1268
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1269
"Minimum prefix length to be matched\n"
1270
"Minimum prefix length\n")
1272
return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1273
argv[3], argv[4], NULL);
1276
DEFUN (ip_prefix_list_seq_ge_le,
1277
ip_prefix_list_seq_ge_le_cmd,
1278
"ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32> le <0-32>",
1281
"Name of a prefix list\n"
1282
"sequence number of an entry\n"
1284
"Specify packets to reject\n"
1285
"Specify packets to forward\n"
1286
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1287
"Minimum prefix length to be matched\n"
1288
"Minimum prefix length\n"
1289
"Maximum prefix length to be matched\n"
1290
"Maximum prefix length\n")
1292
return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1293
argv[3], argv[4], argv[5]);
1296
DEFUN (ip_prefix_list_seq_le,
1297
ip_prefix_list_seq_le_cmd,
1298
"ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32>",
1301
"Name of a prefix list\n"
1302
"sequence number of an entry\n"
1304
"Specify packets to reject\n"
1305
"Specify packets to forward\n"
1306
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1307
"Maximum prefix length to be matched\n"
1308
"Maximum prefix length\n")
1310
return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1311
argv[3], NULL, argv[4]);
1314
DEFUN (ip_prefix_list_seq_le_ge,
1315
ip_prefix_list_seq_le_ge_cmd,
1316
"ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32> ge <0-32>",
1319
"Name of a prefix list\n"
1320
"sequence number of an entry\n"
1322
"Specify packets to reject\n"
1323
"Specify packets to forward\n"
1324
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1325
"Maximum prefix length to be matched\n"
1326
"Maximum prefix length\n"
1327
"Minimum prefix length to be matched\n"
1328
"Minimum prefix length\n")
1330
return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2],
1331
argv[3], argv[5], argv[4]);
1334
DEFUN (no_ip_prefix_list,
1335
no_ip_prefix_list_cmd,
1336
"no ip prefix-list WORD",
1340
"Name of a prefix list\n")
1342
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, NULL,
1346
DEFUN (no_ip_prefix_list_prefix,
1347
no_ip_prefix_list_prefix_cmd,
1348
"no ip prefix-list WORD (deny|permit) (A.B.C.D/M|any)",
1352
"Name of a prefix list\n"
1353
"Specify packets to reject\n"
1354
"Specify packets to forward\n"
1355
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1356
"Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
1358
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1359
argv[2], NULL, NULL);
1362
DEFUN (no_ip_prefix_list_ge,
1363
no_ip_prefix_list_ge_cmd,
1364
"no ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32>",
1368
"Name of a prefix list\n"
1369
"Specify packets to reject\n"
1370
"Specify packets to forward\n"
1371
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1372
"Minimum prefix length to be matched\n"
1373
"Minimum prefix length\n")
1375
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1376
argv[2], argv[3], NULL);
1379
DEFUN (no_ip_prefix_list_ge_le,
1380
no_ip_prefix_list_ge_le_cmd,
1381
"no ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32> le <0-32>",
1385
"Name of a prefix list\n"
1386
"Specify packets to reject\n"
1387
"Specify packets to forward\n"
1388
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1389
"Minimum prefix length to be matched\n"
1390
"Minimum prefix length\n"
1391
"Maximum prefix length to be matched\n"
1392
"Maximum prefix length\n")
1394
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1395
argv[2], argv[3], argv[4]);
1398
DEFUN (no_ip_prefix_list_le,
1399
no_ip_prefix_list_le_cmd,
1400
"no ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32>",
1404
"Name of a prefix list\n"
1405
"Specify packets to reject\n"
1406
"Specify packets to forward\n"
1407
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1408
"Maximum prefix length to be matched\n"
1409
"Maximum prefix length\n")
1411
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1412
argv[2], NULL, argv[3]);
1415
DEFUN (no_ip_prefix_list_le_ge,
1416
no_ip_prefix_list_le_ge_cmd,
1417
"no ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32> ge <0-32>",
1421
"Name of a prefix list\n"
1422
"Specify packets to reject\n"
1423
"Specify packets to forward\n"
1424
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1425
"Maximum prefix length to be matched\n"
1426
"Maximum prefix length\n"
1427
"Minimum prefix length to be matched\n"
1428
"Minimum prefix length\n")
1430
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1],
1431
argv[2], argv[4], argv[3]);
1434
DEFUN (no_ip_prefix_list_seq,
1435
no_ip_prefix_list_seq_cmd,
1436
"no ip prefix-list WORD seq <1-4294967295> (deny|permit) (A.B.C.D/M|any)",
1440
"Name of a prefix list\n"
1441
"sequence number of an entry\n"
1443
"Specify packets to reject\n"
1444
"Specify packets to forward\n"
1445
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1446
"Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
1448
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1449
argv[3], NULL, NULL);
1452
DEFUN (no_ip_prefix_list_seq_ge,
1453
no_ip_prefix_list_seq_ge_cmd,
1454
"no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32>",
1458
"Name of a prefix list\n"
1459
"sequence number of an entry\n"
1461
"Specify packets to reject\n"
1462
"Specify packets to forward\n"
1463
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1464
"Minimum prefix length to be matched\n"
1465
"Minimum prefix length\n")
1467
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1468
argv[3], argv[4], NULL);
1471
DEFUN (no_ip_prefix_list_seq_ge_le,
1472
no_ip_prefix_list_seq_ge_le_cmd,
1473
"no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32> le <0-32>",
1477
"Name of a prefix list\n"
1478
"sequence number of an entry\n"
1480
"Specify packets to reject\n"
1481
"Specify packets to forward\n"
1482
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1483
"Minimum prefix length to be matched\n"
1484
"Minimum prefix length\n"
1485
"Maximum prefix length to be matched\n"
1486
"Maximum prefix length\n")
1488
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1489
argv[3], argv[4], argv[5]);
1492
DEFUN (no_ip_prefix_list_seq_le,
1493
no_ip_prefix_list_seq_le_cmd,
1494
"no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32>",
1498
"Name of a prefix list\n"
1499
"sequence number of an entry\n"
1501
"Specify packets to reject\n"
1502
"Specify packets to forward\n"
1503
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1504
"Maximum prefix length to be matched\n"
1505
"Maximum prefix length\n")
1507
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1508
argv[3], NULL, argv[4]);
1511
DEFUN (no_ip_prefix_list_seq_le_ge,
1512
no_ip_prefix_list_seq_le_ge_cmd,
1513
"no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32> ge <0-32>",
1517
"Name of a prefix list\n"
1518
"sequence number of an entry\n"
1520
"Specify packets to reject\n"
1521
"Specify packets to forward\n"
1522
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1523
"Maximum prefix length to be matched\n"
1524
"Maximum prefix length\n"
1525
"Minimum prefix length to be matched\n"
1526
"Minimum prefix length\n")
1528
return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2],
1529
argv[3], argv[5], argv[4]);
1532
DEFUN (ip_prefix_list_sequence_number,
1533
ip_prefix_list_sequence_number_cmd,
1534
"ip prefix-list sequence-number",
1537
"Include/exclude sequence numbers in NVGEN\n")
1539
prefix_master_ipv4.seqnum = 1;
1543
DEFUN (no_ip_prefix_list_sequence_number,
1544
no_ip_prefix_list_sequence_number_cmd,
1545
"no ip prefix-list sequence-number",
1549
"Include/exclude sequence numbers in NVGEN\n")
1551
prefix_master_ipv4.seqnum = 0;
1555
DEFUN (ip_prefix_list_description,
1556
ip_prefix_list_description_cmd,
1557
"ip prefix-list WORD description .LINE",
1560
"Name of a prefix list\n"
1561
"Prefix-list specific description\n"
1562
"Up to 80 characters describing this prefix-list\n")
1564
struct prefix_list *plist;
1568
plist = prefix_list_get (AFI_IP, argv[0]);
1572
XFREE (MTYPE_TMP, plist->desc);
1576
/* Below is description get codes. */
1577
b = buffer_new (1024);
1578
for (i = 1; i < argc; i++)
1580
buffer_putstr (b, (u_char *)argv[i]);
1581
buffer_putc (b, ' ');
1583
buffer_putc (b, '\0');
1585
plist->desc = buffer_getstr (b);
1592
DEFUN (no_ip_prefix_list_description,
1593
no_ip_prefix_list_description_cmd,
1594
"no ip prefix-list WORD description",
1598
"Name of a prefix list\n"
1599
"Prefix-list specific description\n")
1601
return vty_prefix_list_desc_unset (vty, AFI_IP, argv[0]);
1604
ALIAS (no_ip_prefix_list_description,
1605
no_ip_prefix_list_description_arg_cmd,
1606
"no ip prefix-list WORD description .LINE",
1610
"Name of a prefix list\n"
1611
"Prefix-list specific description\n"
1612
"Up to 80 characters describing this prefix-list\n")
1614
DEFUN (show_ip_prefix_list,
1615
show_ip_prefix_list_cmd,
1616
"show ip prefix-list",
1621
return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, normal_display);
1624
DEFUN (show_ip_prefix_list_name,
1625
show_ip_prefix_list_name_cmd,
1626
"show ip prefix-list WORD",
1630
"Name of a prefix list\n")
1632
return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, normal_display);
1635
DEFUN (show_ip_prefix_list_name_seq,
1636
show_ip_prefix_list_name_seq_cmd,
1637
"show ip prefix-list WORD seq <1-4294967295>",
1641
"Name of a prefix list\n"
1642
"sequence number of an entry\n"
1643
"Sequence number\n")
1645
return vty_show_prefix_list (vty, AFI_IP, argv[0], argv[1], sequential_display);
1648
DEFUN (show_ip_prefix_list_prefix,
1649
show_ip_prefix_list_prefix_cmd,
1650
"show ip prefix-list WORD A.B.C.D/M",
1654
"Name of a prefix list\n"
1655
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
1657
return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], normal_display);
1660
DEFUN (show_ip_prefix_list_prefix_longer,
1661
show_ip_prefix_list_prefix_longer_cmd,
1662
"show ip prefix-list WORD A.B.C.D/M longer",
1666
"Name of a prefix list\n"
1667
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1668
"Lookup longer prefix\n")
1670
return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], longer_display);
1673
DEFUN (show_ip_prefix_list_prefix_first_match,
1674
show_ip_prefix_list_prefix_first_match_cmd,
1675
"show ip prefix-list WORD A.B.C.D/M first-match",
1679
"Name of a prefix list\n"
1680
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1681
"First matched prefix\n")
1683
return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], first_match_display);
1686
DEFUN (show_ip_prefix_list_summary,
1687
show_ip_prefix_list_summary_cmd,
1688
"show ip prefix-list summary",
1692
"Summary of prefix lists\n")
1694
return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, summary_display);
1697
DEFUN (show_ip_prefix_list_summary_name,
1698
show_ip_prefix_list_summary_name_cmd,
1699
"show ip prefix-list summary WORD",
1703
"Summary of prefix lists\n"
1704
"Name of a prefix list\n")
1706
return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, summary_display);
1710
DEFUN (show_ip_prefix_list_detail,
1711
show_ip_prefix_list_detail_cmd,
1712
"show ip prefix-list detail",
1716
"Detail of prefix lists\n")
1718
return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, detail_display);
1721
DEFUN (show_ip_prefix_list_detail_name,
1722
show_ip_prefix_list_detail_name_cmd,
1723
"show ip prefix-list detail WORD",
1727
"Detail of prefix lists\n"
1728
"Name of a prefix list\n")
1730
return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, detail_display);
1733
DEFUN (clear_ip_prefix_list,
1734
clear_ip_prefix_list_cmd,
1735
"clear ip prefix-list",
1740
return vty_clear_prefix_list (vty, AFI_IP, NULL, NULL);
1743
DEFUN (clear_ip_prefix_list_name,
1744
clear_ip_prefix_list_name_cmd,
1745
"clear ip prefix-list WORD",
1749
"Name of a prefix list\n")
1751
return vty_clear_prefix_list (vty, AFI_IP, argv[0], NULL);
1754
DEFUN (clear_ip_prefix_list_name_prefix,
1755
clear_ip_prefix_list_name_prefix_cmd,
1756
"clear ip prefix-list WORD A.B.C.D/M",
1760
"Name of a prefix list\n"
1761
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
1763
return vty_clear_prefix_list (vty, AFI_IP, argv[0], argv[1]);
1767
DEFUN (ipv6_prefix_list,
1768
ipv6_prefix_list_cmd,
1769
"ipv6 prefix-list WORD (deny|permit) (X:X::X:X/M|any)",
1772
"Name of a prefix list\n"
1773
"Specify packets to reject\n"
1774
"Specify packets to forward\n"
1775
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1776
"Any prefix match. Same as \"::0/0 le 128\"\n")
1778
return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL,
1779
argv[1], argv[2], NULL, NULL);
1782
DEFUN (ipv6_prefix_list_ge,
1783
ipv6_prefix_list_ge_cmd,
1784
"ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128>",
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
"Minimum prefix length to be matched\n"
1792
"Minimum prefix length\n")
1794
return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1],
1795
argv[2], argv[3], NULL);
1798
DEFUN (ipv6_prefix_list_ge_le,
1799
ipv6_prefix_list_ge_le_cmd,
1800
"ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128> le <0-128>",
1803
"Name of a prefix list\n"
1804
"Specify packets to reject\n"
1805
"Specify packets to forward\n"
1806
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1807
"Minimum prefix length to be matched\n"
1808
"Minimum prefix length\n"
1809
"Maximum prefix length to be matched\n"
1810
"Maximum prefix length\n")
1813
return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1],
1814
argv[2], argv[3], argv[4]);
1817
DEFUN (ipv6_prefix_list_le,
1818
ipv6_prefix_list_le_cmd,
1819
"ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128>",
1822
"Name of a prefix list\n"
1823
"Specify packets to reject\n"
1824
"Specify packets to forward\n"
1825
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1826
"Maximum prefix length to be matched\n"
1827
"Maximum prefix length\n")
1829
return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1],
1830
argv[2], NULL, argv[3]);
1833
DEFUN (ipv6_prefix_list_le_ge,
1834
ipv6_prefix_list_le_ge_cmd,
1835
"ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128> ge <0-128>",
1838
"Name of a prefix list\n"
1839
"Specify packets to reject\n"
1840
"Specify packets to forward\n"
1841
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1842
"Maximum prefix length to be matched\n"
1843
"Maximum prefix length\n"
1844
"Minimum prefix length to be matched\n"
1845
"Minimum prefix length\n")
1847
return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1],
1848
argv[2], argv[4], argv[3]);
1851
DEFUN (ipv6_prefix_list_seq,
1852
ipv6_prefix_list_seq_cmd,
1853
"ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) (X:X::X:X/M|any)",
1856
"Name of a prefix list\n"
1857
"sequence number of an entry\n"
1859
"Specify packets to reject\n"
1860
"Specify packets to forward\n"
1861
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1862
"Any prefix match. Same as \"::0/0 le 128\"\n")
1864
return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1865
argv[3], NULL, NULL);
1868
DEFUN (ipv6_prefix_list_seq_ge,
1869
ipv6_prefix_list_seq_ge_cmd,
1870
"ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128>",
1873
"Name of a prefix list\n"
1874
"sequence number of an entry\n"
1876
"Specify packets to reject\n"
1877
"Specify packets to forward\n"
1878
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1879
"Minimum prefix length to be matched\n"
1880
"Minimum prefix length\n")
1882
return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1883
argv[3], argv[4], NULL);
1886
DEFUN (ipv6_prefix_list_seq_ge_le,
1887
ipv6_prefix_list_seq_ge_le_cmd,
1888
"ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128> le <0-128>",
1891
"Name of a prefix list\n"
1892
"sequence number of an entry\n"
1894
"Specify packets to reject\n"
1895
"Specify packets to forward\n"
1896
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1897
"Minimum prefix length to be matched\n"
1898
"Minimum prefix length\n"
1899
"Maximum prefix length to be matched\n"
1900
"Maximum prefix length\n")
1902
return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1903
argv[3], argv[4], argv[5]);
1906
DEFUN (ipv6_prefix_list_seq_le,
1907
ipv6_prefix_list_seq_le_cmd,
1908
"ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128>",
1911
"Name of a prefix list\n"
1912
"sequence number of an entry\n"
1914
"Specify packets to reject\n"
1915
"Specify packets to forward\n"
1916
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1917
"Maximum prefix length to be matched\n"
1918
"Maximum prefix length\n")
1920
return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1921
argv[3], NULL, argv[4]);
1924
DEFUN (ipv6_prefix_list_seq_le_ge,
1925
ipv6_prefix_list_seq_le_ge_cmd,
1926
"ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128> ge <0-128>",
1929
"Name of a prefix list\n"
1930
"sequence number of an entry\n"
1932
"Specify packets to reject\n"
1933
"Specify packets to forward\n"
1934
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1935
"Maximum prefix length to be matched\n"
1936
"Maximum prefix length\n"
1937
"Minimum prefix length to be matched\n"
1938
"Minimum prefix length\n")
1940
return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2],
1941
argv[3], argv[5], argv[4]);
1944
DEFUN (no_ipv6_prefix_list,
1945
no_ipv6_prefix_list_cmd,
1946
"no ipv6 prefix-list WORD",
1950
"Name of a prefix list\n")
1952
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, NULL,
1956
DEFUN (no_ipv6_prefix_list_prefix,
1957
no_ipv6_prefix_list_prefix_cmd,
1958
"no ipv6 prefix-list WORD (deny|permit) (X:X::X:X/M|any)",
1962
"Name of a prefix list\n"
1963
"Specify packets to reject\n"
1964
"Specify packets to forward\n"
1965
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1966
"Any prefix match. Same as \"::0/0 le 128\"\n")
1968
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
1969
argv[2], NULL, NULL);
1972
DEFUN (no_ipv6_prefix_list_ge,
1973
no_ipv6_prefix_list_ge_cmd,
1974
"no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128>",
1978
"Name of a prefix list\n"
1979
"Specify packets to reject\n"
1980
"Specify packets to forward\n"
1981
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1982
"Minimum prefix length to be matched\n"
1983
"Minimum prefix length\n")
1985
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
1986
argv[2], argv[3], NULL);
1989
DEFUN (no_ipv6_prefix_list_ge_le,
1990
no_ipv6_prefix_list_ge_le_cmd,
1991
"no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128> le <0-128>",
1995
"Name of a prefix list\n"
1996
"Specify packets to reject\n"
1997
"Specify packets to forward\n"
1998
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
1999
"Minimum prefix length to be matched\n"
2000
"Minimum prefix length\n"
2001
"Maximum prefix length to be matched\n"
2002
"Maximum prefix length\n")
2004
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
2005
argv[2], argv[3], argv[4]);
2008
DEFUN (no_ipv6_prefix_list_le,
2009
no_ipv6_prefix_list_le_cmd,
2010
"no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128>",
2014
"Name of a prefix list\n"
2015
"Specify packets to reject\n"
2016
"Specify packets to forward\n"
2017
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2018
"Maximum prefix length to be matched\n"
2019
"Maximum prefix length\n")
2021
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
2022
argv[2], NULL, argv[3]);
2025
DEFUN (no_ipv6_prefix_list_le_ge,
2026
no_ipv6_prefix_list_le_ge_cmd,
2027
"no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128> ge <0-128>",
2031
"Name of a prefix list\n"
2032
"Specify packets to reject\n"
2033
"Specify packets to forward\n"
2034
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2035
"Maximum prefix length to be matched\n"
2036
"Maximum prefix length\n"
2037
"Minimum prefix length to be matched\n"
2038
"Minimum prefix length\n")
2040
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1],
2041
argv[2], argv[4], argv[3]);
2044
DEFUN (no_ipv6_prefix_list_seq,
2045
no_ipv6_prefix_list_seq_cmd,
2046
"no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) (X:X::X:X/M|any)",
2050
"Name of a prefix list\n"
2051
"sequence number of an entry\n"
2053
"Specify packets to reject\n"
2054
"Specify packets to forward\n"
2055
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2056
"Any prefix match. Same as \"::0/0 le 128\"\n")
2058
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2059
argv[3], NULL, NULL);
2062
DEFUN (no_ipv6_prefix_list_seq_ge,
2063
no_ipv6_prefix_list_seq_ge_cmd,
2064
"no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128>",
2068
"Name of a prefix list\n"
2069
"sequence number of an entry\n"
2071
"Specify packets to reject\n"
2072
"Specify packets to forward\n"
2073
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2074
"Minimum prefix length to be matched\n"
2075
"Minimum prefix length\n")
2077
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2078
argv[3], argv[4], NULL);
2081
DEFUN (no_ipv6_prefix_list_seq_ge_le,
2082
no_ipv6_prefix_list_seq_ge_le_cmd,
2083
"no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128> le <0-128>",
2087
"Name of a prefix list\n"
2088
"sequence number of an entry\n"
2090
"Specify packets to reject\n"
2091
"Specify packets to forward\n"
2092
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2093
"Minimum prefix length to be matched\n"
2094
"Minimum prefix length\n"
2095
"Maximum prefix length to be matched\n"
2096
"Maximum prefix length\n")
2098
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2099
argv[3], argv[4], argv[5]);
2102
DEFUN (no_ipv6_prefix_list_seq_le,
2103
no_ipv6_prefix_list_seq_le_cmd,
2104
"no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128>",
2108
"Name of a prefix list\n"
2109
"sequence number of an entry\n"
2111
"Specify packets to reject\n"
2112
"Specify packets to forward\n"
2113
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2114
"Maximum prefix length to be matched\n"
2115
"Maximum prefix length\n")
2117
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2118
argv[3], NULL, argv[4]);
2121
DEFUN (no_ipv6_prefix_list_seq_le_ge,
2122
no_ipv6_prefix_list_seq_le_ge_cmd,
2123
"no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128> ge <0-128>",
2127
"Name of a prefix list\n"
2128
"sequence number of an entry\n"
2130
"Specify packets to reject\n"
2131
"Specify packets to forward\n"
2132
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2133
"Maximum prefix length to be matched\n"
2134
"Maximum prefix length\n"
2135
"Minimum prefix length to be matched\n"
2136
"Minimum prefix length\n")
2138
return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2],
2139
argv[3], argv[5], argv[4]);
2142
DEFUN (ipv6_prefix_list_sequence_number,
2143
ipv6_prefix_list_sequence_number_cmd,
2144
"ipv6 prefix-list sequence-number",
2147
"Include/exclude sequence numbers in NVGEN\n")
2149
prefix_master_ipv6.seqnum = 1;
2153
DEFUN (no_ipv6_prefix_list_sequence_number,
2154
no_ipv6_prefix_list_sequence_number_cmd,
2155
"no ipv6 prefix-list sequence-number",
2159
"Include/exclude sequence numbers in NVGEN\n")
2161
prefix_master_ipv6.seqnum = 0;
2165
DEFUN (ipv6_prefix_list_description,
2166
ipv6_prefix_list_description_cmd,
2167
"ipv6 prefix-list WORD description .LINE",
2170
"Name of a prefix list\n"
2171
"Prefix-list specific description\n"
2172
"Up to 80 characters describing this prefix-list\n")
2174
struct prefix_list *plist;
2178
plist = prefix_list_get (AFI_IP6, argv[0]);
2182
XFREE (MTYPE_TMP, plist->desc);
2186
/* Below is description get codes. */
2187
b = buffer_new (1024);
2188
for (i = 1; i < argc; i++)
2190
buffer_putstr (b, (u_char *)argv[i]);
2191
buffer_putc (b, ' ');
2193
buffer_putc (b, '\0');
2195
plist->desc = buffer_getstr (b);
2202
DEFUN (no_ipv6_prefix_list_description,
2203
no_ipv6_prefix_list_description_cmd,
2204
"no ipv6 prefix-list WORD description",
2208
"Name of a prefix list\n"
2209
"Prefix-list specific description\n")
2211
return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[0]);
2214
ALIAS (no_ipv6_prefix_list_description,
2215
no_ipv6_prefix_list_description_arg_cmd,
2216
"no ipv6 prefix-list WORD description .LINE",
2220
"Name of a prefix list\n"
2221
"Prefix-list specific description\n"
2222
"Up to 80 characters describing this prefix-list\n")
2224
DEFUN (show_ipv6_prefix_list,
2225
show_ipv6_prefix_list_cmd,
2226
"show ipv6 prefix-list",
2231
return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, normal_display);
2234
DEFUN (show_ipv6_prefix_list_name,
2235
show_ipv6_prefix_list_name_cmd,
2236
"show ipv6 prefix-list WORD",
2240
"Name of a prefix list\n")
2242
return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, normal_display);
2245
DEFUN (show_ipv6_prefix_list_name_seq,
2246
show_ipv6_prefix_list_name_seq_cmd,
2247
"show ipv6 prefix-list WORD seq <1-4294967295>",
2251
"Name of a prefix list\n"
2252
"sequence number of an entry\n"
2253
"Sequence number\n")
2255
return vty_show_prefix_list (vty, AFI_IP6, argv[0], argv[1], sequential_display);
2258
DEFUN (show_ipv6_prefix_list_prefix,
2259
show_ipv6_prefix_list_prefix_cmd,
2260
"show ipv6 prefix-list WORD X:X::X:X/M",
2264
"Name of a prefix list\n"
2265
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
2267
return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], normal_display);
2270
DEFUN (show_ipv6_prefix_list_prefix_longer,
2271
show_ipv6_prefix_list_prefix_longer_cmd,
2272
"show ipv6 prefix-list WORD X:X::X:X/M longer",
2276
"Name of a prefix list\n"
2277
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2278
"Lookup longer prefix\n")
2280
return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], longer_display);
2283
DEFUN (show_ipv6_prefix_list_prefix_first_match,
2284
show_ipv6_prefix_list_prefix_first_match_cmd,
2285
"show ipv6 prefix-list WORD X:X::X:X/M first-match",
2289
"Name of a prefix list\n"
2290
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
2291
"First matched prefix\n")
2293
return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], first_match_display);
2296
DEFUN (show_ipv6_prefix_list_summary,
2297
show_ipv6_prefix_list_summary_cmd,
2298
"show ipv6 prefix-list summary",
2302
"Summary of prefix lists\n")
2304
return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, summary_display);
2307
DEFUN (show_ipv6_prefix_list_summary_name,
2308
show_ipv6_prefix_list_summary_name_cmd,
2309
"show ipv6 prefix-list summary WORD",
2313
"Summary of prefix lists\n"
2314
"Name of a prefix list\n")
2316
return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, summary_display);
2319
DEFUN (show_ipv6_prefix_list_detail,
2320
show_ipv6_prefix_list_detail_cmd,
2321
"show ipv6 prefix-list detail",
2325
"Detail of prefix lists\n")
2327
return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, detail_display);
2330
DEFUN (show_ipv6_prefix_list_detail_name,
2331
show_ipv6_prefix_list_detail_name_cmd,
2332
"show ipv6 prefix-list detail WORD",
2336
"Detail of prefix lists\n"
2337
"Name of a prefix list\n")
2339
return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, detail_display);
2342
DEFUN (clear_ipv6_prefix_list,
2343
clear_ipv6_prefix_list_cmd,
2344
"clear ipv6 prefix-list",
2349
return vty_clear_prefix_list (vty, AFI_IP6, NULL, NULL);
2352
DEFUN (clear_ipv6_prefix_list_name,
2353
clear_ipv6_prefix_list_name_cmd,
2354
"clear ipv6 prefix-list WORD",
2358
"Name of a prefix list\n")
2360
return vty_clear_prefix_list (vty, AFI_IP6, argv[0], NULL);
2363
DEFUN (clear_ipv6_prefix_list_name_prefix,
2364
clear_ipv6_prefix_list_name_prefix_cmd,
2365
"clear ipv6 prefix-list WORD X:X::X:X/M",
2369
"Name of a prefix list\n"
2370
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
2372
return vty_clear_prefix_list (vty, AFI_IP6, argv[0], argv[1]);
2374
#endif /* HAVE_IPV6 */
2376
/* Configuration write function. */
2378
config_write_prefix_afi (afi_t afi, struct vty *vty)
2380
struct prefix_list *plist;
2381
struct prefix_list_entry *pentry;
2382
struct prefix_master *master;
2385
master = prefix_master_get (afi);
2389
if (! master->seqnum)
2391
vty_out (vty, "no ip%s prefix-list sequence-number%s",
2392
afi == AFI_IP ? "" : "v6", VTY_NEWLINE);
2393
vty_out (vty, "!%s", VTY_NEWLINE);
2396
for (plist = master->num.head; plist; plist = plist->next)
2400
vty_out (vty, "ip%s prefix-list %s description %s%s",
2401
afi == AFI_IP ? "" : "v6",
2402
plist->name, plist->desc, VTY_NEWLINE);
2406
for (pentry = plist->head; pentry; pentry = pentry->next)
2408
vty_out (vty, "ip%s prefix-list %s ",
2409
afi == AFI_IP ? "" : "v6",
2413
vty_out (vty, "seq %d ", pentry->seq);
2415
vty_out (vty, "%s ", prefix_list_type_str (pentry));
2418
vty_out (vty, "any");
2421
struct prefix *p = &pentry->prefix;
2424
vty_out (vty, "%s/%d",
2425
inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
2429
vty_out (vty, " ge %d", pentry->ge);
2431
vty_out (vty, " le %d", pentry->le);
2433
vty_out (vty, "%s", VTY_NEWLINE);
2436
/* vty_out (vty, "!%s", VTY_NEWLINE); */
2439
for (plist = master->str.head; plist; plist = plist->next)
2443
vty_out (vty, "ip%s prefix-list %s description %s%s",
2444
afi == AFI_IP ? "" : "v6",
2445
plist->name, plist->desc, VTY_NEWLINE);
2449
for (pentry = plist->head; pentry; pentry = pentry->next)
2451
vty_out (vty, "ip%s prefix-list %s ",
2452
afi == AFI_IP ? "" : "v6",
2456
vty_out (vty, "seq %d ", pentry->seq);
2458
vty_out (vty, "%s", prefix_list_type_str (pentry));
2461
vty_out (vty, " any");
2464
struct prefix *p = &pentry->prefix;
2467
vty_out (vty, " %s/%d",
2468
inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
2472
vty_out (vty, " ge %d", pentry->ge);
2474
vty_out (vty, " le %d", pentry->le);
2476
vty_out (vty, "%s", VTY_NEWLINE);
2484
int stream_putc (struct stream *, u_char);
2485
int stream_putl (struct stream *, u_int32_t);
2486
int stream_put_prefix (struct stream *, struct prefix *);
2489
prefix_bgp_orf_entry (struct stream *s, struct prefix_list *plist,
2490
u_char init_flag, u_char permit_flag, u_char deny_flag)
2492
struct prefix_list_entry *pentry;
2497
for (pentry = plist->head; pentry; pentry = pentry->next)
2499
u_char flag = init_flag;
2500
struct prefix *p = &pentry->prefix;
2502
flag |= (pentry->type == PREFIX_PERMIT ?
2503
permit_flag : deny_flag);
2504
stream_putc (s, flag);
2505
stream_putl (s, (u_int32_t)pentry->seq);
2506
stream_putc (s, (u_char)pentry->ge);
2507
stream_putc (s, (u_char)pentry->le);
2508
stream_put_prefix (s, p);
2515
prefix_bgp_orf_set (char *name, afi_t afi, struct orf_prefix *orfp,
2516
int permit, int set)
2518
struct prefix_list *plist;
2519
struct prefix_list_entry *pentry;
2521
/* ge and le value check */
2522
if (orfp->ge && orfp->ge <= orfp->p.prefixlen)
2524
if (orfp->le && orfp->le <= orfp->p.prefixlen)
2526
if (orfp->le && orfp->ge > orfp->le)
2529
if (orfp->ge && orfp->le == (afi == AFI_IP ? 32 : 128))
2532
plist = prefix_list_get (AFI_ORF_PREFIX, name);
2538
pentry = prefix_list_entry_make (&orfp->p,
2539
(permit ? PREFIX_PERMIT : PREFIX_DENY),
2540
orfp->seq, orfp->le, orfp->ge, 0);
2542
if (prefix_entry_dup_check (plist, pentry))
2544
prefix_list_entry_free (pentry);
2548
prefix_list_entry_add (plist, pentry);
2552
pentry = prefix_list_entry_lookup (plist, &orfp->p,
2553
(permit ? PREFIX_PERMIT : PREFIX_DENY),
2554
orfp->seq, orfp->le, orfp->ge);
2559
prefix_list_entry_delete (plist, pentry, 1);
2566
prefix_bgp_orf_remove_all (char *name)
2568
struct prefix_list *plist;
2570
plist = prefix_list_lookup (AFI_ORF_PREFIX, name);
2572
prefix_list_delete (plist);
2575
/* return prefix count */
2577
prefix_bgp_show_prefix_list (struct vty *vty, afi_t afi, char *name)
2579
struct prefix_list *plist;
2580
struct prefix_list_entry *pentry;
2582
plist = prefix_list_lookup (AFI_ORF_PREFIX, name);
2587
return plist->count;
2589
vty_out (vty, "ip%s prefix-list %s: %d entries%s",
2590
afi == AFI_IP ? "" : "v6",
2591
plist->name, plist->count, VTY_NEWLINE);
2593
for (pentry = plist->head; pentry; pentry = pentry->next)
2595
struct prefix *p = &pentry->prefix;
2598
vty_out (vty, " seq %d %s %s/%d", pentry->seq,
2599
prefix_list_type_str (pentry),
2600
inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
2604
vty_out (vty, " ge %d", pentry->ge);
2606
vty_out (vty, " le %d", pentry->le);
2608
vty_out (vty, "%s", VTY_NEWLINE);
2610
return plist->count;
2614
prefix_list_reset_orf ()
2616
struct prefix_list *plist;
2617
struct prefix_list *next;
2618
struct prefix_master *master;
2620
master = prefix_master_get (AFI_ORF_PREFIX);
2624
for (plist = master->num.head; plist; plist = next)
2627
prefix_list_delete (plist);
2629
for (plist = master->str.head; plist; plist = next)
2632
prefix_list_delete (plist);
2635
assert (master->num.head == NULL);
2636
assert (master->num.tail == NULL);
2638
assert (master->str.head == NULL);
2639
assert (master->str.tail == NULL);
2642
master->recent = NULL;
2646
/* Prefix-list node. */
2647
struct cmd_node prefix_node =
2650
"", /* Prefix list has no interface. */
2655
config_write_prefix_ipv4 (struct vty *vty)
2657
return config_write_prefix_afi (AFI_IP, vty);
2661
prefix_list_reset_ipv4 ()
2663
struct prefix_list *plist;
2664
struct prefix_list *next;
2665
struct prefix_master *master;
2667
master = prefix_master_get (AFI_IP);
2671
for (plist = master->num.head; plist; plist = next)
2674
prefix_list_delete (plist);
2676
for (plist = master->str.head; plist; plist = next)
2679
prefix_list_delete (plist);
2682
assert (master->num.head == NULL);
2683
assert (master->num.tail == NULL);
2685
assert (master->str.head == NULL);
2686
assert (master->str.tail == NULL);
2689
master->recent = NULL;
2693
prefix_list_init_ipv4 ()
2695
install_node (&prefix_node, config_write_prefix_ipv4);
2697
install_element (CONFIG_NODE, &ip_prefix_list_cmd);
2698
install_element (CONFIG_NODE, &ip_prefix_list_ge_cmd);
2699
install_element (CONFIG_NODE, &ip_prefix_list_ge_le_cmd);
2700
install_element (CONFIG_NODE, &ip_prefix_list_le_cmd);
2701
install_element (CONFIG_NODE, &ip_prefix_list_le_ge_cmd);
2702
install_element (CONFIG_NODE, &ip_prefix_list_seq_cmd);
2703
install_element (CONFIG_NODE, &ip_prefix_list_seq_ge_cmd);
2704
install_element (CONFIG_NODE, &ip_prefix_list_seq_ge_le_cmd);
2705
install_element (CONFIG_NODE, &ip_prefix_list_seq_le_cmd);
2706
install_element (CONFIG_NODE, &ip_prefix_list_seq_le_ge_cmd);
2708
install_element (CONFIG_NODE, &no_ip_prefix_list_cmd);
2709
install_element (CONFIG_NODE, &no_ip_prefix_list_prefix_cmd);
2710
install_element (CONFIG_NODE, &no_ip_prefix_list_ge_cmd);
2711
install_element (CONFIG_NODE, &no_ip_prefix_list_ge_le_cmd);
2712
install_element (CONFIG_NODE, &no_ip_prefix_list_le_cmd);
2713
install_element (CONFIG_NODE, &no_ip_prefix_list_le_ge_cmd);
2714
install_element (CONFIG_NODE, &no_ip_prefix_list_seq_cmd);
2715
install_element (CONFIG_NODE, &no_ip_prefix_list_seq_ge_cmd);
2716
install_element (CONFIG_NODE, &no_ip_prefix_list_seq_ge_le_cmd);
2717
install_element (CONFIG_NODE, &no_ip_prefix_list_seq_le_cmd);
2718
install_element (CONFIG_NODE, &no_ip_prefix_list_seq_le_ge_cmd);
2720
install_element (CONFIG_NODE, &ip_prefix_list_description_cmd);
2721
install_element (CONFIG_NODE, &no_ip_prefix_list_description_cmd);
2722
install_element (CONFIG_NODE, &no_ip_prefix_list_description_arg_cmd);
2724
install_element (CONFIG_NODE, &ip_prefix_list_sequence_number_cmd);
2725
install_element (CONFIG_NODE, &no_ip_prefix_list_sequence_number_cmd);
2727
install_element (VIEW_NODE, &show_ip_prefix_list_cmd);
2728
install_element (VIEW_NODE, &show_ip_prefix_list_name_cmd);
2729
install_element (VIEW_NODE, &show_ip_prefix_list_name_seq_cmd);
2730
install_element (VIEW_NODE, &show_ip_prefix_list_prefix_cmd);
2731
install_element (VIEW_NODE, &show_ip_prefix_list_prefix_longer_cmd);
2732
install_element (VIEW_NODE, &show_ip_prefix_list_prefix_first_match_cmd);
2733
install_element (VIEW_NODE, &show_ip_prefix_list_summary_cmd);
2734
install_element (VIEW_NODE, &show_ip_prefix_list_summary_name_cmd);
2735
install_element (VIEW_NODE, &show_ip_prefix_list_detail_cmd);
2736
install_element (VIEW_NODE, &show_ip_prefix_list_detail_name_cmd);
2738
install_element (ENABLE_NODE, &show_ip_prefix_list_cmd);
2739
install_element (ENABLE_NODE, &show_ip_prefix_list_name_cmd);
2740
install_element (ENABLE_NODE, &show_ip_prefix_list_name_seq_cmd);
2741
install_element (ENABLE_NODE, &show_ip_prefix_list_prefix_cmd);
2742
install_element (ENABLE_NODE, &show_ip_prefix_list_prefix_longer_cmd);
2743
install_element (ENABLE_NODE, &show_ip_prefix_list_prefix_first_match_cmd);
2744
install_element (ENABLE_NODE, &show_ip_prefix_list_summary_cmd);
2745
install_element (ENABLE_NODE, &show_ip_prefix_list_summary_name_cmd);
2746
install_element (ENABLE_NODE, &show_ip_prefix_list_detail_cmd);
2747
install_element (ENABLE_NODE, &show_ip_prefix_list_detail_name_cmd);
2749
install_element (ENABLE_NODE, &clear_ip_prefix_list_cmd);
2750
install_element (ENABLE_NODE, &clear_ip_prefix_list_name_cmd);
2751
install_element (ENABLE_NODE, &clear_ip_prefix_list_name_prefix_cmd);
2755
/* Prefix-list node. */
2756
struct cmd_node prefix_ipv6_node =
2759
"", /* Prefix list has no interface. */
2764
config_write_prefix_ipv6 (struct vty *vty)
2766
return config_write_prefix_afi (AFI_IP6, vty);
2770
prefix_list_reset_ipv6 ()
2772
struct prefix_list *plist;
2773
struct prefix_list *next;
2774
struct prefix_master *master;
2776
master = prefix_master_get (AFI_IP6);
2780
for (plist = master->num.head; plist; plist = next)
2783
prefix_list_delete (plist);
2785
for (plist = master->str.head; plist; plist = next)
2788
prefix_list_delete (plist);
2791
assert (master->num.head == NULL);
2792
assert (master->num.tail == NULL);
2794
assert (master->str.head == NULL);
2795
assert (master->str.tail == NULL);
2798
master->recent = NULL;
2802
prefix_list_init_ipv6 ()
2804
install_node (&prefix_ipv6_node, config_write_prefix_ipv6);
2806
install_element (CONFIG_NODE, &ipv6_prefix_list_cmd);
2807
install_element (CONFIG_NODE, &ipv6_prefix_list_ge_cmd);
2808
install_element (CONFIG_NODE, &ipv6_prefix_list_ge_le_cmd);
2809
install_element (CONFIG_NODE, &ipv6_prefix_list_le_cmd);
2810
install_element (CONFIG_NODE, &ipv6_prefix_list_le_ge_cmd);
2811
install_element (CONFIG_NODE, &ipv6_prefix_list_seq_cmd);
2812
install_element (CONFIG_NODE, &ipv6_prefix_list_seq_ge_cmd);
2813
install_element (CONFIG_NODE, &ipv6_prefix_list_seq_ge_le_cmd);
2814
install_element (CONFIG_NODE, &ipv6_prefix_list_seq_le_cmd);
2815
install_element (CONFIG_NODE, &ipv6_prefix_list_seq_le_ge_cmd);
2817
install_element (CONFIG_NODE, &no_ipv6_prefix_list_cmd);
2818
install_element (CONFIG_NODE, &no_ipv6_prefix_list_prefix_cmd);
2819
install_element (CONFIG_NODE, &no_ipv6_prefix_list_ge_cmd);
2820
install_element (CONFIG_NODE, &no_ipv6_prefix_list_ge_le_cmd);
2821
install_element (CONFIG_NODE, &no_ipv6_prefix_list_le_cmd);
2822
install_element (CONFIG_NODE, &no_ipv6_prefix_list_le_ge_cmd);
2823
install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_cmd);
2824
install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_ge_cmd);
2825
install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_ge_le_cmd);
2826
install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_le_cmd);
2827
install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_le_ge_cmd);
2829
install_element (CONFIG_NODE, &ipv6_prefix_list_description_cmd);
2830
install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_cmd);
2831
install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_arg_cmd);
2833
install_element (CONFIG_NODE, &ipv6_prefix_list_sequence_number_cmd);
2834
install_element (CONFIG_NODE, &no_ipv6_prefix_list_sequence_number_cmd);
2836
install_element (VIEW_NODE, &show_ipv6_prefix_list_cmd);
2837
install_element (VIEW_NODE, &show_ipv6_prefix_list_name_cmd);
2838
install_element (VIEW_NODE, &show_ipv6_prefix_list_name_seq_cmd);
2839
install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_cmd);
2840
install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_longer_cmd);
2841
install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_first_match_cmd);
2842
install_element (VIEW_NODE, &show_ipv6_prefix_list_summary_cmd);
2843
install_element (VIEW_NODE, &show_ipv6_prefix_list_summary_name_cmd);
2844
install_element (VIEW_NODE, &show_ipv6_prefix_list_detail_cmd);
2845
install_element (VIEW_NODE, &show_ipv6_prefix_list_detail_name_cmd);
2847
install_element (ENABLE_NODE, &show_ipv6_prefix_list_cmd);
2848
install_element (ENABLE_NODE, &show_ipv6_prefix_list_name_cmd);
2849
install_element (ENABLE_NODE, &show_ipv6_prefix_list_name_seq_cmd);
2850
install_element (ENABLE_NODE, &show_ipv6_prefix_list_prefix_cmd);
2851
install_element (ENABLE_NODE, &show_ipv6_prefix_list_prefix_longer_cmd);
2852
install_element (ENABLE_NODE, &show_ipv6_prefix_list_prefix_first_match_cmd);
2853
install_element (ENABLE_NODE, &show_ipv6_prefix_list_summary_cmd);
2854
install_element (ENABLE_NODE, &show_ipv6_prefix_list_summary_name_cmd);
2855
install_element (ENABLE_NODE, &show_ipv6_prefix_list_detail_cmd);
2856
install_element (ENABLE_NODE, &show_ipv6_prefix_list_detail_name_cmd);
2858
install_element (ENABLE_NODE, &clear_ipv6_prefix_list_cmd);
2859
install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_cmd);
2860
install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_prefix_cmd);
2862
#endif /* HAVE_IPV6 */
2867
prefix_list_init_ipv4 ();
2869
prefix_list_init_ipv6 ();
2870
#endif /* HAVE_IPV6 */
2874
prefix_list_reset ()
2876
prefix_list_reset_ipv4 ();
2878
prefix_list_reset_ipv6 ();
2879
#endif /* HAVE_IPV6 */
2880
prefix_list_reset_orf ();