diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-03-05 09:50:47 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-03-05 09:50:47 +0100 |
commit | e0dc3e5276e0f22eb5cdd5dc19f544de9ee99777 (patch) | |
tree | 8d85bae9d8091690bd750fd264463965aeca5964 | |
parent | 2068e8cfe327943c70a6ba46f1d8bf9379c3a877 (diff) |
isup: Handle CGUs and respond with a CGUA
We don't let CGUAs pass when handling circuit blocking and
unblocking locally. But we did let a CGU go through and then
we never sent the response back to the sender. Respond to a
CGU with the same content.
-rw-r--r-- | src/isup.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -177,6 +177,34 @@ static int send_cgu(struct mtp_link_set *set, int sls, int cic, int range) return 0; } +static int handle_cgu(struct mtp_link_set *set, int sls, int cic, + uint8_t *data, uint16_t size) +{ + uint8_t *out; + struct isup_msg_hdr *hdr; + struct msgb *resp; + + resp = msgb_alloc_headroom(4096, 128, "ISUP CGUA MSG"); + if (!resp) { + LOGP(DISUP, LOGL_ERROR, "Allocation of CGUA message failed.\n"); + return -1; + } + + resp->l2h = msgb_put(resp, sizeof(*hdr)); + + /* write the ISUP header */ + hdr = (struct isup_msg_hdr *) resp->l2h; + hdr->cic = cic; + hdr->msg_type = ISUP_MSG_CGUA; + + out = msgb_put(resp, size); + memcpy(out, data, size); + + mtp_link_set_submit_isup_data(set, sls, resp->l2h, msgb_l2len(resp)); + msgb_free(resp); + return 0; +} + static int handle_simple_resp(struct mtp_link_set *set, int sls, int cic, int msg_type) { struct msgb *resp; @@ -217,6 +245,9 @@ int mtp_link_set_isup(struct mtp_link_set *set, struct msgb *msg, int sls) if (rc == 0) rc = send_cgu(set, sls, hdr->cic, 28); break; + case ISUP_MSG_CGU: + rc = handle_cgu(set, sls, hdr->cic, hdr->data, payload_size); + break; case ISUP_MSG_CGUA: LOGP(DISUP, LOGL_NOTICE, "CIC %d is now unblocked on linkset %d/%s.\n", hdr->cic, set->nr, set->name); |