[lac] Do not use the reserved LAC 0x0 for two different things
We are using LAC=0 for remembering that a GSM subscriber is detached. I recently added code to gsm_bts_by_lac that will return every BTS in case the lac is 0. Harald highlightes that we would now search for detached subscribers at every BTS of our network which is clearly not what we want. Introduce two defines for the two reserved LAC, add a pointer to the specification, check that our config files do not contain these reserved values, use the define and change gsm_bts_by_lac to use the other define.
This commit is contained in:
parent
86538c7fab
commit
e48b9562a4
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue