Andrei G has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/43574?usp=email )
Change subject: core/socket: init_osa: pass family-correct len
......................................................................
core/socket: init_osa: pass family-correct len
osmo_sock_init_osa() hands bind() and connect() sizeof(struct
osmo_sockaddr), the 128 byte union, whatever the address family. Linux
accepts a namelen longer than the family needs and reads only the
family-appropriate part. Darwin returns EINVAL because the kernel enforces
the exact length (16 for IPv4, 28 for IPv6). The BSDs behave like Darwin.
Use osmo_sockaddr_size(), which the header already provides and which the
sendto() callers already use. It returns sizeof(struct sockaddr_in) or
sizeof(struct sockaddr_in6) by family. Linux behaviour is unchanged.
Consequence on Darwin without this fix: gprs_ns2_ip_bind() cannot bind its
NS-VC UDP socket ("unable to bind socket: 0.0.0.0:23001: Invalid
argument"), so osmo-pcu exits with "No NSVC available to connect to the
SGSN" right after the INFO_IND from osmo-bts. osmo-sgsn and osmo-gbproxy
reach the same call.
Change-Id: I37cb08a6e1809d51c97e666f980d4c68f8b56933
Signed-off-by: Andrei Gosman <andrei.gosman(a)gmail.com>
---
M src/core/socket.c
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/43574/1
diff --git a/src/core/socket.c b/src/core/socket.c
index 3a2d7b7..e392710 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -598,7 +598,9 @@
}
}
- if (bind(sfd, &local->u.sa, sizeof(struct osmo_sockaddr)) == -1) {
+ /* Pass the length of the address family in use, not of the union:
+ * Darwin and the BSDs reject a longer namelen with EINVAL. */
+ if (bind(sfd, &local->u.sa, osmo_sockaddr_size(local)) == -1) {
int err = errno;
_SOCKADDR_TO_STR(sastr, local);
LOGP(DLGLOBAL, LOGL_ERROR, "unable to bind socket: " OSMO_SOCKADDR_STR_FMT ": %s\n",
@@ -621,7 +623,7 @@
}
}
- rc = connect(sfd, &remote->u.sa, sizeof(struct osmo_sockaddr));
+ rc = connect(sfd, &remote->u.sa, osmo_sockaddr_size(remote));
if (rc != 0 && errno != EINPROGRESS) {
int err = errno;
_SOCKADDR_TO_STR(sastr, remote);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/43574?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I37cb08a6e1809d51c97e666f980d4c68f8b56933
Gerrit-Change-Number: 43574
Gerrit-PatchSet: 1
Gerrit-Owner: Andrei G <andrei.gosman(a)gmail.com>
Andrei G has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/43573?usp=email )
Change subject: core/socket: local_ip: connect to discard port
......................................................................
core/socket: local_ip: connect to discard port
osmo_sock_local_ip() finds the source address for a remote by connecting a
dummy UDP socket to that remote and reading the local side back with
getsockname(). It connects to port 0. Linux accepts that and returns the
source address. Darwin rejects it with EADDRNOTAVAIL (errno 49), so the
function returns -EINVAL for every remote. The BSDs behave like Darwin
here.
Two consumers break on Darwin as a result. libosmo-mgcp-client cannot
determine its local address at mgcp_client.c:1347 and fails to build any
MGCP message carrying SDP ("Could not determine local IP-Address!"); the
mgcp_client test then dereferences the message it did not get. In osmo-mgw,
mgcp_network.c:137 uses the same call to pick the local RTP address when
none is configured.
No packet is ever sent on the dummy socket, so the remote port has no
effect on the answer: the socket is connected, read with getsockname() and
closed. Use 9 (discard, IANA reserved), which every kernel accepts.
Behaviour on Linux is unchanged.
Change-Id: I597874d5b2a81dd34c6a2b274fcf8d9bfc14c301
Signed-off-by: Andrei Gosman <andrei.gosman(a)gmail.com>
---
M src/core/socket.c
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/73/43573/1
diff --git a/src/core/socket.c b/src/core/socket.c
index 3a2d7b7..cf737fe 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -2466,8 +2466,10 @@
/* Connect a dummy socket to trick the kernel into determining the
* ip-address of the interface that would be used if we would send
- * out an actual packet */
- sfd = osmo_sock_init2(family, SOCK_DGRAM, IPPROTO_UDP, NULL, 0, remote_ip, 0, OSMO_SOCK_F_CONNECT);
+ * out an actual packet. No packet is sent, so the remote port does
+ * not matter, but it must not be 0: Linux accepts a UDP connect() to
+ * port 0, while Darwin and the BSDs reject it with EADDRNOTAVAIL. */
+ sfd = osmo_sock_init2(family, SOCK_DGRAM, IPPROTO_UDP, NULL, 0, remote_ip, 9, OSMO_SOCK_F_CONNECT);
if (sfd < 0)
return -EINVAL;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/43573?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I597874d5b2a81dd34c6a2b274fcf8d9bfc14c301
Gerrit-Change-Number: 43573
Gerrit-PatchSet: 1
Gerrit-Owner: Andrei G <andrei.gosman(a)gmail.com>
Andrei G has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/43572?usp=email )
Change subject: core/stats_tcp: declare struct osmo_fd in header
......................................................................
core/stats_tcp: declare struct osmo_fd in header
include/osmocom/core/stats_tcp.h names struct osmo_fd in its prototypes
without declaring it and without including select.h. A translation unit
that includes stats_tcp.h on its own therefore gives the type function
prototype scope, and a later definition of one of those functions in the
same unit has a different, incompatible type. Clang reports -Wvisibility
and then rejects the definitions outright.
Every in-tree caller happens to include select.h first, which is why this
never showed up. It surfaced while writing a Darwin implementation of the
same functions, where stats_tcp.h is the only include.
Add the forward declaration to the header rather than requiring each
includer to get the order right. A forward declaration is enough: the
prototypes take a pointer. Nothing here is platform specific and there is
no runtime impact.
Change-Id: I2f31f45317e6a28f47470ba6a5e4a31e4704e831
Signed-off-by: Andrei Gosman <andrei.gosman(a)gmail.com>
---
M include/osmocom/core/stats_tcp.h
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/72/43572/1
diff --git a/include/osmocom/core/stats_tcp.h b/include/osmocom/core/stats_tcp.h
index 9bc7111..759dc3b 100644
--- a/include/osmocom/core/stats_tcp.h
+++ b/include/osmocom/core/stats_tcp.h
@@ -11,6 +11,12 @@
};
extern struct osmo_tcp_stats_config *osmo_tcp_stats_config;
+/* The prototypes below name struct osmo_fd without declaring it. A translation
+ * unit that includes this header on its own therefore gives the type function
+ * prototype scope, and a later definition of one of these functions is a
+ * different type. Declare it here instead of relying on the includer. */
+struct osmo_fd;
+
int osmo_stats_tcp_osmo_fd_register(const struct osmo_fd *fd, const char *name);
int osmo_stats_tcp_osmo_fd_unregister(const struct osmo_fd *fd);
int osmo_stats_tcp_set_interval(int interval);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/43572?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2f31f45317e6a28f47470ba6a5e4a31e4704e831
Gerrit-Change-Number: 43572
Gerrit-PatchSet: 1
Gerrit-Owner: Andrei G <andrei.gosman(a)gmail.com>
Andrei G has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/libosmocore/+/43571?usp=email )
Change subject: core/hash: avoid __always_inline in public header
......................................................................
core/hash: avoid __always_inline in public header
include/osmocom/core/hash.h declares hash_64_generic() with
__always_inline. That spelling was imported with the file from the Linux
kernel. glibc defines the macro in <sys/cdefs.h>, so it happens to work
there. Darwin, FreeBSD and OpenBSD do not define it, and every consumer of
hash.h fails to compile with clang: "unknown type name '__always_inline'",
followed by "call to undeclared function 'hash_64_generic'" further down.
Use the spelling the neighbouring public header already uses:
include/osmocom/core/log2.h declares fls() and fls64() as
static inline __attribute__((always_inline))
The #ifndef __always_inline guard used in src/core/conv_acc_sse_impl.h and
conv_acc_neon_impl.h is the other in-tree option, but those are private
sources; a public header should not define a reserved identifier for its
includers.
hash.h stayed unnoticed because libosmo-sigtran is the first consumer to
include hashtable.h. Reproduced on macOS ARM64 with clang 17 (Xcode 16).
The same failure is expected on FreeBSD and OpenBSD with base clang.
Change-Id: I103831bacde6d2f3f2a140812cd1e2300298bab5
Signed-off-by: Andrei Gosman <andrei.gosman(a)gmail.com>
---
M include/osmocom/core/hash.h
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/71/43571/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/43571?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I103831bacde6d2f3f2a140812cd1e2300298bab5
Gerrit-Change-Number: 43571
Gerrit-PatchSet: 2
Gerrit-Owner: Andrei G <andrei.gosman(a)gmail.com>
Gerrit-CC: Jenkins Builder
Attention is currently required from: Hoernchen, fixeria.
laforge has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43200?usp=email )
Change subject: GP: fix kcb for non block aligned keys
......................................................................
Patch Set 6:
(1 comment)
Patchset:
PS6:
> I have now looked through this carefully. Everything seems to be correct. […]
regarding spec references, it is best to use the document reference like "GPC_SPE_014 Table 11-70", as that's the only compact form they have for specs, and there are many versions and many spec documents. This can be cleaned up in a follow-up commit.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/43200?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I02b4f2ed948c31e1741e40f0226fb49757fa2570
Gerrit-Change-Number: 43200
Gerrit-PatchSet: 6
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 08 Sep 2026 14:32:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
Andrei G has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/43571?usp=email )
Change subject: core/hash: do not use __always_inline in a public header
......................................................................
core/hash: do not use __always_inline in a public header
include/osmocom/core/hash.h declares hash_64_generic() with
__always_inline. That spelling was imported with the file from the Linux
kernel. glibc defines the macro in <sys/cdefs.h>, so it happens to work
there. Darwin, FreeBSD and OpenBSD do not define it, and every consumer of
hash.h fails to compile with clang: "unknown type name '__always_inline'",
followed by "call to undeclared function 'hash_64_generic'" further down.
Use the spelling the neighbouring public header already uses:
include/osmocom/core/log2.h declares fls() and fls64() as
static inline __attribute__((always_inline))
The #ifndef __always_inline guard used in src/core/conv_acc_sse_impl.h and
conv_acc_neon_impl.h is the other in-tree option, but those are private
sources; a public header should not define a reserved identifier for its
includers.
hash.h stayed unnoticed because libosmo-sigtran is the first consumer to
include hashtable.h. Reproduced on macOS ARM64 with clang 17 (Xcode 16).
The same failure is expected on FreeBSD and OpenBSD with base clang.
Change-Id: I103831bacde6d2f3f2a140812cd1e2300298bab5
Signed-off-by: Andrei Gosman <andrei.gosman(a)gmail.com>
---
M include/osmocom/core/hash.h
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/71/43571/1
diff --git a/include/osmocom/core/hash.h b/include/osmocom/core/hash.h
index b45c036..a435105 100644
--- a/include/osmocom/core/hash.h
+++ b/include/osmocom/core/hash.h
@@ -73,7 +73,7 @@
#ifndef HAVE_ARCH_HASH_64
#define hash_64 hash_64_generic
#endif
-static __always_inline uint32_t hash_64_generic(uint64_t val, unsigned int bits)
+static inline __attribute__((always_inline)) uint32_t hash_64_generic(uint64_t val, unsigned int bits)
{
#if BITS_PER_LONG == 64
/* 64x64-bit multiply is efficient on all 64-bit processors */
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/43571?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I103831bacde6d2f3f2a140812cd1e2300298bab5
Gerrit-Change-Number: 43571
Gerrit-PatchSet: 1
Gerrit-Owner: Andrei G <andrei.gosman(a)gmail.com>
Attention is currently required from: Hoernchen.
Jenkins Builder has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43546?usp=email )
Change subject: ota: indefinite length en/decoding support
......................................................................
Patch Set 2:
(1 comment)
File pySim/ota.py:
Robot Comment from checkpatch (run ID ):
https://gerrit.osmocom.org/c/pysim/+/43546/comment/a0643d29_8a2cc714?usp=em… :
PS2, Line 195: """Returns the content octets of an indef lengh template like
'lengh' may be misspelled - perhaps 'length'?
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/43546?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I4e023112e98729489ed443eec3ed5ab45c773b17
Gerrit-Change-Number: 43546
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 08 Sep 2026 13:57:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: Hoernchen, daniel, dexter, laforge.
Hello Jenkins Builder, daniel, dexter, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/43541?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Verified-1 by Jenkins Builder
Change subject: ota: add TS 102 226 5.2 Expanded Remote Application data format
......................................................................
ota: add TS 102 226 5.2 Expanded Remote Application data format
TS 102 226 section 5.2 "Command and Response Scripting templates"
The advantage over compact RFM/RAM commands is one C-APDU TLV per command
and one R-APDU TLV per result, so multiple commands return the response
of each one rather than only that of the last.
encode_expanded_cmd() builds the Command Scripting template
decode_expanded_resp() decodes the Response Scripting template into a
Container.
The 'truncated' key must be checked!
OtaDialect.encode_cmd()/decode_resp() now has a remote_format param for
compact and expanded formats, default stays compact,so existing code is
unaffected.
Change-Id: Idec00d16fd1a7d4a7129b2a3b6f0ef37dabcecb7
---
M pySim/ota.py
M tests/unittests/test_ota.py
2 files changed, 410 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/41/43541/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/43541?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idec00d16fd1a7d4a7129b2a3b6f0ef37dabcecb7
Gerrit-Change-Number: 43541
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>