[PATCH] Add option to force location updating with IMSI, event if TMSI is valid

Andreas Eversberg jolly at eversberg.eu
Tue Nov 27 16:18:57 UTC 2012


To set this option, enter VTY:

enable
conf t
ms 1
location-updating imsi-only
write
---
 .../layer23/include/osmocom/bb/mobile/settings.h   |    1 +
 src/host/layer23/src/mobile/gsm48_mm.c             |    2 +-
 src/host/layer23/src/mobile/vty_interface.c        |   33 ++++++++++++++++++-
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/src/host/layer23/include/osmocom/bb/mobile/settings.h b/src/host/layer23/include/osmocom/bb/mobile/settings.h
index fae1220..6ff8b12 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/settings.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/settings.h
@@ -51,6 +51,7 @@ struct gsm_settings {
 	uint16_t		stick_arfcn;
 	uint8_t			skip_max_per_band;
 	uint8_t			no_lupd;
+	uint8_t			lupd_imsi;
 	uint8_t			no_neighbour;
 
 	/* supported by configuration */
diff --git a/src/host/layer23/src/mobile/gsm48_mm.c b/src/host/layer23/src/mobile/gsm48_mm.c
index 0598768..06f6629 100644
--- a/src/host/layer23/src/mobile/gsm48_mm.c
+++ b/src/host/layer23/src/mobile/gsm48_mm.c
@@ -2358,7 +2358,7 @@ static int gsm48_mm_tx_loc_upd_req(struct osmocom_ms *ms)
 	gsm48_encode_classmark1(&nlu->classmark1, sup->rev_lev, sup->es_ind,
 		set->a5_1, pwr_lev);
 	/* MI */
-	if (0 && subscr->tmsi != 0xffffffff) { /* have TMSI ? */
+	if (!set->lupd_imsi && subscr->tmsi != 0xffffffff) { /* have TMSI ? */
 		gsm48_encode_mi(buf, NULL, ms, GSM_MI_TYPE_TMSI);
 		LOGP(DMM, LOGL_INFO, " using TMSI 0x%08x\n", subscr->tmsi);
 	} else {
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index 4d7f6a2..e6add60 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1334,6 +1334,9 @@ static void config_write_ms(struct vty *vty, struct osmocom_ms *ms)
 	if (!hide_default || set->no_lupd)
 		vty_out(vty, " %slocation-updating%s",
 			(set->no_lupd) ? "no " : "", VTY_NEWLINE);
+	if (!hide_default || set->lupd_imsi)
+		vty_out(vty, " %slocation-updating imsi-only%s",
+			(set->lupd_imsi) ? "" : "no ", VTY_NEWLINE);
 	if (!hide_default || set->no_neighbour)
 		vty_out(vty, " %sneighbour-measurement%s",
 			(set->no_neighbour) ? "no " : "", VTY_NEWLINE);
@@ -1893,7 +1896,7 @@ DEFUN(cfg_ms_no_stick, cfg_ms_no_stick_cmd, "no stick",
 }
 
 DEFUN(cfg_ms_lupd, cfg_ms_lupd_cmd, "location-updating",
-	"Allow location updating")
+	"Do location updating")
 {
 	struct osmocom_ms *ms = vty->index;
 	struct gsm_settings *set = &ms->settings;
@@ -1904,7 +1907,7 @@ DEFUN(cfg_ms_lupd, cfg_ms_lupd_cmd, "location-updating",
 }
 
 DEFUN(cfg_ms_no_lupd, cfg_ms_no_lupd_cmd, "no location-updating",
-	NO_STR "Do not allow location updating")
+	NO_STR "Do not perform location updating")
 {
 	struct osmocom_ms *ms = vty->index;
 	struct gsm_settings *set = &ms->settings;
@@ -1914,6 +1917,30 @@ DEFUN(cfg_ms_no_lupd, cfg_ms_no_lupd_cmd, "no location-updating",
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_ms_lupd_imsi, cfg_ms_lupd_imsi_cmd, "location-updating imsi-only",
+	"Do location updating\nAlways use IMSI to perform location updating")
+{
+	struct osmocom_ms *ms = vty->index;
+	struct gsm_settings *set = &ms->settings;
+
+	set->lupd_imsi = 1;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_ms_no__imsilupd, cfg_ms_no_lupd_imsi_cmd,
+	"no location-updating imsi-only",
+	NO_STR "Do not perform location updating\n"
+	"Do not force location updating with IMSI, if TMSI is valid")
+{
+	struct osmocom_ms *ms = vty->index;
+	struct gsm_settings *set = &ms->settings;
+
+	set->lupd_imsi = 0;
+
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_codec_full, cfg_ms_codec_full_cmd, "codec full-speed",
 	"Enable codec\nFull speed speech codec")
 {
@@ -2821,6 +2848,8 @@ int ms_vty_init(void)
 	install_element(MS_NODE, &cfg_ms_no_stick_cmd);
 	install_element(MS_NODE, &cfg_ms_lupd_cmd);
 	install_element(MS_NODE, &cfg_ms_no_lupd_cmd);
+	install_element(MS_NODE, &cfg_ms_lupd_imsi_cmd);
+	install_element(MS_NODE, &cfg_ms_no_lupd_imsi_cmd);
 	install_element(MS_NODE, &cfg_ms_codec_full_cmd);
 	install_element(MS_NODE, &cfg_ms_codec_full_pref_cmd);
 	install_element(MS_NODE, &cfg_ms_codec_half_cmd);
-- 
1.7.3.4


--------------030505010406090507000203--




More information about the baseband-devel mailing list