pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29498 )
Change subject: osmux: Change order of lines to follow packet fill order
......................................................................
osmux: Change order of lines to follow packet fill order
The osmux header goes before in the packet, so let's move the line
checking is size before the content.
Change-Id: I33feac834700d22ed06472d8971abd0567ce623b
---
M src/osmux.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/98/29498/1
diff --git a/src/osmux.c b/src/osmux.c
index 51642ab..bd05f76 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -715,9 +715,9 @@
}
/* First check if there is room for this message in the batch */
- bytes += amr_payload_len;
if (circuit->nmsgs == 0)
bytes += sizeof(struct osmux_hdr);
+ bytes += amr_payload_len;
/* No room, sorry. You'll have to retry */
if (bytes > batch->remaining_bytes)
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29498
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I33feac834700d22ed06472d8971abd0567ce623b
Gerrit-Change-Number: 29498
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/+/29500 )
Change subject: osmux: Unify return codes of osmux_batch_add() and osmux_batch_enqueue()
......................................................................
osmux: Unify return codes of osmux_batch_add() and osmux_batch_enqueue()
This way it's way easier to return the error to the caller, and the code
is easier to read.
Change-Id: Ib78c9b82b85c74be2c5e94dae7c212175244d5fa
---
M src/osmux.c
1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/00/29500/1
diff --git a/src/osmux.c b/src/osmux.c
index 801372b..bcf6e47 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -311,6 +311,7 @@
int dummy;
};
+/* returns: 1 if batch is full, 0 if batch still not full, negative on error. */
static int osmux_batch_enqueue(struct msgb *msg, struct osmux_circuit *circuit,
uint8_t batch_factor)
{
@@ -325,7 +326,7 @@
return -1;
LOGP(DLMUX, LOGL_DEBUG, "Batch is full for RTP sssrc=%u\n", rtph->ssrc);
- return -1;
+ return 1;
}
llist_add_tail(&msg->list, &circuit->msg_list);
@@ -606,7 +607,7 @@
DELTA_RTP_TIMESTAMP);
/* No more room in this batch, skip padding with more clones */
- if (osmux_batch_enqueue(clone, circuit, batch_factor) < 0) {
+ if (osmux_batch_enqueue(clone, circuit, batch_factor) != 0) {
msgb_free(clone);
break;
}
@@ -668,6 +669,7 @@
talloc_free(circuit);
}
+/* returns: 1 if batch is full, 0 if batch still not full, negative on error. */
static int
osmux_batch_add(struct osmux_batch *batch, uint32_t batch_factor, struct msgb *msg,
struct rtp_hdr *rtph, int ccid)
@@ -675,6 +677,7 @@
int bytes = 0, amr_payload_len;
struct osmux_circuit *circuit;
struct msgb *cur;
+ int rc;
circuit = osmux_batch_find_circuit(batch, ccid);
if (!circuit)
@@ -727,8 +730,9 @@
osmux_replay_lost_packets(circuit, rtph, batch_factor);
/* This batch is full, force batch delivery */
- if (osmux_batch_enqueue(msg, circuit, batch_factor) < 0)
- return 1;
+ rc = osmux_batch_enqueue(msg, circuit, batch_factor);
+ if (rc != 0)
+ return rc;
#ifdef DEBUG_MSG
LOGP(DLMUX, LOGL_DEBUG, "adding msg with ssrc=%u to batch\n",
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29500
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ib78c9b82b85c74be2c5e94dae7c212175244d5fa
Gerrit-Change-Number: 29500
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/+/29497 )
Change subject: osmux: Avoid duplicated RTP msg trigger Tx of osmux frame
......................................................................
osmux: Avoid duplicated RTP msg trigger Tx of osmux frame
The RTP msg will be dropped, so it makes no sense to signal the caller
to deliver the batchbeing built, since it may still have space for next
non-duplicated message.
The exception is the case where the new packet has the M marker bit set,
since the sequence numbers can be reset or jump in those scenarios.
Change-Id: Idc457bc3b26bed68796d714bc3f37a2d016ba5c3
---
M src/osmux.c
1 file changed, 10 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/97/29497/1
diff --git a/src/osmux.c b/src/osmux.c
index 4851998..51642ab 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -691,22 +691,12 @@
return -1;
}
- /* First check if there is room for this message in the batch */
- bytes += amr_payload_len;
- if (circuit->nmsgs == 0)
- bytes += sizeof(struct osmux_hdr);
-
- /* No room, sorry. You'll have to retry */
- if (bytes > batch->remaining_bytes)
- return 1;
-
/* Init of talkspurt (RTP M marker bit) needs to be in the first AMR slot
* of the OSMUX packet, enforce sending previous batch if required:
*/
if (rtph->marker && circuit->nmsgs != 0)
return 1;
-
/* Extra validation: check if this message already exists, should not
* happen but make sure we don't propagate duplicated messages.
*/
@@ -723,6 +713,16 @@
return -1;
}
}
+
+ /* First check if there is room for this message in the batch */
+ bytes += amr_payload_len;
+ if (circuit->nmsgs == 0)
+ bytes += sizeof(struct osmux_hdr);
+
+ /* No room, sorry. You'll have to retry */
+ if (bytes > batch->remaining_bytes)
+ return 1;
+
/* Handle RTP packet loss scenario */
osmux_replay_lost_packets(circuit, rtph, batch_factor);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29497
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Idc457bc3b26bed68796d714bc3f37a2d016ba5c3
Gerrit-Change-Number: 29497
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29480 )
Change subject: llc: add value-string for enum osmo_gprs_llc_xid_type
......................................................................
llc: add value-string for enum osmo_gprs_llc_xid_type
Change-Id: I90b6a1aa4e13984f4c43245df1308d0c3f82636f
---
M include/osmocom/gprs/llc/llc.h
M src/llc/Makefile.am
A src/llc/llc_xid.c
3 files changed, 50 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h
index 7a4ac03..7c4ea45 100644
--- a/include/osmocom/gprs/llc/llc.h
+++ b/include/osmocom/gprs/llc/llc.h
@@ -85,6 +85,13 @@
OSMO_GPRS_LLC_XID_T_RESET = 12,
};
+extern const struct value_string osmo_gprs_llc_xid_type_names[];
+
+static inline const char *osmo_gprs_llc_xid_type_name(enum osmo_gprs_llc_xid_type val)
+{
+ return get_value_string(osmo_gprs_llc_xid_type_names, val);
+}
+
/* Section 4.5.2 Logical Link States + Annex C.2 */
enum osmo_gprs_llc_lle_state {
OSMO_GPRS_LLC_LLES_UNASSIGNED = 1, /* No TLLI yet */
diff --git a/src/llc/Makefile.am b/src/llc/Makefile.am
index a301a89..6c0e680 100644
--- a/src/llc/Makefile.am
+++ b/src/llc/Makefile.am
@@ -24,6 +24,7 @@
libosmo_gprs_llc_la_SOURCES = \
crc24.c \
llc_pdu.c \
+ llc_xid.c \
misc.c \
$(NULL)
diff --git a/src/llc/llc_xid.c b/src/llc/llc_xid.c
new file mode 100644
index 0000000..1705e5d
--- /dev/null
+++ b/src/llc/llc_xid.c
@@ -0,0 +1,42 @@
+/* GPRS LLC protocol implementation as per 3GPP TS 44.064 */
+
+/* (C) 2009-2010 by Harald Welte <laforge(a)gnumonks.org>
+ * (C) 2022 by Sysmocom s.f.m.c. GmbH
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <osmocom/core/utils.h>
+
+#include <osmocom/gprs/llc/llc.h>
+
+const struct value_string osmo_gprs_llc_xid_type_names[] = {
+ { OSMO_GPRS_LLC_XID_T_VERSION, "LLC-Version" },
+ { OSMO_GPRS_LLC_XID_T_IOV_UI, "IOV-UI" },
+ { OSMO_GPRS_LLC_XID_T_IOV_I, "IOV-I" },
+ { OSMO_GPRS_LLC_XID_T_T200, "T200" },
+ { OSMO_GPRS_LLC_XID_T_N200, "N200" },
+ { OSMO_GPRS_LLC_XID_T_N201_U, "N201-U" },
+ { OSMO_GPRS_LLC_XID_T_N201_I, "N201-I" },
+ { OSMO_GPRS_LLC_XID_T_mD, "mD" },
+ { OSMO_GPRS_LLC_XID_T_mU, "mU" },
+ { OSMO_GPRS_LLC_XID_T_kD, "kD" },
+ { OSMO_GPRS_LLC_XID_T_kU, "kU" },
+ { OSMO_GPRS_LLC_XID_T_L3_PAR, "L3-Params" },
+ { OSMO_GPRS_LLC_XID_T_RESET, "Reset" },
+ { 0, NULL }
+};
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29480
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I90b6a1aa4e13984f4c43245df1308d0c3f82636f
Gerrit-Change-Number: 29480
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29362 )
Change subject: pcu_sock: add some guard space to message buffer
......................................................................
pcu_sock: add some guard space to message buffer
in osmo-pcu, the message buffer in pcu_sock_read is allocated with 1000
bytes in addition to the true size of the pcu_prim struct. Presumably
this is to avoid compatibility problems in case the primitives slightly
grow due to appending new struct members. Lets do the same in osmo-bts.
Change-Id: I99f5204b0563f72f9da427bb7aa5451552d8c5b5
Related: OS#5198
---
M src/osmo-bsc/pcu_sock.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index 1af9a9d..81198bd 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -566,7 +566,7 @@
struct msgb *msg;
int rc;
- msg = msgb_alloc(sizeof(*pcu_prim), "pcu_sock_rx");
+ msg = msgb_alloc(sizeof(*pcu_prim) + 1000, "pcu_sock_rx");
if (!msg)
return -ENOMEM;
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29362
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I99f5204b0563f72f9da427bb7aa5451552d8c5b5
Gerrit-Change-Number: 29362
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: merged