Skip to content

Commit

Permalink
GTP: CreatePDPContext: only use IMEISV IE when IMEISV is known
Browse files Browse the repository at this point in the history
The IE is optional, but if it is present, it must be 11 byte long
containing a 8 byte IMEISV. If IMEI is unknown the SGSN
would add an empty IMEISV IE which is invalid.

Change-Id: I812af1e702e77214244f32ae65663c1a03b23962
  • Loading branch information
lynxis authored and laf0rge committed Dec 5, 2024
1 parent 6668b2b commit 7d94476
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/sgsn/sgsn_libgtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,14 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
break;
}

/* include the IMEI(SV) */
pdp->imeisv_given = 1;
gsm48_encode_bcd_number(&pdp->imeisv.v[0], 8, 0, mmctx->imei);
pdp->imeisv.l = pdp->imeisv.v[0];
memmove(&pdp->imeisv.v[0], &pdp->imeisv.v[1], 8);
/* optional include the IMEI(SV) */
if (mmctx->imei[0] != '\0') {
memset(&pdp->imeisv.v[0], 0, 8);
pdp->imeisv_given = 1;
gsm48_encode_bcd_number(&pdp->imeisv.v[0], 8, 0, mmctx->imei);
pdp->imeisv.l = 8;
memmove(&pdp->imeisv.v[0], &pdp->imeisv.v[1], 8);
}

/* change pdp state to 'requested' */
pctx->state = PDP_STATE_CR_REQ;
Expand Down

0 comments on commit 7d94476

Please sign in to comment.