Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.0 backports #8827

Merged
merged 44 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
92e19ec
ospf6d: unlink router from vrf on deletion
idryzhov May 27, 2021
4ef2323
pceplib: fix mixup of global/local variables
idryzhov May 28, 2021
09cbc07
isisd, ospf6d, pimd: set vrf_id when creating bfd sessions
idryzhov May 31, 2021
00574f0
isisd: fix using vrf interface as a loopback
idryzhov May 28, 2021
b144fae
ospf6d: fix using vrf interface as a loopback
idryzhov May 28, 2021
0e99a6c
bgpd: pass correct vrf_id to vrf_socket when creating bgp view socket
idryzhov May 31, 2021
cd89989
lib: fix binding to a vrf
idryzhov May 6, 2021
21cd75a
tests: remove tcp_l3mdev_accept setting
idryzhov May 7, 2021
fb6c9eb
doc: update VRF support description
idryzhov May 12, 2021
bfe3510
pathd: fix render candidate-path bandwidth
edipascale May 18, 2021
093a8f6
doc: Replace single tick with double tick under developer/topotests.rst
ton31337 Jun 2, 2021
753c7da
ospfd: if destroy the whole ospf, then remove ospf's interface config…
anlancs Jun 2, 2021
3f30364
doc: remove varnames from command descriptions
idryzhov Jun 2, 2021
9e3fd54
bfdd: fix bfd key structure
idryzhov Jun 1, 2021
1077c27
doc: fix link-params commands
idryzhov Jun 2, 2021
1627291
doc: add separate section for nexthop tracking
idryzhov Jun 2, 2021
b273ee4
lib, vtysh: reduce code duplication
idryzhov Jun 2, 2021
8010eb4
lib: fix output of "list" and "find" commands
idryzhov Jun 2, 2021
1d91cb7
bgpd: fix enabling bfd debug
idryzhov May 28, 2021
aeae109
lib: fix bfd multihop
idryzhov May 27, 2021
15a1754
lib: fix default ttl for single-hop bfd sessions
idryzhov Jun 1, 2021
ccb83eb
bfdd: don't store interface pointer for multihop sessions
idryzhov May 28, 2021
55d9ae7
bfdd: forbid setting interface for multihop sessions
idryzhov May 28, 2021
8ab721b
zebra: fix config after exit from vrf
idryzhov Jun 2, 2021
39a0be2
lib: fix address sanitizer crash on `find`
rzalamena Jun 7, 2021
86147fc
ospfd: fix passive interface configuration
idryzhov Jun 4, 2021
3b9c5af
doc: replace "passive-interface IFNAME" with "ip ospf passive"
idryzhov Jun 5, 2021
e68ecdc
ospfd: fix GR helper initialization and termination
rwestphal May 31, 2021
bb590fa
ospfd: fix small issue when exiting from the GR helper mode
rwestphal May 31, 2021
fc2ef24
ospfd: fix crash when logging a Grace-LSA
rwestphal May 31, 2021
16e7fe2
ospfd: fix dangling pointer when exiting from the helper mode
rwestphal May 31, 2021
d11e0c8
ospfd: fix null pointer dereference when flushing an opaque LSA
rwestphal May 31, 2021
8ff13a6
ospfd: fix cleanup of MaxAge LSAs on exit
rwestphal May 31, 2021
8f2eb95
ospfd: fix logging of what triggered the SPF run
rwestphal May 31, 2021
dd65dbe
zebra, ospfd: fix typos in the graceful restart code
rwestphal May 31, 2021
cd63b18
ospfd: fix wrong NSSA debug guards
rwestphal May 31, 2021
8e25bd9
lib, ospfd, ospf6d: fix logging of pointer addresses
rwestphal May 31, 2021
6a74bca
ospfd: fix crash when displaying neighbor data in JSON
rwestphal May 31, 2021
de4b84a
zebra: Give extra space and stop processing if we run out of space
donaldsharp Jun 8, 2021
8e85b98
ospfd: fix memory leaks in summarization
idryzhov Jun 8, 2021
0f7e131
tests: fix ospf6_topo1_vrf
idryzhov Jun 7, 2021
11712da
ospf6d: fix interface area configuration
idryzhov May 25, 2021
83ba066
doc: replace "interface IFNAME area" with "ipv6 ospf6 area"
idryzhov May 25, 2021
2cfc327
tests: replace "interface IFNAME area" with "ipv6 ospf6 area"
idryzhov Jun 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lib, vtysh: reduce code duplication
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
  • Loading branch information
idryzhov committed Jun 8, 2021
commit b273ee4410f252e0aef045ac19145a10803fbfc8
15 changes: 10 additions & 5 deletions lib/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -2231,11 +2231,7 @@ DEFUN (no_banner_motd,
return CMD_SUCCESS;
}

DEFUN(find,
find_cmd,
"find REGEX...",
"Find CLI command matching a regular expression\n"
"Search pattern (POSIX regex)\n")
int cmd_find_cmds(struct vty *vty, struct cmd_token **argv, int argc)
{
const struct cmd_node *node;
const struct cmd_element *cli;
Expand Down Expand Up @@ -2313,6 +2309,15 @@ DEFUN(find,
return CMD_SUCCESS;
}

DEFUN(find,
find_cmd,
"find REGEX...",
"Find CLI command matching a regular expression\n"
"Search pattern (POSIX regex)\n")
{
return cmd_find_cmds(vty, argv, argc);
}

#if defined(DEV_BUILD) && defined(HAVE_SCRIPTING)
DEFUN(script,
script_cmd,
Expand Down
1 change: 1 addition & 0 deletions lib/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ extern void cmd_init_config_callbacks(void (*start_config_cb)(void),
extern void cmd_terminate(void);
extern void cmd_exit(struct vty *vty);
extern int cmd_list_cmds(struct vty *vty, int do_permute);
extern int cmd_find_cmds(struct vty *vty, struct cmd_token **argv, int argc);

extern int cmd_domainname_set(const char *domainname);
extern int cmd_hostname_set(const char *hostname);
Expand Down
74 changes: 1 addition & 73 deletions vtysh/vtysh.c
Original file line number Diff line number Diff line change
Expand Up @@ -3619,79 +3619,7 @@ DEFUN(find,
"Find CLI command matching a regular expression\n"
"Search pattern (POSIX regex)\n")
{
const struct cmd_node *node;
const struct cmd_element *cli;
vector clis;
regex_t exp = {};
char *pattern = argv_concat(argv, argc, 1);
int cr = regcomp(&exp, pattern, REG_NOSUB | REG_EXTENDED);

XFREE(MTYPE_TMP, pattern);

if (cr != 0) {
switch (cr) {
case REG_BADBR:
vty_out(vty, "%% Invalid \\{...\\} expression\n");
break;
case REG_BADRPT:
vty_out(vty, "%% Bad repetition operator\n");
break;
case REG_BADPAT:
vty_out(vty, "%% Regex syntax error\n");
break;
case REG_ECOLLATE:
vty_out(vty, "%% Invalid collating element\n");
break;
case REG_ECTYPE:
vty_out(vty, "%% Invalid character class name\n");
break;
case REG_EESCAPE:
vty_out(vty,
"%% Regex ended with escape character (\\)\n");
break;
case REG_ESUBREG:
vty_out(vty,
"%% Invalid number in \\digit construction\n");
break;
case REG_EBRACK:
vty_out(vty, "%% Unbalanced square brackets\n");
break;
case REG_EPAREN:
vty_out(vty, "%% Unbalanced parentheses\n");
break;
case REG_EBRACE:
vty_out(vty, "%% Unbalanced braces\n");
break;
case REG_ERANGE:
vty_out(vty,
"%% Invalid endpoint in range expression\n");
break;
case REG_ESPACE:
vty_out(vty, "%% Failed to compile (out of memory)\n");
break;
}

goto done;
}


for (unsigned int i = 0; i < vector_active(cmdvec); i++) {
node = vector_slot(cmdvec, i);
if (!node)
continue;
clis = node->cmd_vector;
for (unsigned int j = 0; j < vector_active(clis); j++) {
cli = vector_slot(clis, j);

if (regexec(&exp, cli->string, 0, NULL, 0) == 0)
vty_out(vty, " (%s) %s\n",
node->name, cli->string);
}
}

done:
regfree(&exp);
return CMD_SUCCESS;
return cmd_find_cmds(vty, argv, argc);
}

DEFUN_HIDDEN(show_cli_graph_vtysh,
Expand Down