From: David Lamparter Date: Fri, 18 Nov 2016 13:05:49 +0000 (+0100) Subject: lib: use DEFPY() for plist.c X-Git-Tag: reindent-master-before~50^2~6 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=6cdff321965cf8cee48370406feedefd6c41c58e;p=mirror%2Ffrr.git lib: use DEFPY() for plist.c Shorten lib/plist.c by combining the various command variants... Signed-off-by: David Lamparter --- diff --git a/lib/Makefile.am b/lib/Makefile.am index 25d7d6d950..f1356d2be4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1,7 @@ ## Process this file with automake to produce Makefile.in. +include ../common.am + AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib AM_CFLAGS = $(WERROR) DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" @@ -114,6 +116,8 @@ clippy_CFLAGS = $(PYTHON_CFLAGS) clippy_LDADD = $(PYTHON_LIBS) clippy-command_graph.$(OBJEXT): route_types.h +plist.lo: plist_clippy.c + EXTRA_DIST = \ queue.h \ command_lex.h \ diff --git a/lib/plist.c b/lib/plist.c index d9bdeab6b6..7be56d4320 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1413,1139 +1413,205 @@ vty_clear_prefix_list (struct vty *vty, afi_t afi, const char *name, return CMD_SUCCESS; } -DEFUN (ip_prefix_list, - ip_prefix_list_cmd, - "ip prefix-list WORD ", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv4_any = 4; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, - argv[idx_permit_deny]->arg, argv[idx_ipv4_any]->arg, NULL, NULL); -} - -DEFUN (ip_prefix_list_ge, - ip_prefix_list_ge_cmd, - "ip prefix-list WORD A.B.C.D/M ge (0-32)", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv4_prefixlen = 4; - int idx_number = 6; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, NULL); -} - -DEFUN (ip_prefix_list_ge_le, - ip_prefix_list_ge_le_cmd, - "ip prefix-list WORD A.B.C.D/M ge (0-32) le (0-32)", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv4_prefixlen = 4; - int idx_number = 6; - int idx_number_2 = 8; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); -} - -DEFUN (ip_prefix_list_le, - ip_prefix_list_le_cmd, - "ip prefix-list WORD A.B.C.D/M le (0-32)", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv4_prefixlen = 4; - int idx_number = 6; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number]->arg); -} - -DEFUN (ip_prefix_list_le_ge, - ip_prefix_list_le_ge_cmd, - "ip prefix-list WORD A.B.C.D/M le (0-32) ge (0-32)", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv4_prefixlen = 4; - int idx_number = 6; - int idx_number_2 = 8; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); -} - -DEFUN (ip_prefix_list_seq, - ip_prefix_list_seq_cmd, - "ip prefix-list WORD seq (1-4294967295) ", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") -{ - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv4_any = 6; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_any]->arg, NULL, NULL); -} - -DEFUN (ip_prefix_list_seq_ge, - ip_prefix_list_seq_ge_cmd, - "ip prefix-list WORD seq (1-4294967295) A.B.C.D/M ge (0-32)", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv4_prefixlen = 6; - int idx_number_2 = 8; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (ip_prefix_list_seq_ge_le, - ip_prefix_list_seq_ge_le_cmd, - "ip prefix-list WORD seq (1-4294967295) A.B.C.D/M ge (0-32) le (0-32)", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv4_prefixlen = 6; - int idx_number_2 = 8; - int idx_number_3 = 10; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); -} - -DEFUN (ip_prefix_list_seq_le, - ip_prefix_list_seq_le_cmd, - "ip prefix-list WORD seq (1-4294967295) A.B.C.D/M le (0-32)", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv4_prefixlen = 6; - int idx_number_2 = 8; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number_2]->arg); -} - -DEFUN (ip_prefix_list_seq_le_ge, - ip_prefix_list_seq_le_ge_cmd, - "ip prefix-list WORD seq (1-4294967295) A.B.C.D/M le (0-32) ge (0-32)", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv4_prefixlen = 6; - int idx_number_2 = 8; - int idx_number_3 = 10; - return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); -} - -DEFUN (no_ip_prefix_list, - no_ip_prefix_list_cmd, - "no ip prefix-list WORD", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n") -{ - int idx_word = 3; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, NULL, - NULL, NULL, NULL); -} - -DEFUN (no_ip_prefix_list_prefix, - no_ip_prefix_list_prefix_cmd, - "no ip prefix-list WORD ", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") -{ - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv4_any = 5; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_any]->arg, NULL, NULL); -} - -DEFUN (no_ip_prefix_list_ge, - no_ip_prefix_list_ge_cmd, - "no ip prefix-list WORD A.B.C.D/M ge (0-32)", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv4_prefixlen = 5; - int idx_number = 7; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_prefix_list_ge_le, - no_ip_prefix_list_ge_le_cmd, - "no ip prefix-list WORD A.B.C.D/M ge (0-32) le (0-32)", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv4_prefixlen = 5; - int idx_number = 7; - int idx_number_2 = 9; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); -} - -DEFUN (no_ip_prefix_list_le, - no_ip_prefix_list_le_cmd, - "no ip prefix-list WORD A.B.C.D/M le (0-32)", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv4_prefixlen = 5; - int idx_number = 7; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number]->arg); -} - -DEFUN (no_ip_prefix_list_le_ge, - no_ip_prefix_list_le_ge_cmd, - "no ip prefix-list WORD A.B.C.D/M le (0-32) ge (0-32)", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv4_prefixlen = 5; - int idx_number = 7; - int idx_number_2 = 9; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); -} - -DEFUN (no_ip_prefix_list_seq, - no_ip_prefix_list_seq_cmd, - "no ip prefix-list WORD seq (1-4294967295) ", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") -{ - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv4_any = 7; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_any]->arg, NULL, NULL); -} - -DEFUN (no_ip_prefix_list_seq_ge, - no_ip_prefix_list_seq_ge_cmd, - "no ip prefix-list WORD seq (1-4294967295) A.B.C.D/M ge (0-32)", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv4_prefixlen = 7; - int idx_number_2 = 9; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_prefix_list_seq_ge_le, - no_ip_prefix_list_seq_ge_le_cmd, - "no ip prefix-list WORD seq (1-4294967295) A.B.C.D/M ge (0-32) le (0-32)", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv4_prefixlen = 7; - int idx_number_2 = 9; - int idx_number_3 = 11; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); -} - -DEFUN (no_ip_prefix_list_seq_le, - no_ip_prefix_list_seq_le_cmd, - "no ip prefix-list WORD seq (1-4294967295) A.B.C.D/M le (0-32)", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv4_prefixlen = 7; - int idx_number_2 = 9; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number_2]->arg); -} - -DEFUN (no_ip_prefix_list_seq_le_ge, - no_ip_prefix_list_seq_le_ge_cmd, - "no ip prefix-list WORD seq (1-4294967295) A.B.C.D/M le (0-32) ge (0-32)", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv4_prefixlen = 7; - int idx_number_2 = 9; - int idx_number_3 = 11; - return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv4_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); -} - -DEFUN (ip_prefix_list_sequence_number, - ip_prefix_list_sequence_number_cmd, - "ip prefix-list sequence-number", - IP_STR - PREFIX_LIST_STR - "Include/exclude sequence numbers in NVGEN\n") -{ - prefix_master_ipv4.seqnum = 1; - return CMD_SUCCESS; -} - -DEFUN (no_ip_prefix_list_sequence_number, - no_ip_prefix_list_sequence_number_cmd, - "no ip prefix-list sequence-number", - NO_STR - IP_STR - PREFIX_LIST_STR - "Include/exclude sequence numbers in NVGEN\n") -{ - prefix_master_ipv4.seqnum = 0; - return CMD_SUCCESS; -} - -DEFUN (ip_prefix_list_description, - ip_prefix_list_description_cmd, - "ip prefix-list WORD description LINE...", - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Prefix-list specific description\n" - "Up to 80 characters describing this prefix-list\n") -{ - int idx_word = 2; - int idx_line = 4; - struct prefix_list *plist; - - plist = prefix_list_get (AFI_IP, 0, argv[idx_word]->arg); - - if (plist->desc) - { - XFREE (MTYPE_TMP, plist->desc); - plist->desc = NULL; - } - plist->desc = argv_concat(argv, argc, idx_line); - - return CMD_SUCCESS; -} - -DEFUN (no_ip_prefix_list_description, - no_ip_prefix_list_description_cmd, - "no ip prefix-list WORD description", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Prefix-list specific description\n") -{ - int idx_word = 3; - return vty_prefix_list_desc_unset (vty, AFI_IP, argv[idx_word]->arg); -} - -/* ALIAS_FIXME */ -DEFUN (no_ip_prefix_list_description_comment, - no_ip_prefix_list_description_comment_cmd, - "no ip prefix-list WORD description LINE...", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Prefix-list specific description\n" - "Up to 80 characters describing this prefix-list\n") -{ - return no_ip_prefix_list_description (self, vty, argc, argv); -} - -DEFUN (show_ip_prefix_list, - show_ip_prefix_list_cmd, - "show ip prefix-list", - SHOW_STR - IP_STR - PREFIX_LIST_STR) -{ - return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, normal_display); -} - -DEFUN (show_ip_prefix_list_name, - show_ip_prefix_list_name_cmd, - "show ip prefix-list WORD", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n") -{ - int idx_word = 3; - return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, normal_display); -} - -DEFUN (show_ip_prefix_list_name_seq, - show_ip_prefix_list_name_seq_cmd, - "show ip prefix-list WORD seq (1-4294967295)", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n") -{ - int idx_word = 3; - int idx_number = 5; - return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, sequential_display); -} - -DEFUN (show_ip_prefix_list_prefix, - show_ip_prefix_list_prefix_cmd, - "show ip prefix-list WORD A.B.C.D/M", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "IP prefix /, e.g., 35.0.0.0/8\n") -{ - int idx_word = 3; - int idx_ipv4_prefixlen = 4; - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, normal_display); -} - -DEFUN (show_ip_prefix_list_prefix_longer, - show_ip_prefix_list_prefix_longer_cmd, - "show ip prefix-list WORD A.B.C.D/M longer", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Lookup longer prefix\n") -{ - int idx_word = 3; - int idx_ipv4_prefixlen = 4; - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, longer_display); -} - -DEFUN (show_ip_prefix_list_prefix_first_match, - show_ip_prefix_list_prefix_first_match_cmd, - "show ip prefix-list WORD A.B.C.D/M first-match", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "First matched prefix\n") -{ - int idx_word = 3; - int idx_ipv4_prefixlen = 4; - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, first_match_display); -} - -DEFUN (show_ip_prefix_list_summary, - show_ip_prefix_list_summary_cmd, - "show ip prefix-list summary", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Summary of prefix lists\n") -{ - return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, summary_display); -} - -DEFUN (show_ip_prefix_list_summary_name, - show_ip_prefix_list_summary_name_cmd, - "show ip prefix-list summary WORD", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Summary of prefix lists\n" - "Name of a prefix list\n") -{ - int idx_word = 4; - return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, summary_display); -} - - -DEFUN (show_ip_prefix_list_detail, - show_ip_prefix_list_detail_cmd, - "show ip prefix-list detail", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Detail of prefix lists\n") -{ - return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, detail_display); -} - -DEFUN (show_ip_prefix_list_detail_name, - show_ip_prefix_list_detail_name_cmd, - "show ip prefix-list detail WORD", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Detail of prefix lists\n" - "Name of a prefix list\n") -{ - int idx_word = 4; - return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, detail_display); -} - -DEFUN (clear_ip_prefix_list, - clear_ip_prefix_list_cmd, - "clear ip prefix-list", - CLEAR_STR - IP_STR - PREFIX_LIST_STR) -{ - return vty_clear_prefix_list (vty, AFI_IP, NULL, NULL); -} - -DEFUN (clear_ip_prefix_list_name, - clear_ip_prefix_list_name_cmd, - "clear ip prefix-list WORD", - CLEAR_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n") -{ - int idx_word = 3; - return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL); -} - -DEFUN (clear_ip_prefix_list_name_prefix, - clear_ip_prefix_list_name_prefix_cmd, - "clear ip prefix-list WORD A.B.C.D/M", - CLEAR_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "IP prefix /, e.g., 35.0.0.0/8\n") -{ - int idx_word = 3; - int idx_ipv4_prefixlen = 4; - return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg); -} - -DEFUN (ipv6_prefix_list, - ipv6_prefix_list_cmd, - "ipv6 prefix-list WORD ", - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Any prefix match. Same as \"::0/0 le 128\"\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv6_any = 4; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, - argv[idx_permit_deny]->arg, argv[idx_ipv6_any]->arg, NULL, NULL); -} - -DEFUN (ipv6_prefix_list_ge, - ipv6_prefix_list_ge_cmd, - "ipv6 prefix-list WORD X:X::X:X/M ge (0-128)", - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv6_prefixlen = 4; - int idx_number = 6; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, NULL); -} - -DEFUN (ipv6_prefix_list_ge_le, - ipv6_prefix_list_ge_le_cmd, - "ipv6 prefix-list WORD X:X::X:X/M ge (0-128) le (0-128)", - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") - -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv6_prefixlen = 4; - int idx_number = 6; - int idx_number_2 = 8; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); -} - -DEFUN (ipv6_prefix_list_le, - ipv6_prefix_list_le_cmd, - "ipv6 prefix-list WORD X:X::X:X/M le (0-128)", - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv6_prefixlen = 4; - int idx_number = 6; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number]->arg); -} - -DEFUN (ipv6_prefix_list_le_ge, - ipv6_prefix_list_le_ge_cmd, - "ipv6 prefix-list WORD X:X::X:X/M le (0-128) ge (0-128)", - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv6_prefixlen = 4; - int idx_number = 6; - int idx_number_2 = 8; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); -} - -DEFUN (ipv6_prefix_list_seq, - ipv6_prefix_list_seq_cmd, - "ipv6 prefix-list WORD seq (1-4294967295) ", - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Any prefix match. Same as \"::0/0 le 128\"\n") -{ - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv6_any = 6; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_any]->arg, NULL, NULL); -} - -DEFUN (ipv6_prefix_list_seq_ge, - ipv6_prefix_list_seq_ge_cmd, - "ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M ge (0-128)", - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") -{ - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv6_prefixlen = 6; - int idx_number_2 = 8; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (ipv6_prefix_list_seq_ge_le, - ipv6_prefix_list_seq_ge_le_cmd, - "ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M ge (0-128) le (0-128)", - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") -{ - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv6_prefixlen = 6; - int idx_number_2 = 8; - int idx_number_3 = 10; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); -} - -DEFUN (ipv6_prefix_list_seq_le, - ipv6_prefix_list_seq_le_cmd, - "ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M le (0-128)", - IPV6_STR +#ifndef VTYSH_EXTRACT_PL +#include "plist_clippy.c" +#endif + +DEFPY (ip_prefix_list, + ip_prefix_list_cmd, + "ip prefix-list WORD [seq (1-4294967295)] $action ", + IP_STR PREFIX_LIST_STR "Name of a prefix list\n" "sequence number of an entry\n" "Sequence number\n" "Specify packets to reject\n" "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" + "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n" + "IP prefix /, e.g., 35.0.0.0/8\n" + "Minimum prefix length to be matched\n" + "Minimum prefix length\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv6_prefixlen = 6; - int idx_number_2 = 8; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number_2]->arg); + return vty_prefix_list_install (vty, AFI_IP, prefix_list, seq_str, action, + dest, ge_str, le_str); } -DEFUN (ipv6_prefix_list_seq_le_ge, - ipv6_prefix_list_seq_le_ge_cmd, - "ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M le (0-128) ge (0-128)", - IPV6_STR +DEFPY (no_ip_prefix_list, + no_ip_prefix_list_cmd, + "no ip prefix-list WORD [seq (1-4294967295)] $action ", + NO_STR + IP_STR PREFIX_LIST_STR "Name of a prefix list\n" "sequence number of an entry\n" "Sequence number\n" "Specify packets to reject\n" "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n" + "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n" + "IP prefix /, e.g., 35.0.0.0/8\n" "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length\n" + "Maximum prefix length to be matched\n" + "Maximum prefix length\n") { - int idx_word = 2; - int idx_number = 4; - int idx_permit_deny = 5; - int idx_ipv6_prefixlen = 6; - int idx_number_2 = 8; - int idx_number_3 = 10; - return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP, prefix_list, seq_str, action, + dest, ge_str, le_str); } -DEFUN (no_ipv6_prefix_list, - no_ipv6_prefix_list_cmd, - "no ipv6 prefix-list WORD", +DEFPY (no_ip_prefix_list_all, + no_ip_prefix_list_all_cmd, + "no ip prefix-list WORD", NO_STR - IPV6_STR + IP_STR PREFIX_LIST_STR "Name of a prefix list\n") { - int idx_word = 3; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, NULL, + return vty_prefix_list_uninstall (vty, AFI_IP, prefix_list, NULL, NULL, NULL, NULL, NULL); } -DEFUN (no_ipv6_prefix_list_prefix, - no_ipv6_prefix_list_prefix_cmd, - "no ipv6 prefix-list WORD ", +DEFPY (ip_prefix_list_sequence_number, + ip_prefix_list_sequence_number_cmd, + "[no] ip prefix-list sequence-number", NO_STR - IPV6_STR + IP_STR PREFIX_LIST_STR - "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Any prefix match. Same as \"::0/0 le 128\"\n") + "Include/exclude sequence numbers in NVGEN\n") { - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv6_any = 5; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_any]->arg, NULL, NULL); + prefix_master_ipv4.seqnum = no ? 0 : 1; + return CMD_SUCCESS; } -DEFUN (no_ipv6_prefix_list_ge, - no_ipv6_prefix_list_ge_cmd, - "no ipv6 prefix-list WORD X:X::X:X/M ge (0-128)", - NO_STR - IPV6_STR +DEFUN (ip_prefix_list_description, + ip_prefix_list_description_cmd, + "ip prefix-list WORD description LINE...", + IP_STR PREFIX_LIST_STR "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Prefix-list specific description\n" + "Up to 80 characters describing this prefix-list\n") { - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv6_prefixlen = 5; - int idx_number = 7; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, NULL); + int idx_word = 2; + int idx_line = 4; + struct prefix_list *plist; + + plist = prefix_list_get (AFI_IP, 0, argv[idx_word]->arg); + + if (plist->desc) + { + XFREE (MTYPE_TMP, plist->desc); + plist->desc = NULL; + } + plist->desc = argv_concat(argv, argc, idx_line); + + return CMD_SUCCESS; } -DEFUN (no_ipv6_prefix_list_ge_le, - no_ipv6_prefix_list_ge_le_cmd, - "no ipv6 prefix-list WORD X:X::X:X/M ge (0-128) le (0-128)", +DEFUN (no_ip_prefix_list_description, + no_ip_prefix_list_description_cmd, + "no ip prefix-list WORD description", NO_STR - IPV6_STR + IP_STR PREFIX_LIST_STR "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Prefix-list specific description\n") { int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv6_prefixlen = 5; - int idx_number = 7; - int idx_number_2 = 9; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); + return vty_prefix_list_desc_unset (vty, AFI_IP, argv[idx_word]->arg); } -DEFUN (no_ipv6_prefix_list_le, - no_ipv6_prefix_list_le_cmd, - "no ipv6 prefix-list WORD X:X::X:X/M le (0-128)", +/* ALIAS_FIXME */ +DEFUN (no_ip_prefix_list_description_comment, + no_ip_prefix_list_description_comment_cmd, + "no ip prefix-list WORD description LINE...", NO_STR - IPV6_STR + IP_STR PREFIX_LIST_STR "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Prefix-list specific description\n" + "Up to 80 characters describing this prefix-list\n") { - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv6_prefixlen = 5; - int idx_number = 7; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number]->arg); + return no_ip_prefix_list_description (self, vty, argc, argv); } -DEFUN (no_ipv6_prefix_list_le_ge, - no_ipv6_prefix_list_le_ge_cmd, - "no ipv6 prefix-list WORD X:X::X:X/M le (0-128) ge (0-128)", - NO_STR - IPV6_STR +DEFPY (show_ip_prefix_list, + show_ip_prefix_list_cmd, + "show ip prefix-list [WORD [seq$dseq (1-4294967295)$arg]]", + SHOW_STR + IP_STR PREFIX_LIST_STR "Name of a prefix list\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "sequence number of an entry\n" + "Sequence number\n") { - int idx_word = 3; - int idx_permit_deny = 4; - int idx_ipv6_prefixlen = 5; - int idx_number = 7; - int idx_number_2 = 9; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); + enum display_type dtype = normal_display; + if (dseq) + dtype = sequential_display; + + return vty_show_prefix_list (vty, AFI_IP, prefix_list, arg_str, dtype); } -DEFUN (no_ipv6_prefix_list_seq, - no_ipv6_prefix_list_seq_cmd, - "no ipv6 prefix-list WORD seq (1-4294967295) ", - NO_STR - IPV6_STR +DEFPY (show_ip_prefix_list_prefix, + show_ip_prefix_list_prefix_cmd, + "show ip prefix-list WORD A.B.C.D/M$prefix [longer$dl|first-match$dfm]", + SHOW_STR + IP_STR PREFIX_LIST_STR "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Any prefix match. Same as \"::0/0 le 128\"\n") + "IP prefix /, e.g., 35.0.0.0/8\n" + "Lookup longer prefix\n" + "First matched prefix\n") { - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv6_any = 7; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_any]->arg, NULL, NULL); + enum display_type dtype = normal_display; + if (dl) + dtype = longer_display; + else if (dfm) + dtype = first_match_display; + + return vty_show_prefix_list_prefix (vty, AFI_IP, prefix_list, prefix_str, dtype); } -DEFUN (no_ipv6_prefix_list_seq_ge, - no_ipv6_prefix_list_seq_ge_cmd, - "no ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M ge (0-128)", - NO_STR - IPV6_STR +DEFPY (show_ip_prefix_list_summary, + show_ip_prefix_list_summary_cmd, + "show ip prefix-list summary [WORD$prefix_list]", + SHOW_STR + IP_STR PREFIX_LIST_STR - "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Summary of prefix lists\n" + "Name of a prefix list\n") { - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv6_prefixlen = 7; - int idx_number_2 = 9; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, NULL); + return vty_show_prefix_list (vty, AFI_IP, prefix_list, NULL, summary_display); } -DEFUN (no_ipv6_prefix_list_seq_ge_le, - no_ipv6_prefix_list_seq_ge_le_cmd, - "no ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M ge (0-128) le (0-128)", - NO_STR - IPV6_STR +DEFPY (show_ip_prefix_list_detail, + show_ip_prefix_list_detail_cmd, + "show ip prefix-list detail [WORD$prefix_list]", + SHOW_STR + IP_STR + PREFIX_LIST_STR + "Detail of prefix lists\n" + "Name of a prefix list\n") +{ + return vty_show_prefix_list (vty, AFI_IP, prefix_list, NULL, detail_display); +} + +DEFPY (clear_ip_prefix_list, + clear_ip_prefix_list_cmd, + "clear ip prefix-list [WORD [A.B.C.D/M$prefix]]", + CLEAR_STR + IP_STR PREFIX_LIST_STR "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n" - "Specify packets to reject\n" - "Specify packets to forward\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "IP prefix /, e.g., 35.0.0.0/8\n") { - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv6_prefixlen = 7; - int idx_number_2 = 9; - int idx_number_3 = 11; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); -} - -DEFUN (no_ipv6_prefix_list_seq_le, - no_ipv6_prefix_list_seq_le_cmd, - "no ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M le (0-128)", - NO_STR + return vty_clear_prefix_list (vty, AFI_IP, prefix_list, prefix_str); +} + +DEFPY (ipv6_prefix_list, + ipv6_prefix_list_cmd, + "ipv6 prefix-list WORD [seq (1-4294967295)] $action ", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2553,22 +1619,20 @@ DEFUN (no_ipv6_prefix_list_seq_le, "Sequence number\n" "Specify packets to reject\n" "Specify packets to forward\n" + "Any prefix match. Same as \"::0/0 le 128\"\n" "IPv6 prefix /, e.g., 3ffe::/16\n" "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length\n" + "Minimum prefix length to be matched\n" + "Minimum prefix length\n") { - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv6_prefixlen = 7; - int idx_number_2 = 9; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number_2]->arg); + return vty_prefix_list_install (vty, AFI_IP6, prefix_list, seq_str, action, + dest, ge_str, le_str); } -DEFUN (no_ipv6_prefix_list_seq_le_ge, - no_ipv6_prefix_list_seq_le_ge_cmd, - "no ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M le (0-128) ge (0-128)", +DEFPY (no_ipv6_prefix_list, + no_ipv6_prefix_list_cmd, + "no ipv6 prefix-list WORD [seq (1-4294967295)] $action ", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2577,42 +1641,38 @@ DEFUN (no_ipv6_prefix_list_seq_le_ge, "Sequence number\n" "Specify packets to reject\n" "Specify packets to forward\n" + "Any prefix match. Same as \"::0/0 le 128\"\n" "IPv6 prefix /, e.g., 3ffe::/16\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - int idx_word = 3; - int idx_number = 5; - int idx_permit_deny = 6; - int idx_ipv6_prefixlen = 7; - int idx_number_2 = 9; - int idx_number_3 = 11; - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, - argv[idx_ipv6_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP6, prefix_list, seq_str, action, + dest, ge_str, le_str); } -DEFUN (ipv6_prefix_list_sequence_number, - ipv6_prefix_list_sequence_number_cmd, - "ipv6 prefix-list sequence-number", +DEFPY (no_ipv6_prefix_list_all, + no_ipv6_prefix_list_all_cmd, + "no ipv6 prefix-list WORD", + NO_STR IPV6_STR PREFIX_LIST_STR - "Include/exclude sequence numbers in NVGEN\n") + "Name of a prefix list\n") { - prefix_master_ipv6.seqnum = 1; - return CMD_SUCCESS; + return vty_prefix_list_uninstall (vty, AFI_IP6, prefix_list, NULL, NULL, + NULL, NULL, NULL); } -DEFUN (no_ipv6_prefix_list_sequence_number, - no_ipv6_prefix_list_sequence_number_cmd, - "no ipv6 prefix-list sequence-number", +DEFPY (ipv6_prefix_list_sequence_number, + ipv6_prefix_list_sequence_number_cmd, + "[no] ipv6 prefix-list sequence-number", NO_STR IPV6_STR PREFIX_LIST_STR "Include/exclude sequence numbers in NVGEN\n") { - prefix_master_ipv6.seqnum = 0; + prefix_master_ipv6.seqnum = no ? 0 : 1; return CMD_SUCCESS; } @@ -2669,169 +1729,79 @@ DEFUN (no_ipv6_prefix_list_description_comment, } -DEFUN (show_ipv6_prefix_list, +DEFPY (show_ipv6_prefix_list, show_ipv6_prefix_list_cmd, - "show ipv6 prefix-list", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR) -{ - return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, normal_display); -} - -DEFUN (show_ipv6_prefix_list_name, - show_ipv6_prefix_list_name_cmd, - "show ipv6 prefix-list WORD", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n") -{ - int idx_word = 3; - return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, normal_display); -} - -DEFUN (show_ipv6_prefix_list_name_seq, - show_ipv6_prefix_list_name_seq_cmd, - "show ipv6 prefix-list WORD seq (1-4294967295)", + "show ipv6 prefix-list [WORD [seq$dseq (1-4294967295)$arg]]", SHOW_STR IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" "sequence number of an entry\n" - "Sequence number\n") -{ - int idx_word = 3; - int idx_number = 5; - return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, sequential_display); -} - -DEFUN (show_ipv6_prefix_list_prefix, - show_ipv6_prefix_list_prefix_cmd, - "show ipv6 prefix-list WORD X:X::X:X/M", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "IPv6 prefix /, e.g., 3ffe::/16\n") + "Sequence number\n" + "Lookup longer prefix\n" + "First matched prefix\n") { - int idx_word = 3; - int idx_ipv6_prefixlen = 4; - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, normal_display); -} + enum display_type dtype = normal_display; + if (dseq) + dtype = sequential_display; -DEFUN (show_ipv6_prefix_list_prefix_longer, - show_ipv6_prefix_list_prefix_longer_cmd, - "show ipv6 prefix-list WORD X:X::X:X/M longer", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Lookup longer prefix\n") -{ - int idx_word = 3; - int idx_ipv6_prefixlen = 4; - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, longer_display); + return vty_show_prefix_list (vty, AFI_IP6, prefix_list, arg_str, dtype); } -DEFUN (show_ipv6_prefix_list_prefix_first_match, - show_ipv6_prefix_list_prefix_first_match_cmd, - "show ipv6 prefix-list WORD X:X::X:X/M first-match", +DEFPY (show_ipv6_prefix_list_prefix, + show_ipv6_prefix_list_prefix_cmd, + "show ipv6 prefix-list WORD X:X::X:X/M$prefix [longer$dl|first-match$dfm]", SHOW_STR IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n" + "Lookup longer prefix\n" "First matched prefix\n") { - int idx_word = 3; - int idx_ipv6_prefixlen = 4; - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, first_match_display); -} + enum display_type dtype = normal_display; + if (dl) + dtype = longer_display; + else if (dfm) + dtype = first_match_display; -DEFUN (show_ipv6_prefix_list_summary, - show_ipv6_prefix_list_summary_cmd, - "show ipv6 prefix-list summary", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR - "Summary of prefix lists\n") -{ - return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, summary_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, prefix_list, prefix_str, dtype); } -DEFUN (show_ipv6_prefix_list_summary_name, - show_ipv6_prefix_list_summary_name_cmd, - "show ipv6 prefix-list summary WORD", +DEFPY (show_ipv6_prefix_list_summary, + show_ipv6_prefix_list_summary_cmd, + "show ipv6 prefix-list summary [WORD$prefix-list]", SHOW_STR IPV6_STR PREFIX_LIST_STR "Summary of prefix lists\n" "Name of a prefix list\n") { - int idx_word = 4; - return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, summary_display); + return vty_show_prefix_list (vty, AFI_IP6, prefix_list, NULL, summary_display); } -DEFUN (show_ipv6_prefix_list_detail, +DEFPY (show_ipv6_prefix_list_detail, show_ipv6_prefix_list_detail_cmd, - "show ipv6 prefix-list detail", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR - "Detail of prefix lists\n") -{ - return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, detail_display); -} - -DEFUN (show_ipv6_prefix_list_detail_name, - show_ipv6_prefix_list_detail_name_cmd, - "show ipv6 prefix-list detail WORD", + "show ipv6 prefix-list detail [WORD$prefix-list]", SHOW_STR IPV6_STR PREFIX_LIST_STR "Detail of prefix lists\n" "Name of a prefix list\n") { - int idx_word = 4; - return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, detail_display); + return vty_show_prefix_list (vty, AFI_IP6, prefix_list, NULL, detail_display); } -DEFUN (clear_ipv6_prefix_list, +DEFPY (clear_ipv6_prefix_list, clear_ipv6_prefix_list_cmd, - "clear ipv6 prefix-list", - CLEAR_STR - IPV6_STR - PREFIX_LIST_STR) -{ - return vty_clear_prefix_list (vty, AFI_IP6, NULL, NULL); -} - -DEFUN (clear_ipv6_prefix_list_name, - clear_ipv6_prefix_list_name_cmd, - "clear ipv6 prefix-list WORD", - CLEAR_STR - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n") -{ - int idx_word = 3; - return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL); -} - -DEFUN (clear_ipv6_prefix_list_name_prefix, - clear_ipv6_prefix_list_name_prefix_cmd, - "clear ipv6 prefix-list WORD X:X::X:X/M", + "clear ipv6 prefix-list [WORD [X:X::X:X/M$prefix]]", CLEAR_STR IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - int idx_word = 3; - int idx_ipv6_prefixlen = 4; - return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg); + return vty_clear_prefix_list (vty, AFI_IP6, prefix_list, prefix_str); } /* Configuration write function. */ @@ -3196,49 +2166,21 @@ prefix_list_init_ipv4 (void) install_node (&prefix_node, config_write_prefix_ipv4); install_element (CONFIG_NODE, &ip_prefix_list_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_ge_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_ge_le_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_le_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_le_ge_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_seq_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_seq_ge_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_seq_ge_le_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_seq_le_cmd); - install_element (CONFIG_NODE, &ip_prefix_list_seq_le_ge_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_prefix_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_ge_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_ge_le_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_le_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_le_ge_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_seq_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_seq_ge_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_seq_ge_le_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_seq_le_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_seq_le_ge_cmd); + install_element (CONFIG_NODE, &no_ip_prefix_list_all_cmd); install_element (CONFIG_NODE, &ip_prefix_list_description_cmd); install_element (CONFIG_NODE, &no_ip_prefix_list_description_cmd); install_element (CONFIG_NODE, &no_ip_prefix_list_description_comment_cmd); install_element (CONFIG_NODE, &ip_prefix_list_sequence_number_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_sequence_number_cmd); install_element (VIEW_NODE, &show_ip_prefix_list_cmd); - install_element (VIEW_NODE, &show_ip_prefix_list_name_cmd); - install_element (VIEW_NODE, &show_ip_prefix_list_name_seq_cmd); install_element (VIEW_NODE, &show_ip_prefix_list_prefix_cmd); - install_element (VIEW_NODE, &show_ip_prefix_list_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_prefix_list_prefix_first_match_cmd); install_element (VIEW_NODE, &show_ip_prefix_list_summary_cmd); - install_element (VIEW_NODE, &show_ip_prefix_list_summary_name_cmd); install_element (VIEW_NODE, &show_ip_prefix_list_detail_cmd); - install_element (VIEW_NODE, &show_ip_prefix_list_detail_name_cmd); install_element (ENABLE_NODE, &clear_ip_prefix_list_cmd); - install_element (ENABLE_NODE, &clear_ip_prefix_list_name_cmd); - install_element (ENABLE_NODE, &clear_ip_prefix_list_name_prefix_cmd); } /* Prefix-list node. */ @@ -3261,49 +2203,21 @@ prefix_list_init_ipv6 (void) install_node (&prefix_ipv6_node, config_write_prefix_ipv6); install_element (CONFIG_NODE, &ipv6_prefix_list_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_ge_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_ge_le_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_le_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_le_ge_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_seq_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_seq_ge_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_seq_ge_le_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_seq_le_cmd); - install_element (CONFIG_NODE, &ipv6_prefix_list_seq_le_ge_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_prefix_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_ge_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_ge_le_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_le_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_le_ge_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_ge_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_ge_le_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_le_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_le_ge_cmd); + install_element (CONFIG_NODE, &no_ipv6_prefix_list_all_cmd); install_element (CONFIG_NODE, &ipv6_prefix_list_description_cmd); install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_cmd); install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_comment_cmd); install_element (CONFIG_NODE, &ipv6_prefix_list_sequence_number_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_sequence_number_cmd); install_element (VIEW_NODE, &show_ipv6_prefix_list_cmd); - install_element (VIEW_NODE, &show_ipv6_prefix_list_name_cmd); - install_element (VIEW_NODE, &show_ipv6_prefix_list_name_seq_cmd); install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_first_match_cmd); install_element (VIEW_NODE, &show_ipv6_prefix_list_summary_cmd); - install_element (VIEW_NODE, &show_ipv6_prefix_list_summary_name_cmd); install_element (VIEW_NODE, &show_ipv6_prefix_list_detail_cmd); - install_element (VIEW_NODE, &show_ipv6_prefix_list_detail_name_cmd); install_element (ENABLE_NODE, &clear_ipv6_prefix_list_cmd); - install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_cmd); - install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_prefix_cmd); } void