[MERGED] openbsc[master]: GSM timers: User reasonable defaults; don't save if equal de...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Jul 20 09:55:46 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: GSM timers: User reasonable defaults; don't save if equal default
......................................................................


GSM timers: User reasonable defaults; don't save if equal default

A number of the GSM timers (including T3109) had no reasonable
default values if not specified in the VTY / config file.  Together
with unconditional writing to the config file, this created
config files with a persistent setting for important timers as '0'.

To make things worse, many of our example cofig files suffered from the
same problem.

Let's avoid this from happening by
* having reasonable defaults if nothing specified in the config file
* conditionally savingg timers only if they differ from default
* reject any timer values that state zero during start-up (see previous
  commit)

Change-Id: Iaac0bfca423852b61d8b9eb1438157ef00d0d8c8
Closes: OS#2380
---
M openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
M openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx-hopping.cfg
M openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx.cfg
M openbsc/doc/examples/osmo-nitb/bs11/openbsc-2bts-2trx.cfg
M openbsc/doc/examples/osmo-nitb/bs11/openbsc.cfg
M openbsc/doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg
M openbsc/doc/examples/osmo-nitb/nanobts/openbsc.cfg
M openbsc/doc/examples/osmo-nitb/nokia/openbsc_nokia_3trx.cfg
M openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg
M openbsc/doc/examples/osmo-nitb/sysmobts/openbsc.cfg
M openbsc/include/openbsc/gsm_data.h
M openbsc/src/libbsc/bsc_vty.c
M openbsc/src/libbsc/net_init.c
13 files changed, 35 insertions(+), 91 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg b/openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
index 56e4724..ab23a76 100644
--- a/openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
+++ b/openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
@@ -28,18 +28,6 @@
  handover power budget interval 6
  handover power budget hysteresis 3
  handover maximum distance 9999
- timer t3101 10
- timer t3103 0
- timer t3105 0
- timer t3107 0
- timer t3109 0
- timer t3111 0
- timer t3113 60
- timer t3115 0
- timer t3117 0
- timer t3119 0
- timer t3122 0
- timer t3141 0
  subscriber-keep-in-ram 0
  bts 0
   type nanobts
diff --git a/openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx-hopping.cfg b/openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx-hopping.cfg
index 6730644..dbb9cff 100644
--- a/openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx-hopping.cfg
+++ b/openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx-hopping.cfg
@@ -26,17 +26,6 @@
  handover power budget interval 6
  handover power budget hysteresis 3
  handover maximum distance 9999
- timer t3101 10
- timer t3103 0
- timer t3105 0
- timer t3107 0
- timer t3109 4
- timer t3111 0
- timer t3113 60
- timer t3115 0
- timer t3117 0
- timer t3119 0
- timer t3141 0
  bts 0
   type bs11
   band GSM900
diff --git a/openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx.cfg b/openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx.cfg
index ca5689f..02ff4b8 100644
--- a/openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx.cfg
+++ b/openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx.cfg
@@ -13,8 +13,6 @@
  mobile network code 1
  short name OpenBSC
  long name OpenBSC
- timer t3101 10
- timer t3113 60
  bts 0
   type bs11
   band GSM900
diff --git a/openbsc/doc/examples/osmo-nitb/bs11/openbsc-2bts-2trx.cfg b/openbsc/doc/examples/osmo-nitb/bs11/openbsc-2bts-2trx.cfg
index 4f194c0..47b8d46 100644
--- a/openbsc/doc/examples/osmo-nitb/bs11/openbsc-2bts-2trx.cfg
+++ b/openbsc/doc/examples/osmo-nitb/bs11/openbsc-2bts-2trx.cfg
@@ -11,8 +11,6 @@
  mobile network code 1
  short name OpenBSC
  long name OpenBSC
- timer t3101 10
- timer t3113 60
  bts 0
   type bs11
   band GSM900
diff --git a/openbsc/doc/examples/osmo-nitb/bs11/openbsc.cfg b/openbsc/doc/examples/osmo-nitb/bs11/openbsc.cfg
index 6c47a90..bcb0b98 100644
--- a/openbsc/doc/examples/osmo-nitb/bs11/openbsc.cfg
+++ b/openbsc/doc/examples/osmo-nitb/bs11/openbsc.cfg
@@ -13,8 +13,6 @@
  mobile network code 1
  short name OpenBSC
  long name OpenBSC
- timer t3101 10
- timer t3113 60
  bts 0
   type bs11
   band GSM900
diff --git a/openbsc/doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg b/openbsc/doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg
index 3277bea..7c03ed5 100644
--- a/openbsc/doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg
+++ b/openbsc/doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg
@@ -26,17 +26,6 @@
  handover power budget interval 6
  handover power budget hysteresis 3
  handover maximum distance 9999
- timer t3101 10
- timer t3103 0
- timer t3105 0
- timer t3107 0
- timer t3109 4
- timer t3111 0
- timer t3113 60
- timer t3115 0
- timer t3117 0
- timer t3119 0
- timer t3141 0
  bts 0
   type nanobts
   band DCS1800
diff --git a/openbsc/doc/examples/osmo-nitb/nanobts/openbsc.cfg b/openbsc/doc/examples/osmo-nitb/nanobts/openbsc.cfg
index cfc1be6..c5e7be8 100644
--- a/openbsc/doc/examples/osmo-nitb/nanobts/openbsc.cfg
+++ b/openbsc/doc/examples/osmo-nitb/nanobts/openbsc.cfg
@@ -26,17 +26,6 @@
  handover power budget interval 6
  handover power budget hysteresis 3
  handover maximum distance 9999
- timer t3101 10
- timer t3103 0
- timer t3105 0
- timer t3107 0
- timer t3109 4
- timer t3111 0
- timer t3113 60
- timer t3115 0
- timer t3117 0
- timer t3119 0
- timer t3141 0
  bts 0
   type nanobts
   band DCS1800
diff --git a/openbsc/doc/examples/osmo-nitb/nokia/openbsc_nokia_3trx.cfg b/openbsc/doc/examples/osmo-nitb/nokia/openbsc_nokia_3trx.cfg
index 90386be..1906991 100644
--- a/openbsc/doc/examples/osmo-nitb/nokia/openbsc_nokia_3trx.cfg
+++ b/openbsc/doc/examples/osmo-nitb/nokia/openbsc_nokia_3trx.cfg
@@ -13,8 +13,6 @@
  mobile network code 1
  short name OpenBSC
  long name OpenBSC
- timer t3101 10
- timer t3113 60
  bts 0
   type nokia_site
   band GSM1800
diff --git a/openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg b/openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg
index 0226920..d783796 100644
--- a/openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg
+++ b/openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg
@@ -25,18 +25,6 @@
  handover power budget interval 6
  handover power budget hysteresis 3
  handover maximum distance 9999
- timer t3101 10
- timer t3103 0
- timer t3105 0
- timer t3107 0
- timer t3109 4
- timer t3111 0
- timer t3113 60
- timer t3115 0
- timer t3117 0
- timer t3119 0
- timer t3122 0
- timer t3141 0
  subscriber-keep-in-ram 0
  bts 0
   type rbs2000
diff --git a/openbsc/doc/examples/osmo-nitb/sysmobts/openbsc.cfg b/openbsc/doc/examples/osmo-nitb/sysmobts/openbsc.cfg
index 7c078f6..7cd5d1f 100644
--- a/openbsc/doc/examples/osmo-nitb/sysmobts/openbsc.cfg
+++ b/openbsc/doc/examples/osmo-nitb/sysmobts/openbsc.cfg
@@ -26,17 +26,6 @@
  handover power budget interval 6
  handover power budget hysteresis 3
  handover maximum distance 9999
- timer t3101 10
- timer t3103 0
- timer t3105 0
- timer t3107 0
- timer t3109 4
- timer t3111 0
- timer t3113 60
- timer t3115 0
- timer t3117 0
- timer t3119 0
- timer t3141 0
  bts 0
   type sysmobts
   band DCS1800
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index a974051..37a341c 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -289,10 +289,18 @@
 	GSM_AUTH_POLICY_REGEXP, /* accept IMSIs matching given regexp */
 };
 
-#define GSM_T3101_DEFAULT 10
-#define GSM_T3105_DEFAULT 40
+#define GSM_T3101_DEFAULT 10	/* s */
+#define GSM_T3103_DEFAULT 5	/* s */
+#define GSM_T3105_DEFAULT 100	/* ms */
+#define GSM_T3107_DEFAULT 5	/* s */
+#define GSM_T3109_DEFAULT 19	/* s, must be 2s + radio_link_timeout*0.48 */
+#define GSM_T3111_DEFAULT 2	/* s */
 #define GSM_T3113_DEFAULT 60
+#define GSM_T3115_DEFAULT 10
+#define GSM_T3117_DEFAULT 10
+#define GSM_T3119_DEFAULT 10
 #define GSM_T3122_DEFAULT 10
+#define GSM_T3141_DEFAULT 10
 
 struct gsm_tz {
 	int override; /* if 0, use system's time zone instead. */
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 6472e9d..b8352ce 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -787,6 +787,11 @@
 	return CMD_SUCCESS;
 }
 
+/* small helper macro for conditional dumping of timer */
+#define VTY_OUT_TIMER(number)	\
+	if (gsmnet->T##number != GSM_T##number##_DEFAULT)	\
+		vty_out(vty, " timer t"#number" %u%s", gsmnet->T##number, VTY_NEWLINE)
+
 static int config_write_net(struct vty *vty)
 {
 	struct gsm_network *gsmnet = gsmnet_from_vty(vty);
@@ -820,18 +825,18 @@
 		gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
 	vty_out(vty, " handover maximum distance %u%s",
 		gsmnet->handover.max_distance, VTY_NEWLINE);
-	vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
-	vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
-	vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
-	vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
-	vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
-	vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
-	vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
-	vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
-	vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
-	vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
-	vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
-	vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
+	VTY_OUT_TIMER(3101);
+	VTY_OUT_TIMER(3103);
+	VTY_OUT_TIMER(3105);
+	VTY_OUT_TIMER(3107);
+	VTY_OUT_TIMER(3109);
+	VTY_OUT_TIMER(3111);
+	VTY_OUT_TIMER(3113);
+	VTY_OUT_TIMER(3115);
+	VTY_OUT_TIMER(3117);
+	VTY_OUT_TIMER(3119);
+	VTY_OUT_TIMER(3122);
+	VTY_OUT_TIMER(3141);
 	vty_out(vty, " dyn_ts_allow_tch_f %d%s",
 		gsmnet->dyn_ts_allow_tch_f ? 1 : 0, VTY_NEWLINE);
 	vty_out(vty, " subscriber-keep-in-ram %d%s",
diff --git a/openbsc/src/libbsc/net_init.c b/openbsc/src/libbsc/net_init.c
index 4dfc258..9d54319 100644
--- a/openbsc/src/libbsc/net_init.c
+++ b/openbsc/src/libbsc/net_init.c
@@ -44,10 +44,17 @@
 	net->num_bts = 0;
 	net->reject_cause = GSM48_REJECT_ROAMING_NOT_ALLOWED;
 	net->T3101 = GSM_T3101_DEFAULT;
+	net->T3103 = GSM_T3103_DEFAULT;
 	net->T3105 = GSM_T3105_DEFAULT;
+	net->T3107 = GSM_T3107_DEFAULT;
+	net->T3109 = GSM_T3109_DEFAULT;
+	net->T3111 = GSM_T3111_DEFAULT;
 	net->T3113 = GSM_T3113_DEFAULT;
+	net->T3115 = GSM_T3115_DEFAULT;
+	net->T3117 = GSM_T3117_DEFAULT;
+	net->T3119 = GSM_T3119_DEFAULT;
 	net->T3122 = GSM_T3122_DEFAULT;
-	/* FIXME: initialize all other timers! */
+	net->T3141 = GSM_T3141_DEFAULT;
 
 	/* default set of handover parameters */
 	net->handover.win_rxlev_avg = 10;

-- 
To view, visit https://gerrit.osmocom.org/3306
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaac0bfca423852b61d8b9eb1438157ef00d0d8c8
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list