summaryrefslogtreecommitdiffstats
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
commitec19c10829ff94946887f893f9fb3b617f36889a (patch)
tree6abc772273deb77346bf569b4206b0e3c2306963
parent2577d415269085d71fff62aead723c7d28522645 (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/src/gprs_bssgp.c15
-rw-r--r--openbsc/src/gprs_ns.c2
2 files changed, 10 insertions, 7 deletions
diff --git a/openbsc/src/gprs_bssgp.c b/openbsc/src/gprs_bssgp.c
index 4b582134..330d8c87 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_ns.c b/openbsc/src/gprs_ns.c
index 7f94b97b..470ccb08 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);