aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-29 10:06:15 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-29 10:11:21 +0100
commitdb64f2e45adf7ac95070361f5b7ec76a44e084fb (patch)
treef0c0c198d982ac419bb39d154b5eba01889f855b
parent76606d3473b61963a4d87bdad9f002e6191b9ece (diff)
bsc: Allow to disable sending ping/pong to the MSC
Some switches do not like to receive the IPA PING/PONG messages. Allow to disable the handling with "no timeout-ping" and create test cases that verify the switching between the modes. Change the code to trat <= 0 as an invalid timeout. Fixes: SYS#713
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_api.c2
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_msc.c2
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_vty.c35
-rw-r--r--openbsc/tests/vty_test_runner.py42
4 files changed, 73 insertions, 8 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c
index 6bda3d430..2c661b3cf 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_api.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c
@@ -167,7 +167,7 @@ static int complete_layer3(struct gsm_subscriber_connection *conn,
/* Advanced ping/pong handling */
if (osmo_timer_pending(&msc->pong_timer))
send_ping = 0;
- if (msc->ping_timeout == 0)
+ if (msc->ping_timeout <= 0)
send_ping = 0;
if (send_ping && osmo_timer_remaining(&msc->ping_timer, NULL, &tv) == -1)
send_ping = 0;
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
index 5f2c1c52f..e762cddff 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
@@ -346,7 +346,7 @@ static void schedule_ping_pong(struct osmo_msc_data *data)
static void msc_ping_timeout_cb(void *_data)
{
struct osmo_msc_data *data = (struct osmo_msc_data *) _data;
- if (data->ping_timeout < 0)
+ if (data->ping_timeout <= 0)
return;
send_ping(data);
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
index ed4b05e93..4d5a55d88 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
@@ -110,12 +110,17 @@ static void write_msc(struct vty *vty, struct osmo_msc_data *msc)
vty_out(vty, " core-mobile-country-code %d%s",
msc->core_mcc, VTY_NEWLINE);
vty_out(vty, " ip.access rtp-base %d%s", msc->rtp_base, VTY_NEWLINE);
- vty_out(vty, " timeout-ping %d%s", msc->ping_timeout, VTY_NEWLINE);
- vty_out(vty, " timeout-pong %d%s", msc->pong_timeout, VTY_NEWLINE);
- if (msc->advanced_ping)
- vty_out(vty, " timeout-ping advanced%s", VTY_NEWLINE);
- else
- vty_out(vty, " no timeout-ping advanced%s", VTY_NEWLINE);
+
+ if (msc->ping_timeout == -1)
+ vty_out(vty, " no timeout-ping%s", VTY_NEWLINE);
+ else {
+ vty_out(vty, " timeout-ping %d%s", msc->ping_timeout, VTY_NEWLINE);
+ vty_out(vty, " timeout-pong %d%s", msc->pong_timeout, VTY_NEWLINE);
+ if (msc->advanced_ping)
+ vty_out(vty, " timeout-ping advanced%s", VTY_NEWLINE);
+ else
+ vty_out(vty, " no timeout-ping advanced%s", VTY_NEWLINE);
+ }
if (msc->ussd_welcome_txt)
vty_out(vty, " bsc-welcome-text %s%s", msc->ussd_welcome_txt, VTY_NEWLINE);
@@ -355,6 +360,16 @@ DEFUN(cfg_net_msc_no_dest,
return CMD_SUCCESS;
}
+DEFUN(cfg_net_msc_no_ping_time,
+ cfg_net_msc_no_ping_time_cmd,
+ "no timeout-ping",
+ NO_STR "Disable the ping/pong handling on A-link\n")
+{
+ struct osmo_msc_data *data = osmo_msc_data(vty);
+ data->ping_timeout = -1;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_net_msc_ping_time,
cfg_net_msc_ping_time_cmd,
"timeout-ping <1-2147483647>",
@@ -382,6 +397,13 @@ DEFUN(cfg_net_msc_advanced_ping,
"Ping timeout handling\nEnable advanced mode during SCCP\n")
{
struct osmo_msc_data *data = osmo_msc_data(vty);
+
+ if (data->ping_timeout == -1) {
+ vty_out(vty, "%%ping handling is disabled. Enable it first.%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
data->advanced_ping = 1;
return CMD_SUCCESS;
}
@@ -741,6 +763,7 @@ int bsc_vty_init_extra(void)
install_element(MSC_NODE, &cfg_net_bsc_codec_list_cmd);
install_element(MSC_NODE, &cfg_net_msc_dest_cmd);
install_element(MSC_NODE, &cfg_net_msc_no_dest_cmd);
+ install_element(MSC_NODE, &cfg_net_msc_no_ping_time_cmd);
install_element(MSC_NODE, &cfg_net_msc_ping_time_cmd);
install_element(MSC_NODE, &cfg_net_msc_pong_time_cmd);
install_element(MSC_NODE, &cfg_net_msc_advanced_ping_cmd);
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index ece9ac554..10e1ae425 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -419,6 +419,48 @@ class TestVTYBSC(TestVTYGenericBSC):
res = self.vty.command("show network")
self.assert_(res.startswith('BSC is on Country Code') >= 0)
+ def testPingPongConfiguration(self):
+ self.vty.enable()
+ self.vty.verify("configure terminal", [''])
+ self.vty.verify("network", [''])
+ self.vty.verify("msc 0", [''])
+
+ self.vty.verify("timeout-ping 12", [''])
+ self.vty.verify("timeout-pong 14", [''])
+ res = self.vty.command("show running-config")
+ self.assert_(res.find(" timeout-ping 12") > 0)
+ self.assert_(res.find(" timeout-pong 14") > 0)
+ self.assert_(res.find(" no timeout-ping advanced") > 0)
+
+ self.vty.verify("timeout-ping advanced", [''])
+ res = self.vty.command("show running-config")
+ self.assert_(res.find(" timeout-ping 12") > 0)
+ self.assert_(res.find(" timeout-pong 14") > 0)
+ self.assert_(res.find(" timeout-ping advanced") > 0)
+
+ self.vty.verify("no timeout-ping advanced", [''])
+ res = self.vty.command("show running-config")
+ self.assert_(res.find(" timeout-ping 12") > 0)
+ self.assert_(res.find(" timeout-pong 14") > 0)
+ self.assert_(res.find(" no timeout-ping advanced") > 0)
+
+ self.vty.verify("no timeout-ping", [''])
+ res = self.vty.command("show running-config")
+ self.assertEquals(res.find(" timeout-ping 12"), -1)
+ self.assertEquals(res.find(" timeout-pong 14"), -1)
+ self.assertEquals(res.find(" no timeout-ping advanced"), -1)
+ self.assert_(res.find(" no timeout-ping") > 0)
+
+ self.vty.verify("timeout-ping advanced", ['%ping handling is disabled. Enable it first.'])
+
+ # And back to enabling it
+ self.vty.verify("timeout-ping 12", [''])
+ self.vty.verify("timeout-pong 14", [''])
+ res = self.vty.command("show running-config")
+ self.assert_(res.find(" timeout-ping 12") > 0)
+ self.assert_(res.find(" timeout-pong 14") > 0)
+ self.assert_(res.find(" timeout-ping advanced") > 0)
+
class TestVTYNAT(TestVTYGenericBSC):
def vty_command(self):