aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-02 09:50:42 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-04 07:20:43 +0200
commitfd3fa1d4e0aaf06e523d3f36ce5d983b77569fbc (patch)
tree4bfdcefc16abe7915e956a6d812ac39e3e54d356
parent345223ee9e48a5490bac7db9a0b54a3639b2e332 (diff)
[gprs] Ensure msgb->l3h points to Layer3 (04.08)
In the old code l3h = BSSGP, l4h = LLC, cb[gmmh] = 04.08 Now, this has been changed to cb[bssgph] = BSSGP, cb[llch] = LLC, l3h = 04.08 This way, GSM general 04.08 and GPRS 04.08 code can expect a GSM 04.08 header at msgb->l3h
-rw-r--r--openbsc/include/openbsc/gsm_data.h8
-rw-r--r--openbsc/src/gprs_bssgp.c15
-rw-r--r--openbsc/src/gprs_llc.c2
-rw-r--r--openbsc/src/gprs_ns.c2
4 files changed, 16 insertions, 11 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index c124fae5e..f011041e5 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -81,7 +81,8 @@ enum bts_gprs_mode {
/* the data structure stored in msgb->cb for openbsc apps */
struct openbsc_msgb_cb {
- unsigned char *gmmh;
+ unsigned char *bssgph;
+ unsigned char *llch;
u_int16_t nsei;
u_int16_t bvci;
@@ -90,10 +91,11 @@ struct openbsc_msgb_cb {
} __attribute__((packed));
#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0]))
#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli
-#define msgb_gmmh(__x) OBSC_MSGB_CB(__x)->gmmh
#define msgb_nsei(__x) OBSC_MSGB_CB(__x)->nsei
#define msgb_bvci(__x) OBSC_MSGB_CB(__x)->bvci
-#define msgb_llch(__x) (__x)->l4h
+#define msgb_gmmh(__x) (__x)->l3h
+#define msgb_bssgph(__x) OBSC_MSGB_CB(__x)->bssgph
+#define msgb_llch(__x) OBSC_MSGB_CB(__x)->llch
struct msgb;
typedef int gsm_cbfn(unsigned int hooknum,
diff --git a/openbsc/src/gprs_bssgp.c b/openbsc/src/gprs_bssgp.c
index 4b5821343..330d8c875 100644
--- a/openbsc/src/gprs_bssgp.c
+++ b/openbsc/src/gprs_bssgp.c
@@ -200,7 +200,7 @@ int bssgp_tx_status(u_int8_t cause, u_int16_t *bvci, struct msgb *orig_msg)
}
if (orig_msg)
msgb_tvlv_put(msg, BSSGP_IE_PDU_IN_ERROR,
- msgb_l3len(orig_msg), orig_msg->l3h);
+ msgb_l3len(orig_msg), msgb_bssgph(orig_msg));
return gprs_ns_sendmsg(bssgp_nsi, msg);
}
@@ -257,7 +257,7 @@ static int bssgp_rx_bvc_reset(struct msgb *msg, struct tlv_parsed *tp,
/* Uplink unit-data */
static int bssgp_rx_ul_ud(struct msgb *msg, u_int16_t bvci)
{
- struct bssgp_ud_hdr *budh = (struct bssgp_ud_hdr *) msg->l3h;
+ struct bssgp_ud_hdr *budh = (struct bssgp_ud_hdr *) msgb_bssgph(msg);
int data_len = msgb_l3len(msg) - sizeof(*budh);
struct tlv_parsed tp;
int rc;
@@ -280,7 +280,8 @@ static int bssgp_rx_ul_ud(struct msgb *msg, u_int16_t bvci)
static int bssgp_rx_suspend(struct msgb *msg, u_int16_t bvci)
{
- struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msg->l3h;
+ struct bssgp_normal_hdr *bgph =
+ (struct bssgp_normal_hdr *) msgb_bssgph(msg);
int data_len = msgb_l3len(msg) - sizeof(*bgph);
struct tlv_parsed tp;
int rc;
@@ -301,7 +302,8 @@ static int bssgp_rx_suspend(struct msgb *msg, u_int16_t bvci)
static int bssgp_rx_resume(struct msgb *msg, u_int16_t bvci)
{
- struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msg->l3h;
+ struct bssgp_normal_hdr *bgph =
+ (struct bssgp_normal_hdr *) msgb_bssgph(msg);
int data_len = msgb_l3len(msg) - sizeof(*bgph);
struct tlv_parsed tp;
int rc;
@@ -339,10 +341,11 @@ static int bssgp_rx_fc_bvc(struct msgb *msg, struct tlv_parsed *tp,
ns_bvci);
}
-/* We expect msg->l3h to point to the BSSGP header */
+/* We expect msgb_bssgph() to point to the BSSGP header */
int gprs_bssgp_rcvmsg(struct msgb *msg, u_int16_t ns_bvci)
{
- struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msg->l3h;
+ struct bssgp_normal_hdr *bgph =
+ (struct bssgp_normal_hdr *) msgb_bssgph(msg);
struct tlv_parsed tp;
u_int8_t pdu_type = bgph->pdu_type;
int data_len = msgb_l3len(msg) - sizeof(*bgph);
diff --git a/openbsc/src/gprs_llc.c b/openbsc/src/gprs_llc.c
index aea40d360..883eedb05 100644
--- a/openbsc/src/gprs_llc.c
+++ b/openbsc/src/gprs_llc.c
@@ -428,7 +428,7 @@ static int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
/* receive an incoming LLC PDU (BSSGP-UL-UNITDATA-IND, 7.2.4.2) */
int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv)
{
- struct bssgp_ud_hdr *udh = (struct bssgp_ud_hdr *) msg->l3h;
+ struct bssgp_ud_hdr *udh = (struct bssgp_ud_hdr *) msgb_bssgph(msg);
struct gprs_llc_hdr *lh = msgb_llch(msg);
struct gprs_llc_hdr_parsed llhp;
struct gprs_llc_entity *lle;
diff --git a/openbsc/src/gprs_ns.c b/openbsc/src/gprs_ns.c
index 7f94b97b1..470ccb080 100644
--- a/openbsc/src/gprs_ns.c
+++ b/openbsc/src/gprs_ns.c
@@ -266,7 +266,7 @@ static int gprs_ns_rx_unitdata(struct gprs_nsvc *nsvc, struct msgb *msg)
/* spare octet in data[0] */
bvci = nsh->data[1] << 8 | nsh->data[2];
- msg->l3h = &nsh->data[3];
+ msgb_bssgph(msg) = &nsh->data[3];
/* call upper layer (BSSGP) */
return nsvc->nsi->cb(GPRS_NS_EVT_UNIT_DATA, nsvc, msg, bvci);