stp: Allow/Disallow to inject messages on the UDP/M2UA interface
This commit is contained in:
parent
0452f22a21
commit
ee63d7d15e
|
@ -136,6 +136,7 @@ struct bsc_data {
|
|||
int forward_only;
|
||||
|
||||
/* inject */
|
||||
int allow_inject;
|
||||
struct bsc_fd inject_fd;
|
||||
struct llist_head inject_list;
|
||||
};
|
||||
|
|
|
@ -206,6 +206,11 @@ static int inject_read_cb(struct bsc_fd *fd, unsigned int what)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!bsc->allow_inject) {
|
||||
LOGP(DINP, LOGL_ERROR, "Injecting messages is not allowed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
m2ua = m2ua_from_msg(rc, buf);
|
||||
if (!m2ua) {
|
||||
LOGP(DINP, LOGL_ERROR, "Failed to parse M2UA.\n");
|
||||
|
|
|
@ -516,7 +516,13 @@ DEFUN(lnk_reset, lnk_reset_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DEFUN(allow_inject, allow_inject_cmd,
|
||||
"allow-inject (0|1)",
|
||||
"Allow to inject messages\n" "Disable\n" "Enable\n")
|
||||
{
|
||||
bsc.allow_inject = atoi(argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
void cell_vty_init(void)
|
||||
{
|
||||
|
@ -556,6 +562,7 @@ void cell_vty_init(void)
|
|||
install_element(ENABLE_NODE, &lnk_block_cmd);
|
||||
install_element(ENABLE_NODE, &lnk_unblock_cmd);
|
||||
install_element(ENABLE_NODE, &lnk_reset_cmd);
|
||||
install_element(ENABLE_NODE, &allow_inject_cmd);
|
||||
|
||||
/* show commands */
|
||||
install_element_ve(&show_stats_cmd);
|
||||
|
|
Reference in New Issue