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-iuh[master]: iu_helpers: make new_transp_info_(rtp|gtp) public
by laforge 10 Jan '22

10 Jan '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26722 ) Change subject: iu_helpers: make new_transp_info_(rtp|gtp) public ...................................................................... iu_helpers: make new_transp_info_(rtp|gtp) public The functions new_transp_info_rtp and new_transp_info_gtp are needed to generate the transport layer information struct. The functions are currently not public since they are only used in ranap_msg_factory.c but to reqwrite the RANAP RAB AssignmentReqtest / AssignmentResponse messages we can reuse this code, so lets make them public. Change-Id: I1e369718de8c4c7db1f1af1e6864562164ada6cf Related: OS#5152 --- M include/osmocom/ranap/iu_helpers.h M src/iu_helpers.c M src/ranap_msg_factory.c M src/tests/test-helpers.c M src/tests/test-helpers.ok 5 files changed, 267 insertions(+), 59 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/ranap/iu_helpers.h b/include/osmocom/ranap/iu_helpers.h index 9d801be..d824646 100644 --- a/include/osmocom/ranap/iu_helpers.h +++ b/include/osmocom/ranap/iu_helpers.h @@ -1,13 +1,20 @@ #pragma once #include <stdint.h> +#include <stdbool.h> #include <sys/types.h> #include <osmocom/ranap/RANAP_IuTransportAssociation.h> #include <osmocom/ranap/RANAP_TransportLayerAddress.h> +#include <osmocom/ranap/RANAP_TransportLayerInformation.h> + +struct osmo_sockaddr; int ranap_bcd_decode(char *out, size_t out_len, const uint8_t *in, size_t in_len); int ranap_imsi_encode(uint8_t *out, size_t out_len, const char *in); int ranap_transp_assoc_decode(uint16_t *port, const RANAP_IuTransportAssociation_t *transp_assoc); int ranap_transp_layer_addr_decode(char *addr, unsigned int addr_len, const RANAP_TransportLayerAddress_t *trasp_layer_addr); +RANAP_TransportLayerInformation_t *ranap_new_transp_info_rtp(struct osmo_sockaddr *addr, bool use_x213_nsap); +RANAP_TransportLayerInformation_t *ranap_new_transp_info_gtp(struct osmo_sockaddr *addr, uint32_t tei, + bool use_x213_nsap); diff --git a/src/iu_helpers.c b/src/iu_helpers.c index bf82fde..392622f 100644 --- a/src/iu_helpers.c +++ b/src/iu_helpers.c @@ -24,8 +24,12 @@ #include <arpa/inet.h> #include "asn1helpers.h" #include <osmocom/core/utils.h> +#include <osmocom/core/socket.h> +#include <osmocom/core/bit16gen.h> + #include <osmocom/ranap/RANAP_IuTransportAssociation.h> #include <osmocom/ranap/RANAP_TransportLayerAddress.h> +#include <osmocom/ranap/RANAP_TransportLayerInformation.h> /* decode a BCD-string as used inside ASN.1 encoded Iu interface protocols */ int ranap_bcd_decode(char *out, size_t out_len, const uint8_t *in, size_t in_len) @@ -121,3 +125,102 @@ return 0; } + +static int new_transp_layer_addr(BIT_STRING_t *out, struct osmo_sockaddr *addr, bool use_x213_nsap) +{ + uint8_t *buf; + unsigned int len; + size_t ip_len; + uint8_t *ip_addr; + uint16_t icp; + + switch (addr->u.sa.sa_family) { + case AF_INET: + ip_len = sizeof(addr->u.sin.sin_addr.s_addr); + ip_addr = (uint8_t *) &addr->u.sin.sin_addr.s_addr; + icp = 0x0001; /* See X.213, section A.5.2.1.2.7 */ + break; + case AF_INET6: + ip_len = sizeof(addr->u.sin6.sin6_addr.s6_addr); + ip_addr = addr->u.sin6.sin6_addr.s6_addr; + icp = 0x0000; /* See X.213, section A.5.2.1.2.7 */ + break; + default: + return -EINVAL; + } + + if (use_x213_nsap) { + /* 3 bytes IDP (AFI+ICP) + 17 bytes DSP */ + len = 3 + 17; + buf = CALLOC(len, sizeof(uint8_t)); + + /* 1 byte AFI to announce IANA ICP, see also X.213, table A.4 */ + buf[0] = 0x35; + + /* 2 byte IANA ICP IDI, see also X.213, A.5.2.1.2.7 */ + osmo_store16be(icp, &buf[1]); + + /* 17 byte DSP, see also X.213, table A.5 and A.5.2.1.2.7 */ + memcpy(&buf[3], ip_addr, ip_len); + } else { + len = ip_len; + buf = CALLOC(len, sizeof(uint8_t)); + memcpy(buf, ip_addr, ip_len); + } + out->buf = buf; + out->size = len; + out->bits_unused = 0; + + return 0; +} + +RANAP_TransportLayerInformation_t *ranap_new_transp_info_rtp(struct osmo_sockaddr *addr, bool use_x213_nsap) +{ + RANAP_TransportLayerInformation_t *tli; + uint8_t binding_id[4] = { 0 }; + int rc; + + switch (addr->u.sin.sin_family) { + case AF_INET: + osmo_store16be(ntohs(addr->u.sin.sin_port), binding_id); + break; + case AF_INET6: + osmo_store16be(ntohs(addr->u.sin6.sin6_port), binding_id); + break; + default: + return NULL; + } + + tli = CALLOC(1, sizeof(*tli)); + rc = new_transp_layer_addr(&tli->transportLayerAddress, addr, use_x213_nsap); + if (rc < 0) { + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + return NULL; + } + + tli->iuTransportAssociation.present = RANAP_IuTransportAssociation_PR_bindingID; + OCTET_STRING_fromBuf(&tli->iuTransportAssociation.choice.bindingID, + (const char *)binding_id, sizeof(binding_id)); + + return tli; +} + +RANAP_TransportLayerInformation_t *ranap_new_transp_info_gtp(struct osmo_sockaddr *addr, uint32_t tei, + bool use_x213_nsap) +{ + RANAP_TransportLayerInformation_t *tli = CALLOC(1, sizeof(*tli)); + uint32_t binding_buf = htonl(tei); + int rc; + + rc = new_transp_layer_addr(&tli->transportLayerAddress, addr, use_x213_nsap); + if (rc < 0) { + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + return NULL; + } + + tli->iuTransportAssociation.present = RANAP_IuTransportAssociation_PR_gTP_TEI; + OCTET_STRING_fromBuf(&tli->iuTransportAssociation.choice.gTP_TEI, + (const char *)&binding_buf, sizeof(binding_buf)); + + return tli; +} diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c index f93a2ab..60dc9e0 100644 --- a/src/ranap_msg_factory.c +++ b/src/ranap_msg_factory.c @@ -20,6 +20,7 @@ #include <osmocom/core/utils.h> #include <osmocom/core/msgb.h> +#include <osmocom/core/socket.h> #include "asn1helpers.h" #include <osmocom/ranap/iu_helpers.h> @@ -691,61 +692,6 @@ return rab; } -static void new_transp_layer_addr(BIT_STRING_t *out, uint32_t ip, bool use_x213_nsap) -{ - uint8_t *buf; - unsigned int len; - uint32_t ip_h = ntohl(ip); - - if (use_x213_nsap) { - len = 160/8; - buf = CALLOC(len, sizeof(uint8_t)); - buf[0] = 0x35; /* AFI For IANA ICP */ - buf[1] = 0x00; /* See A.5.2.1.2.7 of X.213 */ - buf[2] = 0x01; - memcpy(&buf[3], &ip_h, sizeof(ip_h)); - } else { - len = sizeof(ip_h); - buf = CALLOC(len, sizeof(uint8_t)); - memcpy(buf, &ip_h, sizeof(ip_h)); - } - out->buf = buf; - out->size = len; - out->bits_unused = 0; -} - -static RANAP_TransportLayerInformation_t *new_transp_info_rtp(uint32_t ip, uint16_t port, - bool use_x213_nsap) -{ - RANAP_TransportLayerInformation_t *tli = CALLOC(1, sizeof(*tli)); - uint8_t binding_id[4]; - - binding_id[0] = port >> 8; - binding_id[1] = port & 0xff; - binding_id[2] = binding_id[3] = 0; - - new_transp_layer_addr(&tli->transportLayerAddress, ip, use_x213_nsap); - tli->iuTransportAssociation.present = RANAP_IuTransportAssociation_PR_bindingID; - OCTET_STRING_fromBuf(&tli->iuTransportAssociation.choice.bindingID, - (const char *) binding_id, sizeof(binding_id)); - - return tli; -} - -static RANAP_TransportLayerInformation_t *new_transp_info_gtp(uint32_t ip, uint32_t tei, - bool use_x213_nsap) -{ - RANAP_TransportLayerInformation_t *tli = CALLOC(1, sizeof(*tli)); - uint32_t binding_buf = htonl(tei); - - new_transp_layer_addr(&tli->transportLayerAddress, ip, use_x213_nsap); - tli->iuTransportAssociation.present = RANAP_IuTransportAssociation_PR_gTP_TEI; - OCTET_STRING_fromBuf(&tli->iuTransportAssociation.choice.gTP_TEI, - (const char *) &binding_buf, sizeof(binding_buf)); - - return tli; -} - static RANAP_UserPlaneInformation_t *new_upi(long mode, uint8_t mode_versions) { RANAP_UserPlaneInformation_t *upi = CALLOC(1, sizeof(*upi)); @@ -786,6 +732,7 @@ RANAP_RAB_AssignmentRequest_t out; struct msgb *msg; int rc; + struct osmo_sockaddr rtp_addr; memset(&ies, 0, sizeof(ies)); memset(&out, 0, sizeof(out)); @@ -800,8 +747,11 @@ first.nAS_SynchronisationIndicator = new_rab_nas_sync_ind(60); first.rAB_Parameters = new_rab_par_voice(6700, 12200); first.userPlaneInformation = new_upi(RANAP_UserPlaneMode_support_mode_for_predefined_SDU_sizes, 1); /* 2? */ - first.transportLayerInformation = new_transp_info_rtp(rtp_ip, rtp_port, - use_x213_nsap); + + rtp_addr.u.sin.sin_family = AF_INET; + rtp_addr.u.sin.sin_port = htons(rtp_port); + rtp_addr.u.sin.sin_addr.s_addr = htonl(rtp_ip); + first.transportLayerInformation = ranap_new_transp_info_rtp(&rtp_addr, use_x213_nsap); /* put together the 'Second' part */ RANAP_RAB_SetupOrModifyItemSecond_t second; @@ -855,6 +805,7 @@ RANAP_DataVolumeReportingIndication_t *dat_vol_ind; struct msgb *msg; int rc; + struct osmo_sockaddr gtp_addr; memset(&ies, 0, sizeof(ies)); memset(&out, 0, sizeof(out)); @@ -870,8 +821,10 @@ first.rAB_Parameters = new_rab_par_data(1600000, 800000); first.userPlaneInformation = new_upi(RANAP_UserPlaneMode_transparent_mode, 1); - first.transportLayerInformation = new_transp_info_gtp(gtp_ip, gtp_tei, - use_x213_nsap); + + gtp_addr.u.sin.sin_family = AF_INET; + gtp_addr.u.sin.sin_addr.s_addr = htonl(gtp_ip); + first.transportLayerInformation = ranap_new_transp_info_gtp(&gtp_addr, gtp_tei, use_x213_nsap); /* put together the 'Second' part */ RANAP_RAB_SetupOrModifyItemSecond_t second; diff --git a/src/tests/test-helpers.c b/src/tests/test-helpers.c index 5c617e5..96540dc 100644 --- a/src/tests/test-helpers.c +++ b/src/tests/test-helpers.c @@ -28,6 +28,7 @@ #define ASSERT(x) assert(x) #include <osmocom/core/utils.h> +#include <osmocom/core/socket.h> #include <osmocom/gsm/gsm48.h> #include <osmocom/ranap/RANAP_LAI.h> @@ -204,6 +205,120 @@ OSMO_ASSERT(rc == -1); } +void test_ranap_new_transp_info_rtp(void) +{ + RANAP_TransportLayerInformation_t *tli; + + printf("Testing function ranap_new_transp_info_rtp()\n"); + + struct osmo_sockaddr addr; + + addr.u.sin.sin_family = AF_INET; + addr.u.sin.sin_port = htons(0x1122); + inet_pton(AF_INET, "1.2.3.4", &addr.u.sin.sin_addr); + + printf(" ipv4, x213_nsap\n"); + tli = ranap_new_transp_info_rtp(&addr, true); + printf(" transportLayerAddress = %s\n", + osmo_hexdump_nospc(tli->transportLayerAddress.buf, tli->transportLayerAddress.size)); + printf(" bindingID = %s\n", + osmo_hexdump_nospc(tli->iuTransportAssociation.choice.bindingID.buf, + tli->iuTransportAssociation.choice.bindingID.size)); + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + + printf(" ipv4\n"); + tli = ranap_new_transp_info_rtp(&addr, false); + printf(" transportLayerAddress = %s\n", + osmo_hexdump_nospc(tli->transportLayerAddress.buf, tli->transportLayerAddress.size)); + printf(" bindingID = %s\n", + osmo_hexdump_nospc(tli->iuTransportAssociation.choice.bindingID.buf, + tli->iuTransportAssociation.choice.bindingID.size)); + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + + addr.u.sin.sin_family = AF_INET6; + addr.u.sin.sin_port = htons(0x1122); + inet_pton(AF_INET6, "f11f:f22f:f33f:f44f:f55f:f66f:f77f:f88f", &addr.u.sin6.sin6_addr); + + printf(" ipv6, x213_nsap\n"); + tli = ranap_new_transp_info_rtp(&addr, true); + printf(" transportLayerAddress = %s\n", + osmo_hexdump_nospc(tli->transportLayerAddress.buf, tli->transportLayerAddress.size)); + printf(" bindingID = %s\n", + osmo_hexdump_nospc(tli->iuTransportAssociation.choice.bindingID.buf, + tli->iuTransportAssociation.choice.bindingID.size)); + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + + printf(" ipv6\n"); + tli = ranap_new_transp_info_rtp(&addr, false); + printf(" transportLayerAddress = %s\n", + osmo_hexdump_nospc(tli->transportLayerAddress.buf, tli->transportLayerAddress.size)); + printf(" bindingID = %s\n", + osmo_hexdump_nospc(tli->iuTransportAssociation.choice.bindingID.buf, + tli->iuTransportAssociation.choice.bindingID.size)); + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + + addr.u.sin.sin_family = AF_X25; + printf(" unsupported address family\n"); + tli = ranap_new_transp_info_rtp(&addr, false); + OSMO_ASSERT(tli == NULL); +} + +void test_ranap_new_transp_info_gtp(void) +{ + RANAP_TransportLayerInformation_t *tli; + + printf("Testing function ranap_new_transp_info_gtp()\n"); + + struct osmo_sockaddr addr; + + addr.u.sin.sin_family = AF_INET; + inet_pton(AF_INET, "1.2.3.4", &addr.u.sin.sin_addr); + + printf(" ipv4, x213_nsap\n"); + tli = ranap_new_transp_info_gtp(&addr, 0x11223344, true); + printf(" transportLayerAddress = %s\n", + osmo_hexdump_nospc(tli->transportLayerAddress.buf, tli->transportLayerAddress.size)); + printf(" gTP_TEI = %s\n", + osmo_hexdump_nospc(tli->iuTransportAssociation.choice.gTP_TEI.buf, + tli->iuTransportAssociation.choice.gTP_TEI.size)); + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + + printf(" ipv4\n"); + tli = ranap_new_transp_info_gtp(&addr, 0x11223344, false); + printf(" transportLayerAddress = %s\n", + osmo_hexdump_nospc(tli->transportLayerAddress.buf, tli->transportLayerAddress.size)); + printf(" gTP_TEI = %s\n", + osmo_hexdump_nospc(tli->iuTransportAssociation.choice.gTP_TEI.buf, + tli->iuTransportAssociation.choice.gTP_TEI.size)); + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + + addr.u.sin.sin_family = AF_INET6; + inet_pton(AF_INET6, "f11f:f22f:f33f:f44f:f55f:f66f:f77f:f88f", &addr.u.sin6.sin6_addr); + + printf(" ipv6, x213_nsap\n"); + tli = ranap_new_transp_info_gtp(&addr, 0x11223344, true); + printf(" transportLayerAddress = %s\n", + osmo_hexdump_nospc(tli->transportLayerAddress.buf, tli->transportLayerAddress.size)); + printf(" gTP_TEI = %s\n", + osmo_hexdump_nospc(tli->iuTransportAssociation.choice.gTP_TEI.buf, + tli->iuTransportAssociation.choice.gTP_TEI.size)); + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + + printf(" ipv6\n"); + tli = ranap_new_transp_info_gtp(&addr, 0x11223344, false); + printf(" transportLayerAddress = %s\n", + osmo_hexdump_nospc(tli->transportLayerAddress.buf, tli->transportLayerAddress.size)); + printf(" gTP_TEI = %s\n", + osmo_hexdump_nospc(tli->iuTransportAssociation.choice.gTP_TEI.buf, + tli->iuTransportAssociation.choice.gTP_TEI.size)); + ASN_STRUCT_FREE(asn_DEF_RANAP_TransportLayerInformation, tli); + + addr.u.sin.sin_family = AF_X25; + printf(" unsupported address family\n"); + tli = ranap_new_transp_info_gtp(&addr, 0x11223344, false); + OSMO_ASSERT(tli == NULL); +} + int main(int argc, char **argv) { asn1_xer_print = 0; @@ -214,6 +329,8 @@ test_iu_helpers(); test_asn1_helpers(); test_ranap_common(); + test_ranap_new_transp_info_gtp(); + test_ranap_new_transp_info_rtp(); test_common_cleanup(); return 0; diff --git a/src/tests/test-helpers.ok b/src/tests/test-helpers.ok index f2e466f..049fbb4 100644 --- a/src/tests/test-helpers.ok +++ b/src/tests/test-helpers.ok @@ -23,3 +23,31 @@ rc == -1 PLMN-Id [ 21 43 65 ], LAC [ ab ] rc == -1 +Testing function ranap_new_transp_info_gtp() + ipv4, x213_nsap + transportLayerAddress = 3500010102030400000000000000000000000000 + gTP_TEI = 11223344 + ipv4 + transportLayerAddress = 01020304 + gTP_TEI = 11223344 + ipv6, x213_nsap + transportLayerAddress = 350000f11ff22ff33ff44ff55ff66ff77ff88f00 + gTP_TEI = 11223344 + ipv6 + transportLayerAddress = f11ff22ff33ff44ff55ff66ff77ff88f + gTP_TEI = 11223344 + unsupported address family +Testing function ranap_new_transp_info_rtp() + ipv4, x213_nsap + transportLayerAddress = 3500010102030400000000000000000000000000 + bindingID = 11220000 + ipv4 + transportLayerAddress = 01020304 + bindingID = 11220000 + ipv6, x213_nsap + transportLayerAddress = 350000f11ff22ff33ff44ff55ff66ff77ff88f00 + bindingID = 11220000 + ipv6 + transportLayerAddress = f11ff22ff33ff44ff55ff66ff77ff88f + bindingID = 11220000 + unsupported address family -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26722 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I1e369718de8c4c7db1f1af1e6864562164ada6cf Gerrit-Change-Number: 26722 Gerrit-PatchSet: 6 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-iuh[master]: iu_helpers: make new_transp_info_(rtp|gtp) public
by laforge 10 Jan '22

10 Jan '22
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26722 ) Change subject: iu_helpers: make new_transp_info_(rtp|gtp) public ...................................................................... Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26722 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I1e369718de8c4c7db1f1af1e6864562164ada6cf Gerrit-Change-Number: 26722 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 10 Jan 2022 14:00:26 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: iuup: Improve CRC checksum error logging
by pespin 10 Jan '22

10 Jan '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/26825 ) Change subject: iuup: Improve CRC checksum error logging ...................................................................... iuup: Improve CRC checksum error logging Change-Id: I14f2ff14af24f20b788d123c0bfb47aeb0333d19 --- M src/gsm/iuup.c 1 file changed, 8 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/26825/1 diff --git a/src/gsm/iuup.c b/src/gsm/iuup.c index c0e12a7..7881257 100644 --- a/src/gsm/iuup.c +++ b/src/gsm/iuup.c @@ -835,7 +835,7 @@ header_crc_computed = osmo_iuup_compute_header_crc(data, len); if (iuup_get_hdr_crc(data) != header_crc_computed) { - LOGP(DLIUUP, LOGL_NOTICE, "Checksum error: rx 0x%02x vs exp 0x%02x\n", + LOGP(DLIUUP, LOGL_NOTICE, "Header Checksum error: rx 0x%02x vs exp 0x%02x\n", iuup_get_hdr_crc(data), header_crc_computed); return -EIO; } @@ -849,7 +849,7 @@ payload_crc = ((uint16_t)t0h->payload_crc_hi << 8) | t0h->payload_crc_lo; payload_crc_computed = osmo_iuup_compute_payload_crc(data, len); if (payload_crc != payload_crc_computed) - return -EIO; + goto payload_crc_err; break; case IUUP_PDU_T_CONTROL: t14h = (struct iuup_pdutype14_hdr *) data; @@ -857,13 +857,18 @@ payload_crc = ((uint16_t)t14h->payload_crc_hi << 8) | t14h->payload_crc_lo; payload_crc_computed = osmo_iuup_compute_payload_crc(data, len); if (payload_crc != payload_crc_computed) - return -EIO; + goto payload_crc_err; } break; default: return -EINVAL; } return 0; + +payload_crc_err: + LOGP(DLIUUP, LOGL_NOTICE, "Payload Checksum error: rx 0x%02x vs exp 0x%02x\n", + payload_crc, payload_crc_computed); + return -EIO; } /* A IuUP TNL SAP primitive from transport (lower layer) */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26825 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I14f2ff14af24f20b788d123c0bfb47aeb0333d19 Gerrit-Change-Number: 26825 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
2 3
0 0
Change in libosmocore[master]: msgb: Fix -Wsign-compare warnings
by laforge 10 Jan '22

10 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/26815 ) Change subject: msgb: Fix -Wsign-compare warnings ...................................................................... msgb: Fix -Wsign-compare warnings Change-Id: I4bd14bb712fb3868b55d7e79d13276b707a6cdcb --- M src/msgb.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/15/26815/1 diff --git a/src/msgb.c b/src/msgb.c index ccb55aa..0881a55 100644 --- a/src/msgb.c +++ b/src/msgb.c @@ -426,11 +426,11 @@ */ char *msgb_hexdump_buf(char *buf, size_t buf_len, const struct msgb *msg) { - int buf_offs = 0; + unsigned int buf_offs = 0; int nchars; const unsigned char *start = msg->data; const unsigned char *lxhs[4]; - int i; + unsigned int i; lxhs[0] = msg->l1h; lxhs[1] = msg->l2h; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26815 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I4bd14bb712fb3868b55d7e79d13276b707a6cdcb Gerrit-Change-Number: 26815 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
2 3
0 0
Change in libosmocore[master]: socket, select: Fix -Wsign-compare warnings
by laforge 10 Jan '22

10 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/26814 ) Change subject: socket, select: Fix -Wsign-compare warnings ...................................................................... socket, select: Fix -Wsign-compare warnings Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 --- M src/select.c M src/socket.c 2 files changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/14/26814/1 diff --git a/src/select.c b/src/select.c index ddff132..735ea3e 100644 --- a/src/select.c +++ b/src/select.c @@ -316,7 +316,7 @@ } /* iterate over first n_fd entries of g_poll.poll + dispatch */ -static int poll_disp_fds(int n_fd) +static int poll_disp_fds(unsigned int n_fd) { struct osmo_fd *ufd; unsigned int i; diff --git a/src/socket.c b/src/socket.c index 1251061..b33116c 100644 --- a/src/socket.c +++ b/src/socket.c @@ -114,7 +114,7 @@ static int addrinfo_helper_multi(struct addrinfo **addrinfo, uint16_t family, uint16_t type, uint8_t proto, const char **hosts, size_t host_cnt, uint16_t port, bool passive) { - int i, j; + unsigned int i, j; for (i = 0; i < host_cnt; i++) { addrinfo[i] = addrinfo_helper(family, type, proto, hosts[i], port, passive); @@ -210,7 +210,8 @@ static int multiaddr_snprintf(char* buf, size_t buf_len, const char **hosts, size_t host_cnt) { int len = 0, offset = 0, rem = buf_len; - int ret, i; + unsigned int i; + int ret; char *after; if (buf_len < 3) @@ -665,7 +666,7 @@ /* Build array of addresses taking first addrinfo result of the requested family * for each host in addrs_buf. */ static int addrinfo_to_sockaddr(uint16_t family, const struct addrinfo **result, - const char **hosts, int host_cont, + const char **hosts, unsigned int host_cont, uint8_t *addrs_buf, size_t addrs_buf_len) { size_t host_idx, offset = 0; const struct addrinfo *rp; @@ -721,7 +722,7 @@ { struct addrinfo *res_loc[OSMO_SOCK_MAX_ADDRS], *res_rem[OSMO_SOCK_MAX_ADDRS]; int sfd = -1, rc, on = 1; - int i; + unsigned int i; bool loc_has_v4addr, rem_has_v4addr; bool loc_has_v6addr, rem_has_v6addr; struct sockaddr_in6 addrs_buf[OSMO_SOCK_MAX_ADDRS]; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 Gerrit-Change-Number: 26814 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
3 6
0 0
Change in osmo-iuh[master]: iu_helpers: make new_transp_info_(rtp|gtp) public
by pespin 10 Jan '22

10 Jan '22
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26722 ) Change subject: iu_helpers: make new_transp_info_(rtp|gtp) public ...................................................................... Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26722 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I1e369718de8c4c7db1f1af1e6864562164ada6cf Gerrit-Change-Number: 26722 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 10 Jan 2022 10:29:04 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-iuh[master]: iu_helpers: make new_transp_info_(rtp|gtp) public
by dexter 10 Jan '22

10 Jan '22
dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26722 ) Change subject: iu_helpers: make new_transp_info_(rtp|gtp) public ...................................................................... Patch Set 5: (1 comment) https://gerrit.osmocom.org/c/osmo-iuh/+/26722/5/src/iu_helpers.c File src/iu_helpers.c: https://gerrit.osmocom.org/c/osmo-iuh/+/26722/5/src/iu_helpers.c@180 PS5, Line 180: uint8_t binding_id[4] = { 0 }; > why 4 bytes? isn't it a 16bit integer? hence 2 bytes? The field is 32 bit long, even though it stores only a 16 bit port number. -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26722 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I1e369718de8c4c7db1f1af1e6864562164ada6cf Gerrit-Change-Number: 26722 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 10 Jan 2022 10:20:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-e1d[master]: usb: Use libusb_status_str when logging INT EP error
by laforge 10 Jan '22

10 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26821 ) Change subject: usb: Use libusb_status_str when logging INT EP error ...................................................................... usb: Use libusb_status_str when logging INT EP error Change-Id: I3a3cd88ba35796740dbd399eb618617941dae54a --- M src/usb.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/21/26821/1 diff --git a/src/usb.c b/src/usb.c index 7db9994..94cccae 100644 --- a/src/usb.c +++ b/src/usb.c @@ -376,7 +376,8 @@ const struct ice1usb_irq *irq = (const struct ice1usb_irq *) xfer->buffer; if (xfer->status != LIBUSB_TRANSFER_COMPLETED) { - LOGPLI(line, DE1D, LOGL_ERROR, "Error in Interrupt transfer\n"); + LOGPLI(line, DE1D, LOGL_ERROR, "INT EP %02x transfer failed with status %s\n", + xfer->endpoint, get_value_string(libusb_status_str, xfer->status)); goto out; } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26821 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I3a3cd88ba35796740dbd399eb618617941dae54a Gerrit-Change-Number: 26821 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
2 3
0 0
Change in osmo-e1d[master]: usb: Print failed USB isochronous packets
by laforge 10 Jan '22

10 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26819 ) Change subject: usb: Print failed USB isochronous packets ...................................................................... usb: Print failed USB isochronous packets Change-Id: Ib6fcf46be40d47817632ccae4e742d6cf7340cda --- M src/usb.c 1 file changed, 28 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/19/26819/1 diff --git a/src/usb.c b/src/usb.c index d5107bc..2ccb3ac 100644 --- a/src/usb.c +++ b/src/usb.c @@ -173,6 +173,18 @@ // USB flow // --------------------------------------------------------------------------- +/* strings for enum libusb_transfer_status */ +static const struct value_string libusb_status_str[] = { + { LIBUSB_TRANSFER_COMPLETED, "COMPLETED" }, + { LIBUSB_TRANSFER_ERROR, "ERROR" }, + { LIBUSB_TRANSFER_TIMED_OUT, "TIMED_OUT" }, + { LIBUSB_TRANSFER_CANCELLED, "CANCELLED" }, + { LIBUSB_TRANSFER_STALL, "STALL" }, + { LIBUSB_TRANSFER_NO_DEVICE, "NO_DEVICE" }, + { LIBUSB_TRANSFER_OVERFLOW, "OVERFLOW" }, + { 0, NULL } +}; + static void LIBUSB_CALL _e1uf_xfr(struct libusb_transfer *xfr) { @@ -184,18 +196,29 @@ /* FIXME: Check transfer status ? Error handling ? */ + if (flow->ep & 0x80) { for (j=0; j<flow->ppx; j++) { + struct libusb_iso_packet_descriptor *iso_pd = &xfr->iso_packet_desc[j]; + if (iso_pd->status != LIBUSB_TRANSFER_COMPLETED) { + LOGPLI(flow->line, DE1D, LOGL_ERROR, "IN EP %02x ISO packet %d failed with status %s\n", + flow->ep, j, get_value_string(libusb_status_str, iso_pd->status)); + } flow->cb(flow, libusb_get_iso_packet_buffer_simple(xfr, j), - (xfr->iso_packet_desc[j].status == LIBUSB_TRANSFER_COMPLETED) ? - xfr->iso_packet_desc[j].actual_length : -1 + (iso_pd->status == LIBUSB_TRANSFER_COMPLETED) ? iso_pd->actual_length : -1 ); - len += (xfr->iso_packet_desc[j].length = flow->size); + len += (iso_pd->length = flow->size); } } else { - for (j=0; j<flow->ppx; j++) - len += (xfr->iso_packet_desc[j].length = flow->cb(flow, &xfr->buffer[len], flow->size)); + for (j=0; j<flow->ppx; j++) { + struct libusb_iso_packet_descriptor *iso_pd = &xfr->iso_packet_desc[j]; + if (iso_pd->status != LIBUSB_TRANSFER_COMPLETED) { + LOGPLI(flow->line, DE1D, LOGL_ERROR, "OUT EP %02x ISO packet %d failed with status %s\n", + flow->ep, j, get_value_string(libusb_status_str, iso_pd->status)); + } + len += (iso_pd->length = flow->cb(flow, &xfr->buffer[len], flow->size)); + } } libusb_fill_iso_transfer(xfr, id->devh, flow->ep, -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26819 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ib6fcf46be40d47817632ccae4e742d6cf7340cda Gerrit-Change-Number: 26819 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
2 7
0 0
Change in osmo-e1d[master]: cosmetic: Adhere osmocom coding style in for-loops
by laforge 10 Jan '22

10 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26820 ) Change subject: cosmetic: Adhere osmocom coding style in for-loops ...................................................................... cosmetic: Adhere osmocom coding style in for-loops We either have to bring osmo-e1d in line with other osmocom projects, or we'd have to disable the linter in jenkins. Change-Id: I74ab20b22118d471dcdb60d1b9681ab62eb13d51 --- M src/ctl.c M src/intf_line.c M src/mux_demux.c M src/usb.c 4 files changed, 17 insertions(+), 20 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/20/26820/1 diff --git a/src/ctl.c b/src/ctl.c index 4a922b9..7040001 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -278,7 +278,7 @@ if (n == 1) { _e1d_fill_ts_info(ti, &line->ts[hdr->ts]); } else { - for (int i=0; i<32; i++) + for (int i = 0; i < 32; i++) _e1d_fill_ts_info(ti++, &line->ts[i]); } diff --git a/src/intf_line.c b/src/intf_line.c index 5659129..1f833fb 100644 --- a/src/intf_line.c +++ b/src/intf_line.c @@ -192,7 +192,7 @@ line->drv_data = drv_data; line->mode = E1_LINE_MODE_CHANNELIZED; - for (int i=0; i<32; i++) + for (int i = 0; i < 32; i++) _ts_init(&line->ts[i], line, i); _ts_init(&line->superchan, line, E1DP_TS_SUPERCHAN); @@ -228,7 +228,7 @@ osmo_timer_del(&line->watchdog.timer); /* close all [peer] file descriptors */ - for (int i=0; i<32; i++) + for (int i = 0; i < 32; i++) e1_ts_stop(&line->ts[i]); /* remove from per-interface list of lines */ diff --git a/src/mux_demux.c b/src/mux_demux.c index 2971c87..6a7b326 100644 --- a/src/mux_demux.c +++ b/src/mux_demux.c @@ -151,8 +151,7 @@ OSMO_ASSERT(line->mode == E1_LINE_MODE_CHANNELIZED); /* Scan timeslots */ - for (int tsn=1; tsn<32; tsn++) - { + for (int tsn = 1; tsn < 32; tsn++) { struct e1_ts *ts = &line->ts[tsn]; uint8_t buf_ts[fts]; int l; @@ -164,7 +163,7 @@ if (l <= 0) continue; - for (int i=0; i<l; i++) + for (int i = 0; i < l; i++) buf[tsn+(i*32)] = buf_ts[i]; } } @@ -327,15 +326,14 @@ { OSMO_ASSERT(line->mode == E1_LINE_MODE_CHANNELIZED); - for (int tsn=1; tsn<32; tsn++) - { + for (int tsn = 1; tsn < 32; tsn++) { struct e1_ts *ts = &line->ts[tsn]; uint8_t buf_ts[ftr]; if (ts->mode == E1_TS_MODE_OFF) continue; - for (int i=0; i<ftr; i++) + for (int i = 0; i < ftr; i++) buf_ts[i] = buf[tsn+(i*32)]; _e1_ts_write(ts, buf_ts, ftr); diff --git a/src/usb.c b/src/usb.c index c67f5b9..d36ed42 100644 --- a/src/usb.c +++ b/src/usb.c @@ -185,7 +185,7 @@ /* FIXME: Check transfer status ? Error handling ? */ if (flow->ep & 0x80) { - for (j=0; j<flow->ppx; j++) { + for (j = 0; j < flow->ppx; j++) { flow->cb(flow, libusb_get_iso_packet_buffer_simple(xfr, j), (xfr->iso_packet_desc[j].status == LIBUSB_TRANSFER_COMPLETED) ? @@ -194,7 +194,7 @@ len += (xfr->iso_packet_desc[j].length = flow->size); } } else { - for (j=0; j<flow->ppx; j++) + for (j = 0; j < flow->ppx; j++) len += (xfr->iso_packet_desc[j].length = flow->cb(flow, &xfr->buffer[len], flow->size)); } @@ -226,7 +226,7 @@ flow->ppx = ppx; flow->entries = talloc_zero_size(ctx, count * sizeof(struct e1_usb_flow_entry)); - for (int i=0; i<count; i++) + for (int i = 0; i < count; i++) flow->entries[i].buf = talloc_zero_size(ctx, size * ppx); return flow; @@ -239,7 +239,7 @@ return; /* FIXME: stop pending transfers */ - for (int i=0; i<flow->count; i++) + for (int i = 0; i < flow->count; i++) talloc_free(flow->entries[i].buf); talloc_free(flow->entries); @@ -253,8 +253,7 @@ struct libusb_transfer *xfr; int i, j, rv, len; - for (i=0; i<flow->count; i++) - { + for (i = 0; i < flow->count; i++) { xfr = libusb_alloc_transfer(flow->ppx); if (!xfr) return -ENOMEM; @@ -262,10 +261,10 @@ len = 0; if (flow->ep & 0x80) { - for (j=0; j<flow->ppx; j++) + for (j = 0; j < flow->ppx; j++) len += (xfr->iso_packet_desc[j].length = flow->size); } else { - for (j=0; j<flow->ppx; j++) + for (j = 0; j < flow->ppx; j++) len += (xfr->iso_packet_desc[j].length = flow->cb(flow, &flow->entries[i].buf[len], flow->size)); } @@ -529,7 +528,7 @@ return ret; } - for (i=0; i<cd->bNumInterfaces; i++) { + for (i =0; i < cd->bNumInterfaces; i++) { /* Expect 2 altsettings with proper class/subclass/eps */ if (cd->interface[i].num_altsetting != 2) continue; @@ -559,7 +558,7 @@ line_data->r_acc = 0; line_data->r_sw = 8192; - for (j=0; j<id->bNumEndpoints; j++) { + for (j = 0; j < id->bNumEndpoints; j++) { if (id->endpoint[j].bmAttributes == 0x11) { line_data->ep_fb = id->endpoint[j].bEndpointAddress; } else if (id->endpoint[j].bmAttributes == 0x05) { @@ -623,7 +622,7 @@ return -EIO; } - for (i=0; i<n_dev; i++) { + for (i = 0; i < n_dev; i++) { struct libusb_device_descriptor desc; ret = libusb_get_device_descriptor(dev_list[i], &desc); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I74ab20b22118d471dcdb60d1b9681ab62eb13d51 Gerrit-Change-Number: 26820 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
3 5
0 0
  • ← Newer
  • 1
  • ...
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • ...
  • 79
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.