diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 99d774770..acca100e0 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -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, diff --git a/openbsc/src/db.c b/openbsc/src/db.c index 45e950b6f..45c55aff9 100644 --- a/openbsc/src/db.c +++ b/openbsc/src/db.c @@ -264,15 +264,15 @@ struct gsm_subscriber* db_create_subscriber(struct gsm_network *net, char *imsi) static int get_equipment_by_subscr(struct gsm_subscriber *subscr) { dbi_result result; - char *string; + const char *string; unsigned int cm1; const unsigned char *cm2, *cm3; struct gsm_equipment *equip = &subscr->equipment; result = dbi_conn_queryf(conn, - "SELECT equipment.* FROM equipment,equipmentwatch " - "WHERE equipmentwatch.equipment_id=equipment.id " - "AND equipmentwatch.subscriber_id = %llu " + "SELECT equipment.* FROM Equipment,EquipmentWatch " + "WHERE EquipmentWatch.equipment_id=Equipment.id " + "AND EquipmentWatch.subscriber_id = %llu " "ORDER BY updated DESC", subscr->id); if (!result) return -EIO; diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c index 6eb49c2b5..d6fe09fa2 100644 --- a/openbsc/src/gsm_04_08.c +++ b/openbsc/src/gsm_04_08.c @@ -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); } @@ -3608,11 +3610,12 @@ int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id) break; case GSM48_PDISC_MM_GPRS: case GSM48_PDISC_SM_GPRS: - fprintf(stderr, "Unimplemented GSM 04.08 discriminator 0x%02d\n", + case GSM48_PDISC_NC_SS: /* mobile-originated USSD */ + fprintf(stderr, "Unimplemented GSM 04.08 discriminator 0x%02x\n", pdisc); break; default: - fprintf(stderr, "Unknown GSM 04.08 discriminator 0x%02d\n", + fprintf(stderr, "Unknown GSM 04.08 discriminator 0x%02x\n", pdisc); break; }