[gsm_04_08] Fix gsm48_tx_mm_auth_req implementation

It was mainly missing the key_seq field, causing the
command to just be rejected by the ME.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2009-09-27 11:10:17 +02:00 committed by Harald Welte
parent 59d284e8cf
commit 849f554c87
2 changed files with 12 additions and 3 deletions

View File

@ -78,6 +78,13 @@ struct gsm48_loc_area_id {
u_int16_t lac;
} __attribute__ ((packed));
/* Section 9.2.2 */
struct gsm48_auth_req {
u_int8_t key_seq:4,
spare:4;
u_int8_t rand[16];
} __attribute__ ((packed));
/* Section 9.2.15 */
struct gsm48_loc_upd_req {
u_int8_t type:4,

View File

@ -1233,7 +1233,7 @@ int gsm48_tx_mm_auth_req(struct gsm_lchan *lchan, u_int8_t *rand)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
u_int8_t *r;
struct gsm48_auth_req *ar = (struct gsm48_auth_req *) msgb_put(msg, sizeof(*ar));
DEBUGP(DMM, "-> AUTH REQ\n");
@ -1241,10 +1241,12 @@ int gsm48_tx_mm_auth_req(struct gsm_lchan *lchan, u_int8_t *rand)
gh->proto_discr = GSM48_PDISC_MM;
gh->msg_type = GSM48_MT_MM_AUTH_REQ;
/* Key Sequence: FIXME fixed to 0 */
ar->key_seq = 0;
/* 16 bytes RAND parameters */
r = msgb_put(msg, 16);
if (rand)
memcpy(r, rand, 16);
memcpy(ar->rand, rand, 16);
return gsm48_sendmsg(msg, NULL);
}