lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

January 2022

  • 3 participants
  • 781 discussions
Change in osmo-e1d[master]: make rate_counters work
by laforge 31 Jan '22

31 Jan '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27018 ) Change subject: make rate_counters work ...................................................................... make rate_counters work if we don't call rate_ctr_init(), the rate counter internal timer will not tick,a nd we will never get the per-s/per-m/per-h averages. Change-Id: Ib5b66c72079330ac161756bcf562d27536d7ce44 --- M src/osmo-e1d.c 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/osmo-e1d.c b/src/osmo-e1d.c index 3ac9642..91bf78d 100644 --- a/src/osmo-e1d.c +++ b/src/osmo-e1d.c @@ -175,6 +175,7 @@ vty_init(&vty_info); logging_vty_add_cmds(); e1d_vty_init(e1d); + rate_ctr_init(e1d); handle_options(argc, argv); 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27018 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ib5b66c72079330ac161756bcf562d27536d7ce44 Gerrit-Change-Number: 27018 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-e1d[master]: update copyright statement
by laforge 31 Jan '22

31 Jan '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27019 ) Change subject: update copyright statement ...................................................................... update copyright statement Change-Id: I1b4817207369e572a2b070443475289cc527c317 --- M src/osmo-e1d.c 1 file changed, 3 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/osmo-e1d.c b/src/osmo-e1d.c index 91bf78d..f86a92a 100644 --- a/src/osmo-e1d.c +++ b/src/osmo-e1d.c @@ -1,7 +1,8 @@ /* * osmo-e1d.c * - * (C) 2019 by Sylvain Munaut <tnt(a)246tNt.com> + * (C) 2019-2022 by Sylvain Munaut <tnt(a)246tNt.com> + * (C) 2019-2022 by Harald Welte <laforge(a)osmocom.org> * * All Rights Reserved * @@ -83,7 +84,7 @@ .name = "osmo-e1d", .version = PACKAGE_VERSION, .copyright = - "(C) 2019 by Sylvain Munaut <tnt(a)246tNt.com>\r\n", + "(C) 2019-2022 by Sylvain Munaut, Harald Welte and contributors\r\n", "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>\r\n" "This is free software: you are free to change and redistribute it.\r\n" "There is NO WARRANTY, to the extent permitted by law.\r\n", 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27019 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I1b4817207369e572a2b070443475289cc527c317 Gerrit-Change-Number: 27019 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
Change in libosmocore[master]: log: socket.c: rather use the osmo_sockaddr_str _FMT
by neels 31 Jan '22

31 Jan '22
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/27024 ) Change subject: log: socket.c: rather use the osmo_sockaddr_str _FMT ...................................................................... log: socket.c: rather use the osmo_sockaddr_str _FMT The OSMO_SOCKADDR_STR_FMT() and _ARGS() macros properly place square braces around IPv6 addresses, so that the port nr is clearly distinguishable. before: 1:2::3:4:5 after: [1:2::3:4]:5 When using a struct reference, the macro resolves to '(&sastr) ? .. : ..', which the compiler complains about as "condition is always true". Shim around that error with a pointer variable. I considered using osmo_sockaddr_to_str_c() instead, but here in socket.c we cannot assume that osmo_select_main_ctx() is being used and hence can't just use OTC_SELECT for log string composition. The struct osmo_sockaddr_str is a string representation in a local variable, and hence doesn't need talloc for log strings. I considered adding log_check_level() around the log string conversion, but since all of these instances are on LOGL_ERROR, I didn't bother. Related: SYS#5599 Change-Id: Idbe7582b2b7f14540919e911dad08af6d491f68f --- M src/socket.c 1 file changed, 12 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/24/27024/1 diff --git a/src/socket.c b/src/socket.c index 0ffa11d..882ff02 100644 --- a/src/socket.c +++ b/src/socket.c @@ -484,8 +484,8 @@ } #define _SOCKADDR_TO_STR(dest, sockaddr) do { \ - if (osmo_sockaddr_str_from_sockaddr(&dest, &sockaddr->u.sas)) \ - osmo_strlcpy(dest.ip, "Invalid IP", 11); \ + if (osmo_sockaddr_str_from_sockaddr(dest, &sockaddr->u.sas)) \ + osmo_strlcpy(dest->ip, "Invalid IP", 11); \ } while (0) /*! Initialize a socket (including bind and/or connect) @@ -520,7 +520,8 @@ unsigned int flags) { int sfd = -1, rc, on = 1; - struct osmo_sockaddr_str sastr = {}; + struct osmo_sockaddr_str _sastr = {}; + struct osmo_sockaddr_str *sastr = &_sastr; if ((flags & (OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT)) == 0) { LOGP(DLGLOBAL, LOGL_ERROR, "invalid: you have to specify either " @@ -551,8 +552,8 @@ sfd = socket_helper_osa(local, type, proto, flags); if (sfd < 0) { _SOCKADDR_TO_STR(sastr, local); - LOGP(DLGLOBAL, LOGL_ERROR, "no suitable local addr found for: %s:%u\n", - sastr.ip, sastr.port); + LOGP(DLGLOBAL, LOGL_ERROR, "no suitable local addr found for: " OSMO_SOCKADDR_STR_FMT "\n", + OSMO_SOCKADDR_STR_FMT_ARGS(sastr)); return -ENODEV; } @@ -562,10 +563,8 @@ if (rc < 0) { _SOCKADDR_TO_STR(sastr, local); LOGP(DLGLOBAL, LOGL_ERROR, - "cannot setsockopt socket:" - " %s:%u: %s\n", - sastr.ip, sastr.port, - strerror(errno)); + "cannot setsockopt socket: " OSMO_SOCKADDR_STR_FMT ": %s\n", + OSMO_SOCKADDR_STR_FMT_ARGS(sastr), strerror(errno)); close(sfd); return rc; } @@ -573,8 +572,8 @@ if (bind(sfd, &local->u.sa, sizeof(struct osmo_sockaddr)) == -1) { _SOCKADDR_TO_STR(sastr, local); - LOGP(DLGLOBAL, LOGL_ERROR, "unable to bind socket: %s:%u: %s\n", - sastr.ip, sastr.port, strerror(errno)); + LOGP(DLGLOBAL, LOGL_ERROR, "unable to bind socket: " OSMO_SOCKADDR_STR_FMT ": %s\n", + OSMO_SOCKADDR_STR_FMT_ARGS(sastr), strerror(errno)); close(sfd); return -1; } @@ -596,8 +595,8 @@ rc = connect(sfd, &remote->u.sa, sizeof(struct osmo_sockaddr)); if (rc != 0 && errno != EINPROGRESS) { _SOCKADDR_TO_STR(sastr, remote); - LOGP(DLGLOBAL, LOGL_ERROR, "unable to connect socket: %s:%u: %s\n", - sastr.ip, sastr.port, strerror(errno)); + LOGP(DLGLOBAL, LOGL_ERROR, "unable to connect socket: " OSMO_SOCKADDR_STR_FMT ": %s\n", + OSMO_SOCKADDR_STR_FMT_ARGS(sastr), strerror(errno)); close(sfd); return rc; } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/27024 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idbe7582b2b7f14540919e911dad08af6d491f68f Gerrit-Change-Number: 27024 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmocore[master]: add osmo_quote_str_buf3, osmo_escape_str_buf3
by neels 31 Jan '22

31 Jan '22
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/27025 ) Change subject: add osmo_quote_str_buf3, osmo_escape_str_buf3 ...................................................................... add osmo_quote_str_buf3, osmo_escape_str_buf3 There already are osmo_quote_str_buf() and osmo_quote_str_buf2(), same for _escape_, but none of them return the snprintf() like string length. A private function does, publish this in the API. The returned chars_needed is required to accurately allocate sufficient size in string functions that call osmo_quote_str/osmo_escape_str. I am adding such in osmo-upf.git. Related: SYS#5599 Change-Id: I05d75a40599e3133da099a11e8babaaad0e9493a --- M include/osmocom/core/utils.h M src/utils.c 2 files changed, 29 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/27025/1 diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 327aa3d..eda0e39 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -157,10 +157,12 @@ char *osmo_quote_cstr_c(void *ctx, const char *str, int in_len); const char *osmo_escape_str(const char *str, int len); +int osmo_escape_str_buf3(char *buf, size_t bufsize, const char *str, int in_len); char *osmo_escape_str_buf2(char *buf, size_t bufsize, const char *str, int in_len); const char *osmo_escape_str_buf(const char *str, int in_len, char *buf, size_t bufsize); char *osmo_escape_str_c(const void *ctx, const char *str, int in_len); const char *osmo_quote_str(const char *str, int in_len); +int osmo_quote_str_buf3(char *buf, size_t bufsize, const char *str, int in_len); char *osmo_quote_str_buf2(char *buf, size_t bufsize, const char *str, int in_len); const char *osmo_quote_str_buf(const char *str, int in_len, char *buf, size_t bufsize); char *osmo_quote_str_c(const void *ctx, const char *str, int in_len); diff --git a/src/utils.c b/src/utils.c index 357ed53..2012b74 100644 --- a/src/utils.c +++ b/src/utils.c @@ -754,7 +754,7 @@ * the non-legacy format also escapes those as "\xNN" sequences. * \return Number of characters that would be written if bufsize were large enough excluding '\0' (like snprintf()). */ -static size_t _osmo_escape_str_buf(char *buf, size_t bufsize, const char *str, int in_len, bool legacy_format) +static int _osmo_escape_str_buf(char *buf, size_t bufsize, const char *str, int in_len, bool legacy_format) { struct osmo_strbuf sb = { .buf = buf, .len = bufsize }; int in_pos = 0; @@ -826,6 +826,18 @@ * \param[in] bufsize sizeof(buf). * \param[in] str A string that may contain any characters. * \param[in] in_len Pass -1 to print until nul char, or >= 0 to force a length (also past nul chars). + * \return Number of characters that would be written if bufsize were large enough excluding '\0' (like snprintf()). + */ +int osmo_escape_str_buf3(char *buf, size_t bufsize, const char *str, int in_len) +{ + return _osmo_escape_str_buf(buf, bufsize, str, in_len, false); +} + +/*! Return the string with all non-printable characters escaped. + * \param[out] buf string buffer to write escaped characters to. + * \param[in] bufsize sizeof(buf). + * \param[in] str A string that may contain any characters. + * \param[in] in_len Pass -1 to print until nul char, or >= 0 to force a length (also past nul chars). * \return The output buffer (buf). */ char *osmo_escape_str_buf2(char *buf, size_t bufsize, const char *str, int in_len) @@ -883,6 +895,20 @@ return sb.chars_needed; } +/*! Like osmo_escape_str_buf3(), but returns double-quotes around a string, or "NULL" for a NULL string. + * This allows passing any char* value and get its C representation as string. + * The function signature is suitable for OSMO_STRBUF_APPEND_NOLEN(). + * \param[out] buf string buffer to write escaped characters to. + * \param[in] bufsize sizeof(buf). + * \param[in] str A string that may contain any characters. + * \param[in] in_len Pass -1 to print until nul char, or >= 0 to force a length. + * \return Number of characters that would be written if bufsize were large enough excluding '\0' (like snprintf()). + */ +int osmo_quote_str_buf3(char *buf, size_t bufsize, const char *str, int in_len) +{ + return _osmo_quote_str_buf(buf, bufsize, str, in_len, false); +} + /*! Like osmo_escape_str_buf2(), but returns double-quotes around a string, or "NULL" for a NULL string. * This allows passing any char* value and get its C representation as string. * The function signature is suitable for OSMO_STRBUF_APPEND_NOLEN(). -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/27025 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I05d75a40599e3133da099a11e8babaaad0e9493a Gerrit-Change-Number: 27025 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-iuh[master]: ranap_common: add function to determine procedure code
by dexter 31 Jan '22

31 Jan '22
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26900 ) Change subject: ranap_common: add function to determine procedure code ...................................................................... ranap_common: add function to determine procedure code In some cases it is helpful to know the procedure code of a RANAP PDU. Lets add a function that decodes the procedure code from a RANAP PDU. Change-Id: I531dfbdd80606462b481f1a16815ec7d81000121 Related: OS#5152 --- M include/osmocom/ranap/ranap_common.h M src/ranap_common.c M src/tests/test-ranap.c 3 files changed, 61 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/00/26900/1 diff --git a/include/osmocom/ranap/ranap_common.h b/include/osmocom/ranap/ranap_common.h index 0343a57..e9e7a2e 100644 --- a/include/osmocom/ranap/ranap_common.h +++ b/include/osmocom/ranap/ranap_common.h @@ -648,3 +648,6 @@ int ranap_decode_rab_setupormodifyitemfirst( RANAP_RAB_SetupOrModifyItemFirst_t *raB_SetupOrModifyItemFirst, ANY_t *any_p); + +int ranap_decode_procedure_code(const uint8_t *ranap_pdu_encoded, + unsigned int len); diff --git a/src/ranap_common.c b/src/ranap_common.c index 6c6d97c..b361eb1 100644 --- a/src/ranap_common.c +++ b/src/ranap_common.c @@ -607,3 +607,42 @@ return decoded; } + +int ranap_decode_procedure_code(const uint8_t *ranap_pdu_encoded, unsigned int len) +{ + int rc; + asn_dec_rval_t dec_ret; + RANAP_RANAP_PDU_t _ranap_pdu; + RANAP_RANAP_PDU_t *ranap_pdu = &_ranap_pdu; + + memset(ranap_pdu, 0, sizeof(*ranap_pdu)); + + /* Decode the RANAP PDU */ + dec_ret = aper_decode(NULL, &asn_DEF_RANAP_RANAP_PDU, (void **)&ranap_pdu, ranap_pdu_encoded, len, 0, 0); + if (dec_ret.code != RC_OK) { + RANAP_DEBUG("Error in RANAP ASN.1 decode\n"); + return -EINVAL; + } + + switch (ranap_pdu->present) { + case RANAP_RANAP_PDU_PR_initiatingMessage: + rc = ranap_pdu->choice.initiatingMessage.procedureCode; + break; + case RANAP_RANAP_PDU_PR_successfulOutcome: + rc = ranap_pdu->choice.successfulOutcome.procedureCode; + break; + case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: + rc = ranap_pdu->choice.unsuccessfulOutcome.procedureCode; + break; + case RANAP_RANAP_PDU_PR_outcome: + rc = ranap_pdu->choice.outcome.procedureCode; + break; + default: + rc = -1; + break; + } + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RANAP_PDU, ranap_pdu); + + return rc; +} diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c index 73987f6..c3cdb35 100644 --- a/src/tests/test-ranap.c +++ b/src/tests/test-ranap.c @@ -173,6 +173,24 @@ } } +static void test_ranap_decode_procedure_code(void) +{ + int rc; + /* Encoded RAB AssignmentResponse as testvector */ + uint8_t testvec[] = { + 0x60, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x01, 0x00, + 0x34, 0x40, 0x23, 0x00, 0x00, 0x01, 0x00, 0x33, + 0x40, 0x1c, 0x60, 0x3a, 0x7c, 0x35, 0x00, 0x01, + 0x0a, 0x09, 0x01, 0xa4, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x04, 0x0a, 0x00, 0x00 + }; + + rc = ranap_decode_procedure_code(testvec, sizeof(testvec)); + + OSMO_ASSERT(rc == RANAP_ProcedureCode_id_RAB_Assignment); +} + int main(int argc, char **argv) { asn1_xer_print = 1; @@ -195,6 +213,7 @@ test_aper_int(16000000); test_aper_causemisc(RANAP_CauseMisc_unspecified_failure, 0x42); test_ranap_messages(); + test_ranap_decode_procedure_code(); printf("report\n"); talloc_report(talloc_asn1_ctx, stdout); -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26900 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I531dfbdd80606462b481f1a16815ec7d81000121 Gerrit-Change-Number: 26900 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newchange
1 4
0 0
Change in libosmocore[master]: add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2()
by neels 31 Jan '22

31 Jan '22
neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26608 ) Change subject: add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2() ...................................................................... add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2() To easily log and print a sockaddr using OTC_SELECT, add osmo_sockaddr_to_str_c(). Implement osmo_sockaddr_to_str_buf2() using osmo_strbuf, so that we can return the chars_needed which osmo_sockaddr_to_str_c() uses. From previous osmo_sockaddr_to_str_buf(), call osmo_sockaddr_to_str_buf2() and return NULL if the buf_len was insufficient, to mimick previous behavior. This makes it more consistently returning NULL for insufficient buf_len, as shown in the tweak that is needed in socket_test.c. Before osmo_sockaddr_to_str_buf() would return a truncated port number, now it's all or NULL. I will use osmo_sockaddr_to_str_c() in the new osmo-upf implementation. Related: SYS#5599 Change-Id: I12771bf8a021e6785217b1faad03c09ec1cfef0e --- M include/osmocom/core/socket.h M src/socket.c M tests/socket/socket_test.c 3 files changed, 59 insertions(+), 39 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve neels: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h index a053391..6d11e6f 100644 --- a/include/osmocom/core/socket.h +++ b/include/osmocom/core/socket.h @@ -130,6 +130,8 @@ const char *osmo_sockaddr_to_str(const struct osmo_sockaddr *sockaddr); char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr); +int osmo_sockaddr_to_str_buf2(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr); +char *osmo_sockaddr_to_str_c(void *ctx, const struct osmo_sockaddr *sockaddr); int osmo_sock_set_dscp(int fd, uint8_t dscp); int osmo_sock_set_priority(int fd, int prio); diff --git a/src/socket.c b/src/socket.c index 449c825..0ffa11d 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1776,7 +1776,57 @@ return osmo_sockaddr_to_str_buf(buf, sizeof(buf), sockaddr); } -/*! string-format a given osmo_sockaddr address into a user-supplied buffer +/*! string-format a given osmo_sockaddr address into a user-supplied buffer. + * Same as osmo_sockaddr_to_str_buf() but returns a would-be length in snprintf() style. + * \param[in] buf user-supplied output buffer + * \param[in] buf_len size of the user-supplied output buffer in bytes + * \param[in] sockaddr the osmo_sockaddr to print + * \return number of characters that would be written if the buffer is large enough, like snprintf(). + */ +int osmo_sockaddr_to_str_buf2(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr) +{ + struct osmo_strbuf sb = { .buf = buf, .len = buf_len }; + uint16_t port = 0; + + if (!sockaddr) { + OSMO_STRBUF_PRINTF(sb, "NULL"); + return sb.chars_needed; + } + + switch (sockaddr->u.sa.sa_family) { + case AF_INET: + OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_and_uint, &port, &sockaddr->u.sa); + if (port) + OSMO_STRBUF_PRINTF(sb, ":%u", port); + break; + case AF_INET6: + OSMO_STRBUF_PRINTF(sb, "["); + OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_and_uint, &port, &sockaddr->u.sa); + OSMO_STRBUF_PRINTF(sb, "]"); + if (port) + OSMO_STRBUF_PRINTF(sb, ":%u", port); + break; + default: + OSMO_STRBUF_PRINTF(sb, "unsupported family %d", sockaddr->u.sa.sa_family); + break; + } + + return sb.chars_needed; +} + +/*! string-format a given osmo_sockaddr address into a talloc allocated buffer. + * Like osmo_sockaddr_to_str_buf2() but returns a talloc allocated string. + * \param[in] ctx talloc context to allocate from, e.g. OTC_SELECT. + * \param[in] sockaddr the osmo_sockaddr to print. + * \return human readable string. + */ +char *osmo_sockaddr_to_str_c(void *ctx, const struct osmo_sockaddr *sockaddr) +{ + OSMO_NAME_C_IMPL(ctx, 64, "ERROR", osmo_sockaddr_to_str_buf2, sockaddr) +} + +/*! string-format a given osmo_sockaddr address into a user-supplied buffer. + * Like osmo_sockaddr_to_str_buf2() but returns buf, or NULL if too short. * \param[in] buf user-supplied output buffer * \param[in] buf_len size of the user-supplied output buffer in bytes * \param[in] sockaddr the osmo_sockaddr to print @@ -1785,43 +1835,9 @@ char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr) { - uint16_t port = 0; - size_t written; - if (buf_len < 5) + int chars_needed = osmo_sockaddr_to_str_buf2(buf, buf_len, sockaddr); + if (chars_needed >= buf_len) return NULL; - - if (!sockaddr) - return NULL; - - switch (sockaddr->u.sa.sa_family) { - case AF_INET: - written = osmo_sockaddr_to_str_and_uint(buf, buf_len, &port, &sockaddr->u.sa); - if (written + 1 >= buf_len && port) - return NULL; - if (port) - snprintf(buf + written, buf_len - written, ":%u", port); - break; - case AF_INET6: - buf[0] = '['; - written = osmo_sockaddr_to_str_and_uint(buf + 1, buf_len - 1, &port, &sockaddr->u.sa); - if (written + 2 >= buf_len) - return NULL; - - if (written + 3 >= buf_len && port) - return NULL; - - if (port) - snprintf(buf + 1 + written, buf_len - written - 1, "]:%u", port); - else { - buf[written + 1] = ']'; - buf[written + 2] = 0; - } - break; - default: - snprintf(buf, buf_len, "unsupported family %d", sockaddr->u.sa.sa_family); - return buf; - } - return buf; } diff --git a/tests/socket/socket_test.c b/tests/socket/socket_test.c index eda716a..fe77b92 100644 --- a/tests/socket/socket_test.c +++ b/tests/socket/socket_test.c @@ -345,9 +345,11 @@ OSMO_ASSERT(!strncmp("[::1]:42", result, sizeof(buf))); memset(&buf[0], 0, sizeof(buf)); - result = osmo_sockaddr_to_str_buf(buf, 8, &localhost6); printf("Checking osmo_sockaddr_to_str_buf too short IPv6\n"); - OSMO_ASSERT(!strncmp("[::1]:4", result, sizeof(buf))); + result = osmo_sockaddr_to_str_buf(buf, 8, &localhost6); + OSMO_ASSERT(result == NULL); + osmo_sockaddr_to_str_buf2(buf, 8, &localhost6); + OSMO_ASSERT(!strncmp("[::1]:4", buf, sizeof(buf))); memset(&buf[0], 0, sizeof(buf)); result = osmo_sockaddr_to_str_buf(buf, 5, &localhost6); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26608 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I12771bf8a021e6785217b1faad03c09ec1cfef0e Gerrit-Change-Number: 26608 Gerrit-PatchSet: 3 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmocore[master]: add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2()
by neels 31 Jan '22

31 Jan '22
Attention is currently required from: pespin. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26608 ) Change subject: add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2() ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26608 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I12771bf8a021e6785217b1faad03c09ec1cfef0e Gerrit-Change-Number: 26608 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 31 Jan 2022 15:03:41 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-e1d[master]: Allow configuration of interfaces/lines via VTY
by laforge 31 Jan '22

31 Jan '22
Attention is currently required from: tnt. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27016 ) Change subject: Allow configuration of interfaces/lines via VTY ...................................................................... Patch Set 3: (1 comment) Patchset: PS2: > It fails to re-read the config files it write. […] thanks, nice catch. the uppercase/lowercase issue is now fixed. watchdog: yes, has a separate issue, will be adressed. -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27016 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I89b57b688b68901f87d9683ab9294772ee747d77 Gerrit-Change-Number: 27016 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: tnt <tnt(a)246tNt.com> Gerrit-Comment-Date: Mon, 31 Jan 2022 14:49:17 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: tnt <tnt(a)246tNt.com> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-e1d[master]: Allow configuration of interfaces/lines via VTY
by laforge 31 Jan '22

31 Jan '22
Attention is currently required from: laforge. Hello Jenkins Builder, tnt, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-e1d/+/27016 to look at the new patch set (#3). Change subject: Allow configuration of interfaces/lines via VTY ...................................................................... Allow configuration of interfaces/lines via VTY So far, osmo-e1d automatically opened all compatible icE1usb devices and all E1 lines on those interfaces. Let's allow for 'interface' and 'line' configuration in the VTY. USB devices can be identified by their serial number string. If a given device (== E1 interface) has a VTY configuration, then only those E1 lines with VTY configuration opened. For each Line (icE1usb or vpair), the mode (channelized/superchannel) can also be set via VTY. Change-Id: I89b57b688b68901f87d9683ab9294772ee747d77 Closes: OS#5400 --- M src/e1d.h M src/intf_line.c M src/usb.c M src/vty.c 4 files changed, 257 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/16/27016/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27016 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I89b57b688b68901f87d9683ab9294772ee747d77 Gerrit-Change-Number: 27016 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-e1-hardware[master]: icE1usb: Move GPS-DO USB control to separate USB interface
by laforge 31 Jan '22

31 Jan '22
Attention is currently required from: roox, roh. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/27017 ) Change subject: icE1usb: Move GPS-DO USB control to separate USB interface ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/27017 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Icd6555a14896c38626fb147b78af44ff719f2254 Gerrit-Change-Number: 27017 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: roh <jsteiger(a)sysmocom.de> Gerrit-Reviewer: roox <mardnh(a)gmx.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: roox <mardnh(a)gmx.de> Gerrit-Attention: roh <jsteiger(a)sysmocom.de> Gerrit-Comment-Date: Mon, 31 Jan 2022 14:25:49 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • ...
  • 79
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.