9
0
Fork 0

stp: Allow/Disallow to inject messages on the UDP/M2UA interface

This commit is contained in:
Holger Hans Peter Freyther 2011-02-10 12:39:05 +01:00
parent 0452f22a21
commit ee63d7d15e
3 changed files with 14 additions and 1 deletions

View File

@ -136,6 +136,7 @@ struct bsc_data {
int forward_only;
/* inject */
int allow_inject;
struct bsc_fd inject_fd;
struct llist_head inject_list;
};

View File

@ -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");

View File

@ -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);