summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgpd.c12
-rw-r--r--lib/command.h2
-rw-r--r--lib/command_match.c6
-rw-r--r--lib/grammar_sandbox.c18
4 files changed, 16 insertions, 22 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index d76d5b0b7e..188da7014d 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1151,15 +1151,13 @@ struct peer *peer_new(struct bgp *bgp)
* - We RX a BGP_UPDATE where the attributes alone are just
* under BGP_MAX_PACKET_SIZE
* - The user configures an outbound route-map that does many as-path
- * prepends or adds many communities. At most they can have
- * CMD_ARGC_MAX
- * args in a route-map so there is a finite limit on how large they
- * can
- * make the attributes.
+ * prepends or adds many communities. At most they can have
+ * CMD_ARGC_MAX args in a route-map so there is a finite limit on how
+ * large they can make the attributes.
*
* Having a buffer with BGP_MAX_PACKET_SIZE_OVERFLOW allows us to avoid
- * bounds
- * checking for every single attribute as we construct an UPDATE.
+ * bounds checking for every single attribute as we construct an
+ * UPDATE.
*/
peer->obuf_work =
stream_new(BGP_MAX_PACKET_SIZE + BGP_MAX_PACKET_SIZE_OVERFLOW);
diff --git a/lib/command.h b/lib/command.h
index 42dd1c5325..fa8323bf2d 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -190,7 +190,7 @@ struct cmd_node {
#define CMD_NOT_MY_INSTANCE 14
/* Argc max counts. */
-#define CMD_ARGC_MAX 25
+#define CMD_ARGC_MAX 256
/* Turn off these macros when uisng cpp with extract.pl */
#ifndef VTYSH_EXTRACT_PL
diff --git a/lib/command_match.c b/lib/command_match.c
index c60373f910..f6b07a0b20 100644
--- a/lib/command_match.c
+++ b/lib/command_match.c
@@ -28,8 +28,6 @@
DEFINE_MTYPE_STATIC(LIB, CMD_MATCHSTACK, "Command Match Stack")
-#define MAXDEPTH 256
-
#ifdef TRACE_MATCHER
#define TM 1
#else
@@ -84,7 +82,7 @@ static enum match_type match_mac(const char *, bool);
enum matcher_rv command_match(struct graph *cmdgraph, vector vline,
struct list **argv, const struct cmd_element **el)
{
- struct graph_node *stack[MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
enum matcher_rv status;
*argv = NULL;
@@ -200,7 +198,7 @@ static enum matcher_rv command_match_r(struct graph_node *start, vector vline,
/* check history/stack of tokens
* this disallows matching the same one more than once if there is a
* circle in the graph (used for keyword arguments) */
- if (n == MAXDEPTH)
+ if (n == CMD_ARGC_MAX)
return MATCHER_NO_MATCH;
if (!token->allowrepeat)
for (size_t s = 0; s < n; s++)
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 66b042ad97..79c951dd69 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -33,8 +33,6 @@
DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command desc")
-#define MAXDEPTH 64
-
/** headers **/
void grammar_sandbox_init(void);
void pretty_print_graph(struct vty *vty, struct graph_node *, int, int,
@@ -262,7 +260,7 @@ DEFUN (grammar_test_show,
{
check_nodegraph();
- struct graph_node *stack[MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
pretty_print_graph(vty, vector_slot(nodegraph->nodes, 0), 0, argc >= 3,
stack, 0);
return CMD_SUCCESS;
@@ -277,8 +275,8 @@ DEFUN (grammar_test_dot,
{
check_nodegraph();
- struct graph_node *stack[MAXDEPTH];
- struct graph_node *visited[MAXDEPTH * MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
+ struct graph_node *visited[CMD_ARGC_MAX * CMD_ARGC_MAX];
size_t vpos = 0;
FILE *ofd = fopen(argv[2]->arg, "w");
@@ -334,7 +332,7 @@ static void cmd_graph_permute(struct list *out, struct graph_node **stack,
return;
}
- if (++stackpos == MAXDEPTH)
+ if (++stackpos == CMD_ARGC_MAX)
return;
for (i = 0; i < vector_active(gn->to); i++) {
@@ -354,7 +352,7 @@ static void cmd_graph_permute(struct list *out, struct graph_node **stack,
static struct list *cmd_graph_permutations(struct graph *graph)
{
char accumulate[2048] = "";
- struct graph_node *stack[MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
struct list *rv = list_new();
rv->cmp = cmd_permute_cmp;
@@ -532,7 +530,7 @@ void pretty_print_graph(struct vty *vty, struct graph_node *start, int level,
vty_out(vty, " ?'%s'", tok->desc);
vty_out(vty, " ");
- if (stackpos == MAXDEPTH) {
+ if (stackpos == CMD_ARGC_MAX) {
vty_out(vty, " -aborting! (depth limit)\n");
return;
}
@@ -586,7 +584,7 @@ static void pretty_print_dot(FILE *ofd, unsigned opts, struct graph_node *start,
if (visited[i] == start)
return;
visited[(*visitpos)++] = start;
- if ((*visitpos) == MAXDEPTH * MAXDEPTH)
+ if ((*visitpos) == CMD_ARGC_MAX * CMD_ARGC_MAX)
return;
snprintf(tokennum, sizeof(tokennum), "%d?", tok->type);
@@ -626,7 +624,7 @@ static void pretty_print_dot(FILE *ofd, unsigned opts, struct graph_node *start,
}
fprintf(ofd, ">, style = filled, fillcolor = \"%s\" ];\n", color);
- if (stackpos == MAXDEPTH)
+ if (stackpos == CMD_ARGC_MAX)
return;
stack[stackpos++] = start;