aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/vty.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-05-22 17:35:49 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2018-05-25 15:41:35 +0200
commitf1e2d08022cf1cc7682ae5b618476ad7acb4f53a (patch)
tree2a2c245414edeca4e7f3a6fe838777d43397f941 /src/common/vty.c
parentae3da5f8c3761567c69c2bb8866ac6a5a51eeb7f (diff)
rtp: make port range configurable, assign correct port numbers
The current implementation does not allow the user to specify a port range in which the BTS is allowed to allocate a local RTP port. Also the ports the BTS picks do not match the policy described in RFC3550. An RTP Port must be at an even port number and the matching RTCP port must be at the following (odd) port number. The BTS currently picks random port numbers for both. - Add a VTY command to specify a port range in which the BTS may assign local ports. - Pick ports as described in RFC3550. Change-Id: Id75f1dfaf898ed8750d28b1c4840e188f4cfdc87 Related: OS#2825 OS#2635
Diffstat (limited to 'src/common/vty.c')
-rw-r--r--src/common/vty.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/common/vty.c b/src/common/vty.c
index 2716a7a7..60613352 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -262,6 +262,8 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
if (bts->rtp_jitter_adaptive)
vty_out(vty, " adaptive");
vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out(vty, " rtp port-range %u %u%s", bts->rtp_port_range_start,
+ bts->rtp_port_range_end, VTY_NEWLINE);
vty_out(vty, " paging queue-size %u%s", paging_get_queue_max(bts->paging_state),
VTY_NEWLINE);
vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(bts->paging_state),
@@ -486,6 +488,43 @@ DEFUN(cfg_bts_rtp_jitbuf,
return CMD_SUCCESS;
}
+DEFUN(cfg_bts_rtp_port_range,
+ cfg_bts_rtp_port_range_cmd,
+ "rtp port-range <1-65534> <1-65534>",
+ RTP_STR "Range of local ports to use for RTP/RTCP traffic\n")
+{
+ struct gsm_bts *bts = vty->index;
+ unsigned int start;
+ unsigned int end;
+
+ start = atoi(argv[0]);
+ end = atoi(argv[1]);
+
+ if (end < start) {
+ vty_out(vty, "range end port (%u) must be greater than the range start port (%u)!%s",
+ end, start, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (start & 1) {
+ vty_out(vty, "range must begin at an even port number! (%u not even)%s",
+ start, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if ((end & 1) == 0) {
+ vty_out(vty, "range must end at an odd port number! (%u not odd)%s",
+ end, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ bts->rtp_port_range_start = start;
+ bts->rtp_port_range_end = end;
+ bts->rtp_port_range_next = bts->rtp_port_range_start;
+
+ return CMD_SUCCESS;
+}
+
#define PAG_STR "Paging related parameters\n"
DEFUN(cfg_bts_paging_queue_size,
@@ -1554,6 +1593,7 @@ int bts_vty_init(struct gsm_bts *bts, const struct log_info *cat)
install_element(BTS_NODE, &cfg_bts_oml_ip_cmd);
install_element(BTS_NODE, &cfg_bts_rtp_bind_ip_cmd);
install_element(BTS_NODE, &cfg_bts_rtp_jitbuf_cmd);
+ install_element(BTS_NODE, &cfg_bts_rtp_port_range_cmd);
install_element(BTS_NODE, &cfg_bts_band_cmd);
install_element(BTS_NODE, &cfg_description_cmd);
install_element(BTS_NODE, &cfg_no_description_cmd);