pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29540 )
Change subject: stream: Set proper msgb length when returning sctp_notification
......................................................................
stream: Set proper msgb length when returning sctp_notification
This allows the user to properly check the size of the content in case
the struct ABI changes.
-EAGAIN is still returned to avoid older users of the API reading SCTP
notifications as user data.
Change-Id: I95e2457498fd8e0d790d221cb97695ace0dd673e
---
M src/stream.c
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/40/29540/1
diff --git a/src/stream.c b/src/stream.c
index b45b730..31aecc4 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1476,6 +1476,7 @@
if (flags & MSG_NOTIFICATION) {
union sctp_notification *notif = (union sctp_notification *)msgb_data(msg);
LOGP(DLINP, LOGL_DEBUG, "NOTIFICATION %u flags=0x%x\n", notif->sn_header.sn_type, notif->sn_header.sn_flags);
+ msgb_put(msg, sizeof(union sctp_notification));
msgb_sctp_msg_flags(msg) = OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION;
switch (notif->sn_header.sn_type) {
case SCTP_ASSOC_CHANGE:
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29540
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I95e2457498fd8e0d790d221cb97695ace0dd673e
Gerrit-Change-Number: 29540
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29541 )
Change subject: stream: Erase sctp_msg_flags if receiving user data
......................................................................
stream: Erase sctp_msg_flags if receiving user data
It could be that the user reuses the msgb passed to
osmo_stream_srv_recv() all the time, hence we need to reset the flags,
otherwise it may end up being set forever.
Change-Id: Id358140db82b018e3973111e530834589c0b7224
---
M src/stream.c
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/41/29541/1
diff --git a/src/stream.c b/src/stream.c
index 31aecc4..78238b6 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1473,6 +1473,7 @@
ret = sctp_recvmsg(fd, msgb_data(msg), msgb_tailroom(msg),
NULL, NULL, &sinfo, &flags);
+ msgb_sctp_msg_flags(msg) = 0;
if (flags & MSG_NOTIFICATION) {
union sctp_notification *notif = (union sctp_notification *)msgb_data(msg);
LOGP(DLINP, LOGL_DEBUG, "NOTIFICATION %u flags=0x%x\n", notif->sn_header.sn_type, notif->sn_header.sn_flags);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29541
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Id358140db82b018e3973111e530834589c0b7224
Gerrit-Change-Number: 29541
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: laforge.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/29530 )
Change subject: Allocate struct osmux_in_handle through new libosmo-netif APIs
......................................................................
Patch Set 1:
(1 comment)
File src/common/osmux.c:
https://gerrit.osmocom.org/c/osmo-bts/+/29530/comment/d20ad901_8a96fc80
PS1, Line 141: TALLOC_FREE
> why uppercase? Don't recall having seen this before... […]
it's a standard talloc API (define) and already used in several places. It calls talloc_free and sets the pointer to NULL.
I know the h structure is being freed immediately afterwards, but I prefer setting this as NULL in order to avoid weird accesses in the future in case there's some talloc destructor set in the parent "h" structure.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/29530
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I132a7c03213cb20dfe118616c8cfd7032b075507
Gerrit-Change-Number: 29530
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Fri, 30 Sep 2022 11:48:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gbproxy/+/29508 )
Change subject: implement LL DISCARD with second BVCI
......................................................................
implement LL DISCARD with second BVCI
Needs TTCN3 tests
Depends: libosmocore I76dc3b08a63cfd78c9f7657fb58c2ddfa9b4b7e2
Change-Id: Iaa488ee8ac3d85b86c0f360d9d6440f7cda82230
---
M src/gb_proxy.c
1 file changed, 40 insertions(+), 5 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index b4a53bc..488ef91 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -1414,7 +1414,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;
@@ -1483,17 +1484,51 @@
rc = osmo_fsm_inst_dispatch(sgsn_bvc->fi, BSSGP_BVCFSM_E_RX_UNBLOCK_ACK, msg);
break;
case BSSGP_PDUT_FLUSH_LL:
- /* TODO: If new BVCI is on different NSE we should remove the new BVCI so the
- * message is interpreted as a request to delete the PDUs, not forward them.
- * If we negotiate Inter-NSE re-routing or LCS-procedures we can also
+ /* TODO: If we negotiate Inter-NSE re-routing or LCS-procedures we can also
* add the NSEI TLV to trigger re-routing the PDUs */
/* simple case: BVCI IE is mandatory */
bvci = ntohs(tlvp_val16_unal(&tp[0], BSSGP_IE_BVCI));
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;
+ }
+
+ /* When both the old and new BVCI is present:
+ * If old & new BVCI is on the same NSEI, forward message as is,
+ * otherwise remove new BVCI. */
+ 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->nse == sgsn_bvc->nse) {
+ 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 = -ENOMEM;
+ 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 https://gerrit.osmocom.org/c/osmo-gbproxy/+/29508
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: Iaa488ee8ac3d85b86c0f360d9d6440f7cda82230
Gerrit-Change-Number: 29508
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged