laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/26992 )
Change subject: sccp_user: do not force the role ASP when configured differently
......................................................................
sccp_user: do not force the role ASP when configured differently
The current implementation of osmo_sccp_simple_client forces the ASP to
run in ASP role. Even then when the user has configured it differently
via VTY. The osmo_sccp_simple_client should respect the VTY
configuration.
Change-Id: Ib57c513407747d36e503a4fb01c50c69dea0cb85
Related: SYS#5796
---
M src/sccp_user.c
1 file changed, 5 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
daniel: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/sccp_user.c b/src/sccp_user.c
index ade9487..839ef64 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -633,7 +633,11 @@
/* Ensure that the ASP we use is set to client mode. */
asp->cfg.is_server = false;
- asp->cfg.role = OSMO_SS7_ASP_ROLE_ASP;
+
+ /* Make sure that the role of this ASP is set to ASP unless the user
+ * made a concious decision about the role via the VTY */
+ if (!asp->cfg.role_set_by_vty)
+ asp->cfg.role = OSMO_SS7_ASP_ROLE_ASP;
/* Restart ASP */
if (prot != OSMO_SS7_ASP_PROT_IPA)
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/26992
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ib57c513407747d36e503a4fb01c50c69dea0cb85
Gerrit-Change-Number: 26992
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: neels, dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/26992 )
Change subject: sccp_user: do not force the role ASP when configured differently
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/26992
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ib57c513407747d36e503a4fb01c50c69dea0cb85
Gerrit-Change-Number: 26992
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 26 Jan 2022 16:38:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26950 )
Change subject: logging: log to stderr when logging is not initialized
......................................................................
logging: log to stderr when logging is not initialized
When the logging framework is not initialized we get an error:
"ERROR: osmo_log_info == NULL! You must call log_init() before
using logging in ..."
There are sometimes situations where some code tries to log before
logging was initialied. This is a problem because the actual log
line with the debug info we need is covered up by the error message
from the logging framework.
Lets introduce a fallback logging function that is called when the
the logging framework is not available. This function can just use
fprintf to output to stderr.
Change-Id: I9b1b0988e02322e3e44fd4ceea3e1bc2d4df3c45
---
M include/osmocom/core/logging.h
M src/logging.c
2 files changed, 27 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
daniel: Looks good to me, approved
laforge: Looks good to me, approved
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 9c49876..21b98f6 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -11,6 +11,8 @@
#include <osmocom/core/defs.h>
#include <osmocom/core/linuxlist.h>
+extern struct log_info *osmo_log_info;
+
#ifndef DEBUG
#define DEBUG
#endif
@@ -56,6 +58,10 @@
#ifndef LIBOSMOCORE_NO_LOGGING
#define LOGPC(ss, level, fmt, args...) \
do { \
+ if (!osmo_log_info) { \
+ logp_stub(__FILE__, __LINE__, 1, fmt, ##args); \
+ break; \
+ } \
if (log_check_level(ss, level)) \
logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args); \
} while(0)
@@ -94,6 +100,13 @@
#ifndef LIBOSMOCORE_NO_LOGGING
#define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \
do { \
+ if (!osmo_log_info) { \
+ if (caller_file) \
+ logp_stub(caller_file, caller_line, cont, fmt, ##args); \
+ else \
+ logp_stub(__FILE__, __LINE__, cont, fmt, ##args); \
+ break; \
+ } \
if (log_check_level(ss, level)) {\
if (caller_file) \
logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \
@@ -381,7 +394,9 @@
void logp2(int subsys, unsigned int level, const char *file,
int line, int cont, const char *format, ...)
__attribute__ ((format (printf, 6, 7)));
+void logp_stub(const char *file, int line, int cont, const char *format, ...);
int log_init(const struct log_info *inf, void *talloc_ctx);
+int log_initialized(void);
void log_fini(void);
int log_check_level(int subsys, unsigned int level);
diff --git a/src/logging.c b/src/logging.c
index 94d183f..148bb27 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -754,6 +754,18 @@
TRACE(LIBOSMOCORE_LOG_DONE());
}
+/* This logging function is used as a fallback when the logging framework is
+ * not is not properly initialized. */
+void logp_stub(const char *file, int line, int cont, const char *format, ...)
+{
+ va_list ap;
+ if (!cont)
+ fprintf(stderr, "%s:%d ", file, line);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+}
+
/*! Register a new log target with the logging core
* \param[in] target Log target to be registered
*/
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26950
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9b1b0988e02322e3e44fd4ceea3e1bc2d4df3c45
Gerrit-Change-Number: 26950
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26950 )
Change subject: logging: log to stderr when logging is not initialized
......................................................................
Patch Set 4: Code-Review+2
(1 comment)
File src/logging.c:
https://gerrit.osmocom.org/c/libosmocore/+/26950/comment/bbccf775_925613ee
PS2, Line 315: * Check whether the logging framework is initialized (osmo_log_info exists) */
: int log_initialized(void)
: {
: if (!osmo_log_info)
: return 0;
: return 1;
: }
> This variable is global, but I think its not exported
Any global variable is exported, the two terms are identical. You probably mean it was not declared. That is a bug, and you seem to have fixed it.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26950
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9b1b0988e02322e3e44fd4ceea3e1bc2d4df3c45
Gerrit-Change-Number: 26950
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 26 Jan 2022 16:38:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: daniel <dwillmann(a)sysmocom.de>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: Pablo Neira Ayuso, neels.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libgtpnl/+/26990 )
Change subject: fix some cases of rc == 0 on error
......................................................................
Patch Set 1:
(1 comment)
File src/gtp-genl.c:
https://gerrit.osmocom.org/c/libgtpnl/+/26990/comment/95da02ee_c51eff7f
PS1, Line 82: return -2;
why the magic number "-2"? Why not simlpy do "rc = genl_socket_talk()" and then pass that 'rc' value up?
--
To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/26990
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: I22fd69709e023572c6c616a4184340a554456faf
Gerrit-Change-Number: 26990
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pablo Neira Ayuso <pablo(a)gnumonks.org>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Pablo Neira Ayuso <pablo(a)gnumonks.org>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 26 Jan 2022 16:36:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Pablo Neira Ayuso, neels.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libgtpnl/+/26990 )
Change subject: fix some cases of rc == 0 on error
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
it might be worth looking at how other code using libmnl is doing this. Always best to align with the rest of the world. "apt-cache rdepends libmnl0" lists quite a number of packages that use it, so one can hopefully get some hints there.
--
To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/26990
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: I22fd69709e023572c6c616a4184340a554456faf
Gerrit-Change-Number: 26990
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pablo Neira Ayuso <pablo(a)gnumonks.org>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Pablo Neira Ayuso <pablo(a)gnumonks.org>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 26 Jan 2022 16:32:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/26994 )
Change subject: sccp_user: do not force the role ASP when configured differently
......................................................................
sccp_user: do not force the role ASP when configured differently
The current implementation of osmo_sccp_simple_client forces the ASP to
run in ASP role. Even then when the user has configured it differently
via VTY. The osmo_sccp_simple_client should respect the VTY
configuration.
Change-Id: Ib57c513407747d36e503a4fb01c50c69dea0cb85
Related: SYS#5796
---
M src/sccp_user.c
1 file changed, 5 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
daniel: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/sccp_user.c b/src/sccp_user.c
index ade9487..839ef64 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -633,7 +633,11 @@
/* Ensure that the ASP we use is set to client mode. */
asp->cfg.is_server = false;
- asp->cfg.role = OSMO_SS7_ASP_ROLE_ASP;
+
+ /* Make sure that the role of this ASP is set to ASP unless the user
+ * made a concious decision about the role via the VTY */
+ if (!asp->cfg.role_set_by_vty)
+ asp->cfg.role = OSMO_SS7_ASP_ROLE_ASP;
/* Restart ASP */
if (prot != OSMO_SS7_ASP_PROT_IPA)
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/26994
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: 2021q4
Gerrit-Change-Id: Ib57c513407747d36e503a4fb01c50c69dea0cb85
Gerrit-Change-Number: 26994
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: neels, fixeria, dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/26994 )
Change subject: sccp_user: do not force the role ASP when configured differently
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/26994
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: 2021q4
Gerrit-Change-Id: Ib57c513407747d36e503a4fb01c50c69dea0cb85
Gerrit-Change-Number: 26994
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 26 Jan 2022 16:28:39 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment