lynxis lazus has uploaded this change for review.
implement LL DISCARD with second BVCI
Needs TTCN3 tests
Change-Id: Iaa488ee8ac3d85b86c0f360d9d6440f7cda82230
---
M src/gb_proxy.c
1 file changed, 38 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-gbproxy refs/changes/08/29508/1
diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index b4a53bc..59d3770 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -206,6 +206,7 @@
DEBUGP(DGPRS, "NSE(%05u/%s)-BVC(%05u/??) proxying to NSE(%05u/%s)\n", msgb_nsei(msg),
!nse->sgsn_facing ? "SGSN" : "BSS", ns_bvci, nse->nsei, nse->sgsn_facing ? "SGSN" : "BSS");
+ rc = bssgp2_nsi_tx_ptp(nsi, nse->nsei, ns_bvci, msg, tlli);
/* Strip the old NS header, it will be replaced with a new one */
strip_ns_hdr(msg);
@@ -1414,7 +1415,8 @@
struct gbproxy_bvc *sgsn_bvc;
struct tlv_parsed tp[2];
int data_len;
- uint16_t bvci;
+ uint16_t bvci, bvci2;
+ uint32_t tlli;
char log_pfx[32];
int rc = 0;
int i;
@@ -1492,8 +1494,42 @@
sgsn_bvc = gbproxy_bvc_by_bvci(nse, bvci);
if (!sgsn_bvc)
goto err_no_bvc;
- if (sgsn_bvc->cell && sgsn_bvc->cell->bss_bvc)
+
+ /* bvc is not valid */
+ if (!sgsn_bvc->cell || !sgsn_bvc->cell->bss_bvc) {
+ rc = -EINVAL;
+ break;
+ }
+
+ /* case if old and new BVCI is present, check if BVCI is on the same NSEI */
+ if (TLVP_PRESENT(&tp[1], BSSGP_IE_BVCI)) {
+ struct gbproxy_bvc *bvc2;
+ struct msgb *flush;
+
+ bvci2 = ntohs(tlvp_val16_unal(&tp[1], BSSGP_IE_BVCI));
+ bvc2 = gbproxy_bvc_by_bvci(nse, bvci2);
+
+ /* it's the same NSEI, we can pass the message as is */
+ if (bvc2 == sgsn_bvc) {
+ rc = gbprox_relay2peer(msg, sgsn_bvc->cell->bss_bvc, ns_bvci);
+ break;
+ }
+
+ tlli = osmo_load32be(TLVP_VAL(&tp[0], BSSGP_IE_TLLI));
+ /* build a new message in order to drop the old one */
+ flush = bssgp2_enc_flush_ll(tlli, bvci, NULL, NULL);
+ if (!flush) {
+ /* TODO: error message */
+ rc = -EINVAL;
+ break;
+ }
+
+ DEBUGP(DGPRS, "NSE(%05u/%s)-BVC(%05u/??) proxying to NSE(%05u/%s)\n", msgb_nsei(msg),
+ !nse->sgsn_facing ? "SGSN" : "BSS", ns_bvci, nse->nsei, nse->sgsn_facing ? "SGSN" : "BSS");
+ rc = bssgp2_nsi_tx_ptp(nse->cfg->nsi, nse->nsei, ns_bvci, flush, tlli);
+ } else {
rc = gbprox_relay2peer(msg, sgsn_bvc->cell->bss_bvc, ns_bvci);
+ }
break;
case BSSGP_PDUT_DUMMY_PAGING_PS:
/* Routing area is optional in dummy paging and we have nothing else to go by
To view, visit change 29508. To unsubscribe, or for help writing mail filters, visit settings.