laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/37874?usp=email )
Change subject: core/socket.c: Fix socket binding on IPv4-only hosts
......................................................................
core/socket.c: Fix socket binding on IPv4-only hosts
Let's avoid attempting to use IPv6 addresses on hosts that do not
have IPv6 capability.
Change-Id: I5690a25af98089e3a8a092cb91dfc969720abdc0
Closes: SYS#7047
---
M src/core/socket.c
1 file changed, 24 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
Hoernchen: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/src/core/socket.c b/src/core/socket.c
index e394cf9..da20981 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -278,6 +278,24 @@
return 0;
}
+/*! Determine if the system supports AF_INET6 sockets at all.
+ * We call socket(AF_INET6) once and cache the result value. */
+static bool system_supports_inet6(void)
+{
+ static int cached_val = -1;
+
+ if (cached_val < 0) {
+ int rc = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
+ if (rc < 0 && errno == EAFNOSUPPORT) {
+ cached_val = 0;
+ } else {
+ cached_val = 1;
+ close(rc);
+ }
+ }
+ return cached_val == 1;
+}
+
/*! Initialize a socket (including bind and/or connect)
* \param[in] family Address Family like AF_INET, AF_INET6, AF_UNSPEC
* \param[in] type Socket type like SOCK_DGRAM, SOCK_STREAM
@@ -343,7 +361,12 @@
/* It must do a full run to ensure AF_UNSPEC does not fail.
* In case first local valid entry is IPv4 and only remote valid entry
* is IPv6 or vice versa */
- if (family == AF_UNSPEC) {
+ if (!system_supports_inet6()) {
+ /* if no AF_INET6 is supported, then the decision is easy...*/
+ local_ipv4 = true;
+ remote_ipv4 = true;
+ family = AF_INET;
+ } else if (family == AF_UNSPEC) {
for (rp = local; rp != NULL; rp = rp->ai_next) {
switch (rp->ai_family) {
case AF_INET:
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/37874?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5690a25af98089e3a8a092cb91dfc969720abdc0
Gerrit-Change-Number: 37874
Gerrit-PatchSet: 5
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: neels.
laforge has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/37880?usp=email )
Change subject: fixup: initialize g_hnbp_ctr_id = 0
......................................................................
Patch Set 1: Code-Review-1
(1 comment)
Patchset:
PS1:
all static variables are always guaranteed to be initialized with 0. That's how the linker initializes the bss segment...
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/37880?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I353e026d6e3d2c3c8b13a0ca8bd4c09609632b84
Gerrit-Change-Number: 37880
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 21 Aug 2024 06:20:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: neels.
laforge has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/libosmocore/+/37881?usp=email )
Change subject: CTRL: get rate_ctr_group by the id from rate_ctr_group_set_name()
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
the obvious potential problem here is of course the inefficiency of a linear-list iteration in case there are many such requests. So either we accept that cost, or we introduce some kind of hashing scheme, or we don't offer such a look-up function...
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/37881?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I841a12f76e6fcb2bd7aecb5f4b1707d9ec927137
Gerrit-Change-Number: 37881
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 21 Aug 2024 06:19:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: fixeria, laforge.
Hello Jenkins Builder, fixeria, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-upf/+/37830?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Code-Review-1 by fixeria, Verified+1 by Jenkins Builder
Change subject: add VTY 'gtp-echo' command
......................................................................
add VTY 'gtp-echo' command
Allow sending GTPv1-U Echo Requests to GTP peers via new VTY command
gtp-echo tx to 1.2.3.4 [from (dev|ip) (apn0|5.6.7.8)]
(pseudocode)
Related: OS#6541
Change-Id: I970dccd7a27b098eea9e660822e24e2c4b059fc6
---
M include/osmocom/upf/upf.h
M include/osmocom/upf/upf_gtpu_echo.h
M src/osmo-upf/upf_gtpu_echo.c
M src/osmo-upf/upf_vty.c
A tests/gtp-echo.vty
5 files changed, 160 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/30/37830/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/37830?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I970dccd7a27b098eea9e660822e24e2c4b059fc6
Gerrit-Change-Number: 37830
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria.
neels has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/osmo-upf/+/37830?usp=email )
Change subject: add VTY 'gtp-echo' command
......................................................................
Patch Set 1:
(3 comments)
File src/osmo-upf/upf_vty.c:
https://gerrit.osmocom.org/c/osmo-upf/+/37830/comment/d3d76587_487cbd22?usp… :
PS1, Line 491: tx to
> The command vector looks overloaded to me: […]
Would you accept this?
gtp-echo tx remote-ip IP_ADDR [(local-ip|local-dev)] [IP_ADDR_OR_DEV]
The reason i sprinkle these words in between is to allow future extensions to the vty language.
When arguments have no explicit prefix like 'gtp-echo REMOTE_ADDR', then future 'gtp-echo' commands are prone to have conflicts. What if we want to allow resolving a hostname (stupid example but..). What then if a user wants to use a hostname that is the same as some other vty token that an alternative command offers in the same place.
I've faced such situations before, so I would much prefer to explicitly name each argument.
I agree that 'tx to' doesn't seem nice, but think semantically, inserting 'foo' for arbitrary future extensions:
```
gtp-echo
|- gtp-echo tx
| |- to
| |- from
| | |- ip
| | |- dev
| |- foo
|- gtp-echo foo
```
That is my idea behind it: the "tx" is one branch, the "to" a sub-branch of the argument logic. I thought somewhat about this but would like to keep those keywords in there. Is that too future paranoid?
https://gerrit.osmocom.org/c/osmo-upf/+/37830/comment/74265275_b829a746?usp… :
PS1, Line 556: %%Error
> cosmetic: missing space
missing space?
File tests/gtp-echo.vty:
https://gerrit.osmocom.org/c/osmo-upf/+/37830/comment/e9563e63_dde20d69?usp… :
PS1, Line 2: show pid
: show uptime
: show version
: show online-help
: list [with-flags]
: exit
: help
: show vty-attributes
: show vty-attributes (application|library|global)
: enable [expert-mode]
: terminal length <0-512>
: terminal no length
:
> these lines (and more below), for obvious reasons, shall not be part of the VTY test
oof, got so annoyed from removing them every time that i just left them in while testing ... and forgot! thanks
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/37830?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I970dccd7a27b098eea9e660822e24e2c4b059fc6
Gerrit-Change-Number: 37830
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 20 Aug 2024 22:30:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37883?usp=email
to look at the new patch set (#3).
Change subject: ctrl: tweak errmsg for counter mismatch
......................................................................
ctrl: tweak errmsg for counter mismatch
- instead of "-1", print "not present", so humans know what is
happening.
- the comma separated args in setverdict() create a lot of weird quotes.
Use string concatenation to have only one set of quotes around the
entire error message.
Related: OS#6545
Change-Id: I672fcef819a6542a5b3bcfa0a6d9c84d34b468f3
---
M library/Osmocom_CTRL_Functions.ttcn
1 file changed, 12 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/83/37883/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37883?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I672fcef819a6542a5b3bcfa0a6d9c84d34b468f3
Gerrit-Change-Number: 37883
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37883?usp=email
to look at the new patch set (#2).
Change subject: hnbgw: tweak errmsg for counter mismatch
......................................................................
hnbgw: tweak errmsg for counter mismatch
- instead of "-1", print "not present", so humans know what is
happening.
- the comma separated args in setverdict() create a lot of weird quotes.
Use string concatenation to have only one set of quotes around the
entire error message.
Related: OS#6545
Change-Id: I672fcef819a6542a5b3bcfa0a6d9c84d34b468f3
---
M library/Osmocom_CTRL_Functions.ttcn
1 file changed, 12 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/83/37883/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37883?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I672fcef819a6542a5b3bcfa0a6d9c84d34b468f3
Gerrit-Change-Number: 37883
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/37881?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: CTRL: get rate_ctr_group by the id from rate_ctr_group_set_name()
......................................................................
CTRL: get rate_ctr_group by the id from rate_ctr_group_set_name()
Some objects always have fixed indexes, because they come from the
config file (think "bts.0" or "msc.0").
However, some object IDs are created dynamically, which makes it
"impossible" to verify them in tests. In osmo-hnbgw, the same hNodeB may
show up as hnb.0, hnb.1, etc.
We do already have the rate_ctr_group_set_name() API which allows
tagging an identifier on a rate counter group. For above example,
osmo-hnbgw sets rate_ctr_group_set_name(cell_id_str).
In CTRL, when a counter group index token is not a clean number, look up
that token as the group instance's name instead. This allows for
example:
GET 123 rate_ctr.abs.hnb.001-01-L2342-R0-S55-C1.iuh:established
in addition to currently:
GET 123 rate_ctr.abs.hnb.0.iuh:established
When merging this patch, magically all rate_ctr_groups in all osmo
programs will become accessible by their given rate_ctr_group_set_name()
IDs.
Related: OS#6545
Change-Id: I841a12f76e6fcb2bd7aecb5f4b1707d9ec927137
---
M include/osmocom/core/rate_ctr.h
M src/core/libosmocore.map
M src/core/rate_ctr.c
M src/ctrl/control_if.c
4 files changed, 52 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/81/37881/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/37881?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: I841a12f76e6fcb2bd7aecb5f4b1707d9ec927137
Gerrit-Change-Number: 37881
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
neels has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37882?usp=email )
Change subject: ctrl, hnbgw: access rate counter groups by given ID instead of index
......................................................................
ctrl, hnbgw: access rate counter groups by given ID instead of index
Teach Osmocom_CTRL_Functions to retrieve rate counters by the ID that
the program has set with rate_ctr_group_set_name() (e.g. a hNodeB's cell
id).
In our tests, the logic is firmly built on indexed arrays. For example,
for CN pooling, the tests conveniently have an array of msc.0, msc.1
etc.. This clashes with objects where the indexes on the CTRL interface
may vary dynamically. This patch allows the same indexed handling of
rate counters even when using the ID names instead of the indexes: still
keep the objects in an indexed array, and also provide a mapping from
index to ID name.
Specific motivation:
Since osmo-hnbgw commit 61e278a452bf4fd240e45f1fe8c094a4b3795317
"hnb_persistent: Use incrementing counter for rate_ctr + stat_item index"
the hnb rate counter index increments after a hnbp has expired.
Instead, use the hNodeB's cell ID (which osmo-hnbgw sets on the counter
group with rate_ctr_group_set_name()) to retrieve counters from the CTRL
interface.
Depends: libosmocore I841a12f76e6fcb2bd7aecb5f4b1707d9ec927137
Related: OS#6545
Change-Id: I70e74e7554482df67aa1d90bc04314124dea444f
---
M hnbgw/HNBGW_Tests.ttcn
M library/Osmocom_CTRL_Functions.ttcn
2 files changed, 55 insertions(+), 22 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/82/37882/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37882?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I70e74e7554482df67aa1d90bc04314124dea444f
Gerrit-Change-Number: 37882
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: Jenkins Builder