Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/35232?usp=email
to look at the new patch set (#2).
Change subject: socket: Reimplement osmo_sock_init2_multiaddr()
......................................................................
socket: Reimplement osmo_sock_init2_multiaddr()
This is an attempt to fix several downsides of current
osmo_sock_init2_multiaddr() API, mainly the requirement to pass an explicit
local address (!NULL). It also now works fine if OSMO_SOCK_F_BIND flag
is not used.
This reimplementation is based on the follwing logic:
- If caller passed family=AF_INET or family=AF_INET6, that same family
is used and kernel will fail if something is wrong.
- If caller passes family=AF_UNSPEC, the function will try to find the
required family to create the socket. The decision is taken on the
assumption that an AF_INET6 socket can handle both AF_INET6 and AF_INET
addresses (through v4v6 mapping). Hence, if any of the addresses in the
local or remote set of addresses resolves through getaddrinfo() to an
IPv6 address, then AF_INET6 is used; AF_INET is used otherwise.
Related: OS#6279
Change-Id: I2641fbaca6f477404b094dbc53c0c1a3dd3fd2fd
---
M src/core/socket.c
1 file changed, 128 insertions(+), 44 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/32/35232/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35232?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2641fbaca6f477404b094dbc53c0c1a3dd3fd2fd
Gerrit-Change-Number: 35232
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35233?usp=email )
Change subject: socket: osmo_sock_init2_multiaddr2(): Apply params too if no OSMO_SOCK_F_BIND flag set
......................................................................
socket: osmo_sock_init2_multiaddr2(): Apply params too if no OSMO_SOCK_F_BIND flag set
Change-Id: Ia32510e8db1de0cc0dc36cebf8a94f09e44fda70
---
M src/core/socket.c
1 file changed, 30 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/35233/1
diff --git a/src/core/socket.c b/src/core/socket.c
index 7873e45..22488cf 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -959,23 +959,8 @@
goto ret_freeaddrinfo;
}
- if (flags & OSMO_SOCK_F_BIND) {
- /* Since so far we only allow IPPROTO_SCTP in this function,
- no need to check below for "proto != IPPROTO_UDP || flags & OSMO_SOCK_F_UDP_REUSEADDR" */
- rc = setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR,
- &on, sizeof(on));
- if (rc < 0) {
- int err = errno;
- multiaddr_snprintf(strbuf, sizeof(strbuf), local_hosts, local_hosts_cnt);
- LOGP(DLGLOBAL, LOGL_ERROR,
- "cannot setsockopt socket:"
- " %s:%u: %s\n",
- strbuf, local_port,
- strerror(err));
- goto ret_close;
- }
-
- if (pars && pars->sctp.sockopt_auth_supported.set) {
+ if (pars) {
+ if (pars->sctp.sockopt_auth_supported.set) {
/* RFC 5061 4.2.7: ASCONF also requires AUTH feature. */
rc = setsockopt_sctp_auth_supported(sfd, pars->sctp.sockopt_auth_supported.value);
if (rc < 0) {
@@ -991,7 +976,7 @@
}
}
- if (pars && pars->sctp.sockopt_asconf_supported.set) {
+ if (pars->sctp.sockopt_asconf_supported.set) {
rc = setsockopt_sctp_asconf_supported(sfd, pars->sctp.sockopt_asconf_supported.value);
if (rc < 0) {
int err = errno;
@@ -1006,7 +991,7 @@
}
}
- if (pars && pars->sctp.sockopt_initmsg.set) {
+ if (pars->sctp.sockopt_initmsg.set) {
rc = setsockopt_sctp_initmsg(sfd, pars);
if (rc < 0) {
int err = errno;
@@ -1019,6 +1004,23 @@
/* do not fail, some parameters will be left as the global default */
}
}
+ }
+
+ if (flags & OSMO_SOCK_F_BIND) {
+ /* Since so far we only allow IPPROTO_SCTP in this function,
+ no need to check below for "proto != IPPROTO_UDP || flags & OSMO_SOCK_F_UDP_REUSEADDR" */
+ rc = setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR,
+ &on, sizeof(on));
+ if (rc < 0) {
+ int err = errno;
+ multiaddr_snprintf(strbuf, sizeof(strbuf), local_hosts, local_hosts_cnt);
+ LOGP(DLGLOBAL, LOGL_ERROR,
+ "cannot setsockopt socket:"
+ " %s:%u: %s\n",
+ strbuf, local_port,
+ strerror(err));
+ goto ret_close;
+ }
/* Build array of addresses taking first entry for each host.
TODO: Ideally we should use backtracking storing last used
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35233?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia32510e8db1de0cc0dc36cebf8a94f09e44fda70
Gerrit-Change-Number: 35233
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/libosmocore/+/35232?usp=email )
Change subject: Reimplement osmo_sock_init2_multiaddr()
......................................................................
Reimplement osmo_sock_init2_multiaddr()
This is an attempt to fix several downsides of current
osmo_sock_init2_multiaddr() API, mainly the requirement to pass an explicit
local address (!NULL). It also now works fine if OSMO_SOCK_F_BIND flag
is not used.
This reimplementation is based on the follwing logic:
- If caller passed family=AF_INET or family=AF_INET6, that same family
is used and kernel will fail if something is wrong.
- If caller passes family=AF_UNSPEC, the function will try to find the
required family to create the socket. The decision is taken on the
assumption that an AF_INET6 socket can handle both AF_INET6 and AF_INET
addresses (through v4v6 mapping). Hence, if any of the addresses in the
local or remote set of addresses resolves through getaddrinfo() to an
IPv6 address, then AF_INET6 is used; AF_INET is used otherwise.
Related: OS#6279
Change-Id: I2641fbaca6f477404b094dbc53c0c1a3dd3fd2fd
---
M src/core/socket.c
1 file changed, 128 insertions(+), 44 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/32/35232/1
diff --git a/src/core/socket.c b/src/core/socket.c
index 1dc8e46..7873e45 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -616,18 +616,45 @@
#ifdef HAVE_LIBSCTP
-/* Check whether there's an IPv6 Addr as first option of any addrinfo item in the addrinfo set */
+/* Check whether there's an addrinfo item in the addrinfo set with an IPv4 or IPv6 option */
static void addrinfo_has_v4v6addr(const struct addrinfo **result, size_t result_count, bool *has_v4, bool *has_v6)
{
size_t host_idx;
+ const struct addrinfo *rp;
*has_v4 = false;
*has_v6 = false;
for (host_idx = 0; host_idx < result_count; host_idx++) {
- if (result[host_idx]->ai_family == AF_INET)
- *has_v4 = true;
- else if (result[host_idx]->ai_family == AF_INET6)
- *has_v6 = true;
+ for (rp = result[host_idx]; rp != NULL; rp = rp->ai_next) {
+ if (result[host_idx]->ai_family == AF_INET)
+ *has_v4 = true;
+ else if (result[host_idx]->ai_family == AF_INET6)
+ *has_v6 = true;
+ }
+ }
+}
+
+/* Check whether there's an addrinfo item in the addrinfo set with only an IPv4 or IPv6 option */
+static void addrinfo_has_v4v6only_addr(const struct addrinfo **result, size_t result_count, bool *has_v4only, bool *has_v6only)
+{
+ size_t host_idx;
+ const struct addrinfo *rp;
+ *has_v4only = false;
+ *has_v6only = false;
+
+ for (host_idx = 0; host_idx < result_count; host_idx++) {
+ bool has_v4 = false;
+ bool has_v6 = false;
+ for (rp = result[host_idx]; rp != NULL; rp = rp->ai_next) {
+ if (rp->ai_family == AF_INET6)
+ has_v6 = true;
+ else
+ has_v4 = true;
+ }
+ if (has_v4 && !has_v6)
+ *has_v4only = true;
+ else if (has_v6 && !has_v4)
+ *has_v6only = true;
}
}
@@ -636,13 +663,16 @@
{
size_t host_idx;
struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+ const struct addrinfo *rp;
for (host_idx = 0; host_idx < result_count; host_idx++) {
- if (result[host_idx]->ai_family != AF_INET6)
- continue;
- if (memcmp(&((struct sockaddr_in6 *)result[host_idx]->ai_addr)->sin6_addr,
- &in6addr_any, sizeof(in6addr_any)) == 0)
- return true;
+ for (rp = result[host_idx]; rp != NULL; rp = rp->ai_next) {
+ if (rp->ai_family != AF_INET6)
+ continue;
+ if (memcmp(&((struct sockaddr_in6 *)rp->ai_addr)->sin6_addr,
+ &in6addr_any, sizeof(in6addr_any)) == 0)
+ return true;
+ }
}
return false;
}
@@ -676,22 +706,28 @@
for (host_idx = 0; host_idx < host_cont; host_idx++) {
/* Addresses are ordered based on RFC 3484, see man getaddrinfo */
for (rp = result[host_idx]; rp != NULL; rp = rp->ai_next) {
- if (family != AF_UNSPEC && rp->ai_family != family)
- continue;
- if (offset + rp->ai_addrlen > addrs_buf_len) {
- LOGP(DLGLOBAL, LOGL_ERROR, "Output buffer to small: %zu\n",
- addrs_buf_len);
- return -ENOSPC;
+ if (family == AF_UNSPEC || rp->ai_family == family)
+ break;
+ }
+ if (!rp && family == AF_INET6) {
+ /* See if we can find an AF_INET addr for the AF_INET6 socket instead: */
+ for (rp = result[host_idx]; rp != NULL; rp = rp->ai_next) {
+ if (rp->ai_family == AF_INET)
+ break;
}
- memcpy(addrs_buf + offset, rp->ai_addr, rp->ai_addrlen);
- offset += rp->ai_addrlen;
- break;
}
if (!rp) { /* No addr could be bound for this host! */
LOGP(DLGLOBAL, LOGL_ERROR, "No suitable remote address found for host: %s\n",
hosts[host_idx]);
return -ENODEV;
}
+ if (offset + rp->ai_addrlen > addrs_buf_len) {
+ LOGP(DLGLOBAL, LOGL_ERROR, "Output buffer to small: %zu\n",
+ addrs_buf_len);
+ return -ENOSPC;
+ }
+ memcpy(addrs_buf + offset, rp->ai_addr, rp->ai_addrlen);
+ offset += rp->ai_addrlen;
}
return 0;
}
@@ -827,15 +863,13 @@
struct addrinfo *res_loc[OSMO_SOCK_MAX_ADDRS], *res_rem[OSMO_SOCK_MAX_ADDRS];
int sfd = -1, rc, on = 1;
unsigned int i;
- bool loc_has_v4addr, rem_has_v4addr;
- bool loc_has_v6addr, rem_has_v6addr;
+ bool loc_has_v4addr = false, loc_has_v6addr = false;
+ bool rem_has_v4addr = false, rem_has_v6addr = false;
+ bool loc_has_v4only_addr, rem_has_v4only_addr;
+ bool loc_has_v6only_addr, rem_has_v6only_addr;
struct sockaddr_in6 addrs_buf[OSMO_SOCK_MAX_ADDRS];
char strbuf[512];
- /* updated later in case of AF_UNSPEC */
- loc_has_v4addr = rem_has_v4addr = (family == AF_INET);
- loc_has_v6addr = rem_has_v6addr = (family == AF_INET6);
-
/* TODO: So far this function is only aimed for SCTP, but could be
reused in the future for other protocols with multi-addr support */
if (proto != IPPROTO_SCTP)
@@ -862,10 +896,17 @@
local_hosts_cnt, local_port, true);
if (rc < 0)
return -EINVAL;
- /* Figure out if there's any IPV4 or IPv6 addr in the set */
- if (family == AF_UNSPEC)
- addrinfo_has_v4v6addr((const struct addrinfo **)res_loc, local_hosts_cnt,
- &loc_has_v4addr, &loc_has_v6addr);
+ /* Figure out if there's any IPv4 or IPv6 entry in the result set */
+ addrinfo_has_v4v6addr((const struct addrinfo **)res_loc, local_hosts_cnt,
+ &loc_has_v4addr, &loc_has_v6addr);
+ /* Figure out if there's any IPv4-only or IPv6-only addr in the result set */
+ addrinfo_has_v4v6only_addr((const struct addrinfo **)res_loc, local_hosts_cnt,
+ &loc_has_v4only_addr, &loc_has_v6only_addr);
+ if (family == AF_INET && loc_has_v6only_addr) {
+ LOGP(DLGLOBAL, LOGL_ERROR, "Cannot bind an IPv6 address to an AF_INET socket\n");
+ rc = -EINVAL;
+ goto ret_freeaddrinfo;
+ }
}
/* figure out remote side of socket */
if (flags & OSMO_SOCK_F_CONNECT) {
@@ -875,26 +916,44 @@
rc = -EINVAL;
goto ret_freeaddrinfo_loc;
}
- /* Figure out if there's any IPv4 or IPv6 addr in the set */
- if (family == AF_UNSPEC)
- addrinfo_has_v4v6addr((const struct addrinfo **)res_rem, remote_hosts_cnt,
- &rem_has_v4addr, &rem_has_v6addr);
+ /* Figure out if there's any IPv4 or IPv6 entry in the result set */
+ addrinfo_has_v4v6addr((const struct addrinfo **)res_rem, remote_hosts_cnt,
+ &rem_has_v4addr, &rem_has_v6addr);
+ /* Figure out if there's any IPv4 or IPv6 addr in the result set */
+ addrinfo_has_v4v6only_addr((const struct addrinfo **)res_rem, remote_hosts_cnt,
+ &rem_has_v4only_addr, &rem_has_v6only_addr);
+ if (family == AF_INET && rem_has_v6only_addr) {
+ LOGP(DLGLOBAL, LOGL_ERROR, "Cannot connect to an IPv6 address in an AF_INET socket\n");
+ rc = -EINVAL;
+ goto ret_freeaddrinfo;
+ }
}
- if (((flags & OSMO_SOCK_F_BIND) && (flags & OSMO_SOCK_F_CONNECT)) &&
- !addrinfo_has_in6addr_any((const struct addrinfo **)res_loc, local_hosts_cnt) &&
+ /* Find out the socket family now if not established by caller:
+ * Both are checked here through "or" here to account for "bind flag set,
+ * connect flag not set" and viceversa. */
+ if (family == AF_UNSPEC) {
+ if (!loc_has_v6addr && !rem_has_v6addr)
+ family = AF_INET;
+ else
+ family = AF_INET6;
+ }
+
+ /* if both sets are used, make sure there's at least 1 address of the
+ * same type on each set so that SCTP INIT/INIT-ACK can work. */
+ if (family == AF_INET6 && ((flags & OSMO_SOCK_F_BIND) && (flags & OSMO_SOCK_F_CONNECT)) &&
(loc_has_v4addr != rem_has_v4addr || loc_has_v6addr != rem_has_v6addr)) {
- LOGP(DLGLOBAL, LOGL_ERROR, "Invalid v4 vs v6 in local vs remote addresses: "
- "local:%s%s remote:%s%s\n",
- loc_has_v4addr ? " v4" : "", loc_has_v6addr ? " v6" : "",
- rem_has_v4addr ? " v4" : "", rem_has_v6addr ? " v6" : ""
- );
- rc = -EINVAL;
- goto ret_freeaddrinfo;
+ if (!addrinfo_has_in6addr_any((const struct addrinfo **)res_loc, local_hosts_cnt)) {
+ LOGP(DLGLOBAL, LOGL_ERROR, "Invalid v4 vs v6 in local vs remote addresses: "
+ "local:%s%s remote:%s%s\n",
+ loc_has_v4addr ? " v4" : "", loc_has_v6addr ? " v6" : "",
+ rem_has_v4addr ? " v4" : "", rem_has_v6addr ? " v6" : "");
+ rc = -EINVAL;
+ goto ret_freeaddrinfo;
+ }
}
- sfd = socket_helper_multiaddr(loc_has_v6addr ? AF_INET6 : AF_INET,
- type, proto, flags);
+ sfd = socket_helper_multiaddr(family, type, proto, flags);
if (sfd < 0) {
rc = sfd;
goto ret_freeaddrinfo;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35232?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2641fbaca6f477404b094dbc53c0c1a3dd3fd2fd
Gerrit-Change-Number: 35232
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/34902?usp=email )
Change subject: filesystem: add flag to tell whether an ADF supports an FS or not
......................................................................
filesystem: add flag to tell whether an ADF supports an FS or not
An ADF may or may not support a file system. For example ADF.ARA-M does
not have any filesystem support, which means the SELECT we may use from
this ADF is limited and an can only select a different application. To
know about this in advance let's add a flag that we set when we
instantiate an ADF.
Change-Id: Ifd0f7c34164685ea18d8a746394e55416fa0aa66
Related: OS#5418
---
M pySim/filesystem.py
M pySim/ts_31_102.py
M pySim/ts_31_103.py
M pySim/ts_31_104.py
4 files changed, 24 insertions(+), 7 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 800f2cc..d39162c 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -504,11 +504,12 @@
class CardADF(CardDF):
"""ADF (Application Dedicated File) in the smart card filesystem"""
- def __init__(self, aid: str, **kwargs):
+ def __init__(self, aid: str, has_fs: bool=False, **kwargs):
super().__init__(**kwargs)
# reference to CardApplication may be set from CardApplication constructor
self.application = None # type: Optional[CardApplication]
self.aid = aid # Application Identifier
+ self.has_fs = has_fs # Flag to tell whether the ADF supports a filesystem or not
mf = self.get_mf()
if mf:
mf.add_application_df(self)
diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py
index 0fcf883..28781e1 100644
--- a/pySim/ts_31_102.py
+++ b/pySim/ts_31_102.py
@@ -1369,9 +1369,9 @@
class ADF_USIM(CardADF):
- def __init__(self, aid='a0000000871002', name='ADF.USIM', fid=None, sfid=None,
+ def __init__(self, aid='a0000000871002', has_fs=True, name='ADF.USIM', fid=None, sfid=None,
desc='USIM Application'):
- super().__init__(aid=aid, fid=fid, sfid=sfid, name=name, desc=desc)
+ super().__init__(aid=aid, has_fs=has_fs, fid=fid, sfid=sfid, name=name, desc=desc)
# add those commands to the general commands of a TransparentEF
self.shell_commands += [self.AddlShellCommands()]
diff --git a/pySim/ts_31_103.py b/pySim/ts_31_103.py
index 4327a1a..5268c70 100644
--- a/pySim/ts_31_103.py
+++ b/pySim/ts_31_103.py
@@ -258,9 +258,9 @@
class ADF_ISIM(CardADF):
- def __init__(self, aid='a0000000871004', name='ADF.ISIM', fid=None, sfid=None,
+ def __init__(self, aid='a0000000871004', has_fs=True, name='ADF.ISIM', fid=None, sfid=None,
desc='ISIM Application'):
- super().__init__(aid=aid, fid=fid, sfid=sfid, name=name, desc=desc)
+ super().__init__(aid=aid, has_fs=has_fs, fid=fid, sfid=sfid, name=name, desc=desc)
files = [
EF_IMPI(),
diff --git a/pySim/ts_31_104.py b/pySim/ts_31_104.py
index 0adafba..239acbf 100644
--- a/pySim/ts_31_104.py
+++ b/pySim/ts_31_104.py
@@ -30,9 +30,9 @@
class ADF_HPSIM(CardADF):
- def __init__(self, aid='a000000087100A', name='ADF.HPSIM', fid=None, sfid=None,
+ def __init__(self, aid='a000000087100A', has_fs=True, name='ADF.HPSIM', fid=None, sfid=None,
desc='HPSIM Application'):
- super().__init__(aid=aid, fid=fid, sfid=sfid, name=name, desc=desc)
+ super().__init__(aid=aid, has_fs=has_fs, fid=fid, sfid=sfid, name=name, desc=desc)
files = [
EF_ARR(fid='6f06', sfid=0x06),
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34902?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ifd0f7c34164685ea18d8a746394e55416fa0aa66
Gerrit-Change-Number: 34902
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35214?usp=email )
Change subject: Correctly assemble measurement result into MEASUREMENT REPORT
......................................................................
Correctly assemble measurement result into MEASUREMENT REPORT
After adding the strongest cell to the measurement report, the variables
'strongest' and 'strongest_i' are used to prevent that already added
cells are added again.
Please note that there are no neighbor cell measurements available,
because current layer 1 does not report BSIC of neighbor cells. This
means that there is no neighbor cell reported.
Related: OS#6280
Change-Id: Iaeeaf978da31611c47a20af41790bfa6640dcffd
---
M src/host/layer23/src/mobile/gsm48_rr.c
1 file changed, 28 insertions(+), 3 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c
index 52c6a73..fb79c9b 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -3707,7 +3707,7 @@
if (rep_valid) {
int8_t strongest, current;
uint8_t ncc;
- int i, index;
+ int i, index, strongest_i;
#if 0
/* FIXME: multi-band reporting, if not: 0 = normal reporting */
@@ -3721,13 +3721,20 @@
current = -128; /* -infinite */
index = 0;
for (i = 0; i < rrmeas->nc_num; i++) {
+ /* Skip stronger cells that have been added to measurement report so far. */
+ if (rrmeas->nc_rxlev_dbm[i] > strongest)
+ continue;
+ /* Skip cells with equal strength that have been added so far. */
+ if (rrmeas->nc_rxlev_dbm[i] == strongest && i <= strongest_i)
+ continue;
/* only check if NCC is permitted */
ncc = rrmeas->nc_bsic[i] >> 3;
if ((s->nb_ncc_permitted_si6 & (1 << ncc))
- && rrmeas->nc_rxlev_dbm[i] > current
- && rrmeas->nc_rxlev_dbm[i] < strongest) {
+ && rrmeas->nc_rxlev_dbm[i] > current) {
current = rrmeas->nc_rxlev_dbm[i];
+ strongest = current;
index = i;
+ strongest_i = i;
}
}
if (current == -128) /* no more found */
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35214?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Iaeeaf978da31611c47a20af41790bfa6640dcffd
Gerrit-Change-Number: 35214
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
Attention is currently required from: neels, osmith.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35207?usp=email )
Change subject: util: add osmo_strbuf macros to manipulate the strbuf tail
......................................................................
Patch Set 1:
(1 comment)
File include/osmocom/core/utils.h:
https://gerrit.osmocom.org/c/libosmocore/+/35207/comment/69a340eb_7ca1d74b
PS1, Line 329: } while (0)
> yeah, it's becoming a habit. it is a form of inlining code but .. […]
inline functions have various advantages, starting from better syntax highlighting in the editor/IDE, higher chances that automatic tools might understand what's going on, and last but not least you also have your own scope for variables, ability to use recursive calls, ...
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35207?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I997707c328eab3ffa00a78fdb9a0a2cbe18404b4
Gerrit-Change-Number: 35207
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 05 Dec 2023 17:36:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith <osmith(a)sysmocom.de>
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: comment