osmux: Allow to listen to a specific address

For a setup with multiple network interfaces be able to pick
the one that osmux should be used/visible.
This commit is contained in:
Holger Hans Peter Freyther 2015-10-12 20:06:16 +02:00
parent 9861c122dd
commit a777c9ee3d
4 changed files with 16 additions and 1 deletions

View File

@ -220,6 +220,8 @@ struct mgcp_config {
/* osmux translator: 0 means disabled, 1 means enabled */
int osmux;
/* addr to bind the server to */
char *osmux_addr;
/* The BSC-NAT may ask for enabling osmux on demand. This tells us if
* the osmux socket is already initialized.
*/

View File

@ -415,7 +415,7 @@ int osmux_init(int role, struct mgcp_config *cfg)
}
osmux_fd.data = cfg;
ret = mgcp_create_bind("0.0.0.0", &osmux_fd, cfg->osmux_port);
ret = mgcp_create_bind(cfg->osmux_addr, &osmux_fd, cfg->osmux_port);
if (ret < 0) {
LOGP(DMGCP, LOGL_ERROR, "cannot bind OSMUX socket\n");
return ret;

View File

@ -1193,6 +1193,7 @@ struct mgcp_config *mgcp_config_alloc(void)
cfg->source_port = 2427;
cfg->source_addr = talloc_strdup(cfg, "0.0.0.0");
cfg->osmux_addr = talloc_strdup(cfg, "0.0.0.0");
cfg->transcoder_remote_base = 4000;

View File

@ -153,6 +153,8 @@ static int config_write_mgcp(struct vty *vty)
break;
}
if (g_cfg->osmux) {
vty_out(vty, " osmux bind-ip %s%s",
g_cfg->osmux_addr, VTY_NEWLINE);
vty_out(vty, " osmux batch-factor %d%s",
g_cfg->osmux_batch, VTY_NEWLINE);
vty_out(vty, " osmux batch-size %u%s",
@ -1282,6 +1284,15 @@ DEFUN(cfg_mgcp_osmux,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_osmux_ip,
cfg_mgcp_osmux_ip_cmd,
"osmux bind-ip A.B.C.D",
OSMUX_STR IP_STR "IPv4 Address to bind to\n")
{
bsc_replace_string(g_cfg, &g_cfg->osmux_addr, argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_osmux_batch_factor,
cfg_mgcp_osmux_batch_factor_cmd,
"osmux batch-factor <1-8>",
@ -1382,6 +1393,7 @@ int mgcp_vty_init(void)
install_element(MGCP_NODE, &cfg_mgcp_sdp_payload_send_name_cmd);
install_element(MGCP_NODE, &cfg_mgcp_no_sdp_payload_send_name_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_ip_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_factor_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_size_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_port_cmd);