diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index d0d5996c2..feb445b85 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -660,6 +660,10 @@ enum chreq_type { #define SBIT(a) (1 << a) #define ALL_STATES 0xffffffff +/* Table 10.5.3/3GPP TS 04.08: Location Area Identification information element */ +#define GSM_LAC_RESERVED_DETACHED 0x0 +#define GSM_LAC_RESERVED_ALL_BTS 0xfffe + /* GSM 04.08 Bearer Capability: Information Transfer Capability */ enum gsm48_bcap_itcap { GSM48_BCAP_ITCAP_SPEECH = 0, diff --git a/openbsc/src/gsm_data.c b/openbsc/src/gsm_data.c index 9db246cec..a50ba8c20 100644 --- a/openbsc/src/gsm_data.c +++ b/openbsc/src/gsm_data.c @@ -274,7 +274,7 @@ struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac, continue; } - if (lac == 0 || bts->location_area_code == lac) + if (lac == GSM_LAC_RESERVED_ALL_BTS || bts->location_area_code == lac) return bts; } return NULL; diff --git a/openbsc/src/gsm_subscriber.c b/openbsc/src/gsm_subscriber.c index a4e35c7b1..c81b522d4 100644 --- a/openbsc/src/gsm_subscriber.c +++ b/openbsc/src/gsm_subscriber.c @@ -105,7 +105,7 @@ int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason) case GSM_SUBSCRIBER_UPDATE_DETACHED: /* Only detach if we are currently in this area */ if (bts->location_area_code == s->lac) - s->lac = 0; + s->lac = GSM_LAC_RESERVED_DETACHED; dispatch_signal(SS_SUBSCR, S_SUBSCR_DETACHED, s); break; default: diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index 79124d934..d6f1bb54e 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -872,6 +872,13 @@ DEFUN(cfg_bts_lac, lac, VTY_NEWLINE); return CMD_WARNING; } + + if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) { + vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s", + lac, VTY_NEWLINE); + return CMD_WARNING; + } + bts->location_area_code = lac; return CMD_SUCCESS;