aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/bsc_vty.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-07-20 01:47:39 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-20 09:39:09 +0200
commit9f64c54040857079fa5ca35bf522d3befe7ac362 (patch)
tree99a18afb262e42d6ae833192570b6f4e578f0a94 /openbsc/src/libbsc/bsc_vty.c
parent4d87e22980edb5a0ec170801980f76c837183b32 (diff)
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
Diffstat (limited to 'openbsc/src/libbsc/bsc_vty.c')
-rw-r--r--openbsc/src/libbsc/bsc_vty.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 6472e9d80..b8352ce1e 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -787,6 +787,11 @@ static int config_write_bts(struct vty *v)
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 @@ static int config_write_net(struct vty *vty)
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",