Skip to content

Commit c5b068a

Browse files
authored
Merge pull request FRRouting#20110 from raja-rajasekar/rajasekarr/cli_limit
increasing vtysh cli length constraint
2 parents 6ba1137 + 5d3e23f commit c5b068a

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

lib/vty.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,7 @@ static void vtysh_read(struct event *event)
24232423
/* Clear command line buffer. */
24242424
vty->cp = vty->length = 0;
24252425
vty_clear_buf(vty);
2426+
flog_err(EC_LIB_VTY, "Command too long (%d bytes): %.80s...", nbytes, buf);
24262427
vty_out(vty, "%% Command is too long.\n");
24272428
} else {
24282429
for (p = buf; p < buf + nbytes; p++) {

lib/vty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern "C" {
2525
struct json_object;
2626
struct frregex;
2727

28-
#define VTY_BUFSIZ 4096
28+
#define VTY_BUFSIZ 8192
2929
#define VTY_MAXHIST 20
3030
#define VTY_MAXDEPTH 8
3131

tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,58 @@ def test_large_community_after_clear_bgp(request):
12111211
write_test_footer(tc_name)
12121212

12131213

1214+
def test_large_community_buffer_limit(request):
1215+
"""
1216+
Verify that setting 150 large communities with maximum sized values
1217+
(approximately 4770 bytes) works properly. This tests the buffer limit
1218+
increase from 4096 to 8192 bytes.
1219+
"""
1220+
tc_name = request.node.name
1221+
write_test_header(tc_name)
1222+
tgen = get_topogen()
1223+
1224+
if tgen.routers_have_failure():
1225+
pytest.skip(tgen.errors)
1226+
1227+
# Generate 150 large communities with maximum sized values (4294967295:4294967295:4294967XXX)
1228+
# Each community is approximately 31 bytes, total ~4770 bytes
1229+
large_comm_values = []
1230+
for i in range(1, 151):
1231+
large_comm_values.append(f"4294967295:4294967295:{4294967000 + i}")
1232+
1233+
large_comm_str = " ".join(large_comm_values)
1234+
1235+
step("Configuring route-map with 150 large communities (~4770 bytes)")
1236+
router = tgen.gears["r1"]
1237+
1238+
try:
1239+
output = router.vtysh_cmd(
1240+
f"""
1241+
configure terminal
1242+
route-map LARGE_COMM_150 permit 10
1243+
set large-community {large_comm_str}
1244+
"""
1245+
)
1246+
step("Successfully applied configuration")
1247+
except Exception as e:
1248+
step(f"Configuration failed (may indicate buffer limit issue): {e}")
1249+
pytest.fail(
1250+
"Failed to configure 150 large communities - buffer limit may be too small"
1251+
)
1252+
1253+
step("Verifying route-map configuration with 150 large communities")
1254+
output = router.vtysh_cmd("show running-config")
1255+
assert (
1256+
"route-map LARGE_COMM_150 permit 10" in output
1257+
), f"Test case {tc_name} : Failed - route-map not found in configuration"
1258+
assert (
1259+
"4294967295:4294967295" in output
1260+
), f"Test case {tc_name} : Failed - large communities not found in configuration"
1261+
1262+
step("Test passed: Successfully configured 150 large communities (~4770 bytes)")
1263+
write_test_footer(tc_name)
1264+
1265+
12141266
if __name__ == "__main__":
12151267
args = ["-s"] + sys.argv[1:]
12161268
sys.exit(pytest.main(args))

0 commit comments

Comments
 (0)