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]: Proper libusb error reporting in all error paths
by pespin 31 Jan '22

31 Jan '22
Attention is currently required from: laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27040 ) Change subject: Proper libusb error reporting in all error paths ...................................................................... Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27040 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Id205f1cf1bbccd83b789f8ab31fe1d5d4e1fb8a9 Gerrit-Change-Number: 27040 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Mon, 31 Jan 2022 19:10:55 +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: pespin. Hello Jenkins Builder, tnt, pespin, 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 (#6). 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, 261 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/16/27016/6 -- 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: 6 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-e1d[master]: e1_{intf,line}_new: Allow caller to specify the numeric identifier
by laforge 31 Jan '22

31 Jan '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27015 ) Change subject: e1_{intf,line}_new: Allow caller to specify the numeric identifier ...................................................................... e1_{intf,line}_new: Allow caller to specify the numeric identifier This will be used by the upcoming VTY interface changes. Change-Id: I9ff80831a3e3e3cb6dae178f8b438a9f3f4747df --- M src/e1d.h M src/intf_line.c M src/usb.c M src/vpair.c 4 files changed, 43 insertions(+), 16 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/e1d.h b/src/e1d.h index a0c8ceb..b76df7a 100644 --- a/src/e1d.h +++ b/src/e1d.h @@ -166,7 +166,7 @@ e1_intf_find_line(struct e1_intf *intf, uint8_t id); struct e1_intf * -e1_intf_new(struct e1_daemon *e1d, void *drv_data); +e1_intf_new(struct e1_daemon *e1d, int intf_id, void *drv_data); struct e1_intf * e1d_find_intf(struct e1_daemon *e1d, uint8_t id); @@ -179,7 +179,7 @@ e1_intf_find_line(struct e1_intf *intf, uint8_t id); struct e1_line * -e1_line_new(struct e1_intf *intf, void *drv_data); +e1_line_new(struct e1_intf *intf, int line_id, void *drv_data); void e1_line_destroy(struct e1_line *line); diff --git a/src/intf_line.c b/src/intf_line.c index 1f833fb..cb3f277 100644 --- a/src/intf_line.c +++ b/src/intf_line.c @@ -107,11 +107,21 @@ return NULL; } +/* intf_id can be specified as '-1' to mean "auto-allocate intf->id" */ struct e1_intf * -e1_intf_new(struct e1_daemon *e1d, void *drv_data) +e1_intf_new(struct e1_daemon *e1d, int intf_id, void *drv_data) { struct e1_intf *intf; + if (intf_id != -1) { + /* ensure non-duplicate interface number */ + intf = e1d_find_intf(e1d, intf_id); + if (intf) { + LOGPIF(intf, DE1D, LOGL_ERROR, "Cannot create duplicate interface %d\n", intf_id); + return NULL; + } + } + intf = talloc_zero(e1d->ctx, struct e1_intf); OSMO_ASSERT(intf); @@ -121,10 +131,14 @@ INIT_LLIST_HEAD(&intf->list); INIT_LLIST_HEAD(&intf->lines); - if (!llist_empty(&e1d->interfaces)) { - struct e1_intf *f = llist_last_entry(&e1d->interfaces, struct e1_intf, list); - intf->id = f->id + 1; - } + if (intf_id == -1) { + if (!llist_empty(&e1d->interfaces)) { + struct e1_intf *f = llist_last_entry(&e1d->interfaces, struct e1_intf, list); + intf->id = f->id + 1; + } else + intf->id = 0; + } else + intf->id = intf_id; llist_add_tail(&intf->list, &e1d->interfaces); @@ -180,11 +194,20 @@ ts->fd = -1; } +/* line_id can be specified as '-1' to mean "auto-allocate intf->id" */ struct e1_line * -e1_line_new(struct e1_intf *intf, void *drv_data) +e1_line_new(struct e1_intf *intf, int line_id, void *drv_data) { struct e1_line *line; + if (line_id != -1) { + line = e1_intf_find_line(intf, line_id); + if (line) { + LOGPLI(line, DE1D, LOGL_ERROR, "Cannot create duplicate line %d\n", line_id); + return NULL; + } + } + line = talloc_zero(intf->e1d->ctx, struct e1_line); OSMO_ASSERT(line); @@ -198,10 +221,14 @@ INIT_LLIST_HEAD(&line->list); - if (!llist_empty(&intf->lines)) { - struct e1_line *l = llist_last_entry(&intf->lines, struct e1_line, list); - line->id = l->id + 1; - } + if (line_id == -1) { + if (!llist_empty(&intf->lines)) { + struct e1_line *l = llist_last_entry(&intf->lines, struct e1_line, list); + line->id = l->id + 1; + } else + line->id = 0; + } else + line->id = line_id; line->ctrs = rate_ctr_group_alloc(line, &line_ctrg_desc, line->id); OSMO_ASSERT(line->ctrs); diff --git a/src/usb.c b/src/usb.c index 0c0afe4..0100c31 100644 --- a/src/usb.c +++ b/src/usb.c @@ -543,7 +543,7 @@ intf_data = talloc_zero(e1d->ctx, struct e1_usb_intf_data); intf_data->devh = devh; - intf = e1_intf_new(e1d, intf_data); + intf = e1_intf_new(e1d, -1, intf_data); intf->drv = E1_DRIVER_USB; ret = libusb_get_active_config_descriptor(dev, &cd); @@ -608,7 +608,7 @@ return -EINVAL; } - line = e1_line_new(intf, line_data); + line = e1_line_new(intf, -1, line_data); line_data->flow_in = e1uf_create(line, e1_usb_xfer_in, line_data->ep_in, 4, line_data->pkt_size, 4); line_data->flow_out = e1uf_create(line, e1_usb_xfer_out, line_data->ep_out, 4, line_data->pkt_size, 4); diff --git a/src/vpair.c b/src/vpair.c index 8484be0..524f998 100644 --- a/src/vpair.c +++ b/src/vpair.c @@ -67,14 +67,14 @@ intf_data = talloc_zero(e1d->ctx, struct ve1_intf_data); - intf = e1_intf_new(e1d, intf_data); + intf = e1_intf_new(e1d, -1, intf_data); intf->drv = E1_DRIVER_VPAIR; for (i = 0; i < num_lines; i++) { struct ve1_line_data *line_data; line_data = talloc_zero(e1d->ctx, struct ve1_line_data); - e1_line_new(intf, line_data); + e1_line_new(intf, -1, line_data); } return intf; -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27015 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I9ff80831a3e3e3cb6dae178f8b438a9f3f4747df Gerrit-Change-Number: 27015 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
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: pespin. 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 5: Code-Review+2 (6 comments) Commit Message: https://gerrit.osmocom.org/c/osmo-e1d/+/27016/comment/2664896b_f0f5a20e PS3, Line 15: those E1 lines with VTY configuration opened. > are opened / will be opened. no, I'm using past tense here. "so far, osmo-e1d automatically opened..." but now it is changing. I could als have written "used to open". File src/e1d.h: https://gerrit.osmocom.org/c/osmo-e1d/+/27016/comment/f2f15123_3918d340 PS3, Line 181: e1d_find_intf_by_serial(struct e1_daemon *e1d, const char *serial_str); > by_usb_serial? Ack File src/usb.c: https://gerrit.osmocom.org/c/osmo-e1d/+/27016/comment/acb8c8ba_4226b626 PS3, Line 561: /* try to find the matching interface config in the */ > in the what? Ack https://gerrit.osmocom.org/c/osmo-e1d/+/27016/comment/775c58d6_6a866782 PS3, Line 564: LOGP(DE1D, LOGL_INFO, "configuration for icE1usb serial '%s' found\n", serial_str); > start with caps Ack https://gerrit.osmocom.org/c/osmo-e1d/+/27016/comment/e86a9e3b_54ee9f7c PS3, Line 567: LOGP(DE1D, LOGL_ERROR, "new device with serial '%s', but E1 interface %u busy\n", > start with caps Ack https://gerrit.osmocom.org/c/osmo-e1d/+/27016/comment/e75ec9c0_6228a234 PS3, Line 576: LOGP(DE1D, LOGL_NOTICE, "no configuration for icE1usb serial '%s' found, " > start with caps Ack -- 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: 5 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 31 Jan 2022 18:56:08 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-e1d[master]: e1_{intf,line}_new: Allow caller to specify the numeric identifier
by laforge 31 Jan '22

31 Jan '22
Attention is currently required from: pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27015 ) Change subject: e1_{intf,line}_new: Allow caller to specify the numeric identifier ...................................................................... Patch Set 3: Code-Review+2 (2 comments) File src/intf_line.c: https://gerrit.osmocom.org/c/osmo-e1d/+/27015/comment/a5a508b7_87c86837 PS1, Line 119: return NULL; > probably some error message here would be informative. Ack https://gerrit.osmocom.org/c/osmo-e1d/+/27015/comment/8597401e_077f46b5 PS1, Line 202: return NULL; > same Ack -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27015 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I9ff80831a3e3e3cb6dae178f8b438a9f3f4747df Gerrit-Change-Number: 27015 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 31 Jan 2022 18:56:01 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-e1d[master]: e1_{intf,line}_new: Allow caller to specify the numeric identifier
by laforge 31 Jan '22

31 Jan '22
Attention is currently required from: laforge. Hello Jenkins Builder, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-e1d/+/27015 to look at the new patch set (#3). Change subject: e1_{intf,line}_new: Allow caller to specify the numeric identifier ...................................................................... e1_{intf,line}_new: Allow caller to specify the numeric identifier This will be used by the upcoming VTY interface changes. Change-Id: I9ff80831a3e3e3cb6dae178f8b438a9f3f4747df --- M src/e1d.h M src/intf_line.c M src/usb.c M src/vpair.c 4 files changed, 43 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/15/27015/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27015 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I9ff80831a3e3e3cb6dae178f8b438a9f3f4747df Gerrit-Change-Number: 27015 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newpatchset
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, pespin, 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 (#5). 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/5 -- 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: 5 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-iuh[master]: ranap_common_ran: add decoder for CN/MSC originated messages
by laforge 31 Jan '22

31 Jan '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26955 ) Change subject: ranap_common_ran: add decoder for CN/MSC originated messages ...................................................................... ranap_common_ran: add decoder for CN/MSC originated messages Lets add a counterpart for ranap_common_cn that works the same, but decodes CN/MSC originated messages. Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 Related: OS#5152 --- M include/osmocom/ranap/Makefile.am M include/osmocom/ranap/ranap_common.h M include/osmocom/ranap/ranap_common_cn.h A include/osmocom/ranap/ranap_common_ran.h M src/Makefile.am A src/ranap_common_ran.c 6 files changed, 204 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved laforge: Looks good to me, approved diff --git a/include/osmocom/ranap/Makefile.am b/include/osmocom/ranap/Makefile.am index 1606928..2662484 100644 --- a/include/osmocom/ranap/Makefile.am +++ b/include/osmocom/ranap/Makefile.am @@ -10,6 +10,7 @@ ranap_ies_defs.h \ ranap_common.h \ ranap_common_cn.h \ + ranap_common_ran.h \ ranap_msg_factory.h \ iu_helpers.h \ iu_client.h \ diff --git a/include/osmocom/ranap/ranap_common.h b/include/osmocom/ranap/ranap_common.h index 0343a57..7511a75 100644 --- a/include/osmocom/ranap/ranap_common.h +++ b/include/osmocom/ranap/ranap_common.h @@ -596,6 +596,9 @@ extern int _ranap_DRANAP; #define RANAP_DEBUG(x, args ...) DEBUGP(_ranap_DRANAP, x, ## args) +/* Callback to be used with decoder functions in ranap_common_cn.c ranap_common_ran.c */ +typedef void (*ranap_handle_cb)(void *ctx, ranap_message *ranap_msg); + extern int asn1_xer_print; extern const struct value_string ranap_presence_vals[5]; diff --git a/include/osmocom/ranap/ranap_common_cn.h b/include/osmocom/ranap/ranap_common_cn.h index 90ff6da..fb65049 100644 --- a/include/osmocom/ranap/ranap_common_cn.h +++ b/include/osmocom/ranap/ranap_common_cn.h @@ -5,8 +5,6 @@ #include <osmocom/ranap/ranap_common.h> #include <osmocom/ranap/ranap_ies_defs.h> -typedef void (*ranap_handle_cb)(void *ctx, ranap_message *ranap_msg); - /* free a decoded connection-less RANAP message */ void ranap_cn_rx_cl_free(ranap_message *message); diff --git a/include/osmocom/ranap/ranap_common_ran.h b/include/osmocom/ranap/ranap_common_ran.h new file mode 100644 index 0000000..5eef272 --- /dev/null +++ b/include/osmocom/ranap/ranap_common_ran.h @@ -0,0 +1,15 @@ +#pragma once + +#include <stdint.h> + +#include <osmocom/ranap/ranap_common.h> +#include <osmocom/ranap/ranap_ies_defs.h> + +/* free a decoded connection-oriented RANAP message */ +void ranap_ran_rx_co_free(ranap_message *message); + +/* decode a connection-oriented RANAP message */ +int ranap_ran_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len); + +/* receive a connection-oriented RANAP message */ +int ranap_ran_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len); diff --git a/src/Makefile.am b/src/Makefile.am index 6c10564..0407fa3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -75,7 +75,7 @@ libosmo_ranap_la_LIBADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOVTY_LIBS) $(OSMOSIGTRAN_LIBS) \ $(ASN1C_LIBS) ranap/libosmo-asn1-ranap.la libosmo_ranap_la_SOURCES = ranap_common.c ranap_encoder.c ranap_decoder.c ranap_msg_factory.c iu_helpers.c \ - ranap_common_cn.c iu_client.c iu_client_vty.c + ranap_common_cn.c ranap_common_ran.c iu_client.c iu_client_vty.c libosmo_rua_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(HNBAP_LIBVERSION) libosmo_rua_la_LIBADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOVTY_LIBS) $(OSMOSIGTRAN_LIBS) \ diff --git a/src/ranap_common_ran.c b/src/ranap_common_ran.c new file mode 100644 index 0000000..f3fa519 --- /dev/null +++ b/src/ranap_common_ran.c @@ -0,0 +1,184 @@ +/* RANAP interface for a ran-network node */ + +/* (C) 2021 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * Author: Philipp Maier + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <unistd.h> +#include <errno.h> +#include <string.h> + +#include <osmocom/core/utils.h> +#include <osmocom/core/logging.h> + +#include <osmocom/ranap/ranap_common.h> +#include <osmocom/ranap/ranap_common_ran.h> +#include <osmocom/ranap/ranap_ies_defs.h> + +#define DRANAP _ranap_DRANAP + +static int ran_ranap_rx_initiating_msg_co(void *ctx, RANAP_InitiatingMessage_t *imsg, ranap_message *message) +{ + int rc = 0; + + message->procedureCode = imsg->procedureCode; + message->criticality = imsg->criticality; + + DEBUGP(DRANAP, "Rx CO IM (%s)\n", get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); + + switch (imsg->procedureCode) { + case RANAP_ProcedureCode_id_RAB_Assignment: + rc = ranap_decode_rab_assignmentrequesties(&message->msg.raB_AssignmentRequestIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_Iu_Release: + rc = ranap_decode_iu_releasecommandies(&message->msg.iu_ReleaseCommandIEs, &imsg->value); + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP Procedure %s (CO, IM) from CN, ignoring\n", + get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); + rc = -1; + break; + } + + return rc; +} + +static void ran_ranap_free_initiating_msg_co(ranap_message *message) +{ + switch (message->procedureCode) { + case RANAP_ProcedureCode_id_RAB_Assignment: + ranap_free_rab_assignmentrequesties(&message->msg.raB_AssignmentRequestIEs); + break; + case RANAP_ProcedureCode_id_Iu_Release: + ranap_free_iu_releasecommandies(&message->msg.iu_ReleaseCommandIEs); + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Not freeing suspicious RANAP " + "Procedure %s (CO, IM) from CN\n", + get_value_string(ranap_procedure_code_vals, message->procedureCode)); + break; + } +} + +static int _ran_ranap_rx_co(void *ctx, RANAP_RANAP_PDU_t *pdu, ranap_message *message) +{ + int rc = 0; + + switch (pdu->present) { + case RANAP_RANAP_PDU_PR_initiatingMessage: + rc = ran_ranap_rx_initiating_msg_co(ctx, &pdu->choice.initiatingMessage, message); + break; + case RANAP_RANAP_PDU_PR_successfulOutcome: + LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " + "successful outcome procedure %s (CO) from CN, ignoring\n", + get_value_string(ranap_procedure_code_vals, pdu->choice.successfulOutcome.procedureCode)); + rc = -1; + break; + case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: + LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " + "unsuccessful outcome procedure %s (CO) from CN, ignoring\n", + get_value_string(ranap_procedure_code_vals, pdu->choice.unsuccessfulOutcome.procedureCode)); + rc = -1; + break; + case RANAP_RANAP_PDU_PR_outcome: + LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " + "outcome procedure %s (CO) from CN, ignoring\n", + get_value_string(ranap_procedure_code_vals, pdu->choice.outcome.procedureCode)); + rc = -1; + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " + "presence %s (CO) from CN, ignoring\n", get_value_string(ranap_presence_vals, pdu->present)); + rc = -1; + break; + } + + return rc; +} + +/* free a decoded connection-oriented RANAP message */ +void ranap_ran_rx_co_free(ranap_message *message) +{ + switch (message->direction) { + case RANAP_RANAP_PDU_PR_initiatingMessage: + ran_ranap_free_initiating_msg_co(message); + break; + case RANAP_RANAP_PDU_PR_successfulOutcome: + LOGP(DRANAP, LOGL_NOTICE, "Not freeing unsupported RANAP " + "successful outcome procedure (CO) from CN\n"); + break; + case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: + LOGP(DRANAP, LOGL_NOTICE, "Not freeing unsupported RANAP " + "unsuccessful outcome procedure (CO) from CN\n"); + break; + case RANAP_RANAP_PDU_PR_outcome: + LOGP(DRANAP, LOGL_NOTICE, "Not freeing unsupported RANAP " + "outcome procedure (CO) from CN\n"); + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " + "presence %s (CO) from CN, ignoring\n", + get_value_string(ranap_presence_vals, message->direction)); + break; + } +} + +/* decode a connection-oriented RANAP message */ +int ranap_ran_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len) +{ + RANAP_RANAP_PDU_t *pdu = NULL; + asn_dec_rval_t dec_ret; + int rc; + + memset(message, 0, sizeof(*message)); + + dec_ret = aper_decode(NULL, &asn_DEF_RANAP_RANAP_PDU, (void **)&pdu, data, len, 0, 0); + if (dec_ret.code != RC_OK) { + LOGP(DRANAP, LOGL_ERROR, "Error in RANAP ASN.1 decode\n"); + return -1; + } + + message->direction = pdu->present; + + rc = _ran_ranap_rx_co(ctx, pdu, message); + + ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + + return rc; +} + +/* receive a connection-oriented RANAP message and call + * cn_ranap_handle_co() with the resulting ranap_message struct */ +int ranap_ran_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +{ + ranap_message message; + int rc; + + rc = ranap_ran_rx_co_decode(ctx, &message, data, len); + + if (rc == 0) + (*cb) (ctx, &message); + else + LOGP(DRANAP, LOGL_ERROR, "Not calling ran_ranap_handle_co() due to rc=%d\n", rc); + + /* Free the asn1 structs in message */ + ranap_ran_rx_co_free(&message); + + return rc; +} -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 Gerrit-Change-Number: 26955 Gerrit-PatchSet: 6 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-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: daniel <dwillmann(a)sysmocom.de> Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-iuh[master]: ranap_common_cn: add functions for direct access to decoder
by laforge 31 Jan '22

31 Jan '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/27002 ) Change subject: ranap_common_cn: add functions for direct access to decoder ...................................................................... ranap_common_cn: add functions for direct access to decoder The message encoder functions that decode a message to a struct ranap_message are only accessible via a callback function that is passed to ranap_cn_rx_cx The decoded ranap_message only lives inside the callback since it is freed by ranap_cn_rx_cx when the callback is done. In some situations this might make using the decoder incredibly difficult since it is not possible to keep the decoding results for an extended amount of time. Lets put the decoding into a separate function and use this function in ranap_cn_rx_cx. Then lets make the decoder and the free function public so that the decoder can be used in a more open way. Change-Id: I14d2ed8e597a5d12024a6a6c72ff011dbeb2549d Related: OS#5152 --- M include/osmocom/ranap/ranap_common_cn.h M src/ranap_common_cn.c 2 files changed, 58 insertions(+), 26 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved laforge: Looks good to me, approved diff --git a/include/osmocom/ranap/ranap_common_cn.h b/include/osmocom/ranap/ranap_common_cn.h index dfce358..90ff6da 100644 --- a/include/osmocom/ranap/ranap_common_cn.h +++ b/include/osmocom/ranap/ranap_common_cn.h @@ -7,8 +7,20 @@ typedef void (*ranap_handle_cb)(void *ctx, ranap_message *ranap_msg); +/* free a decoded connection-less RANAP message */ +void ranap_cn_rx_cl_free(ranap_message *message); + +/* decode a connection-less RANAP message */ +int ranap_cn_rx_cl_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len); + /* receive a connection-less RANAP message */ int ranap_cn_rx_cl(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len); +/* free a decoded connection-oriented RANAP message */ +void ranap_cn_rx_co_free(ranap_message *message); + +/* decode a connection-oriented RANAP message */ +int ranap_cn_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len); + /* receive a connection-oriented RANAP message */ int ranap_cn_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len); diff --git a/src/ranap_common_cn.c b/src/ranap_common_cn.c index 03ce9ea..e7b8339 100644 --- a/src/ranap_common_cn.c +++ b/src/ranap_common_cn.c @@ -257,7 +257,8 @@ return rc; } -static void _cn_ranap_free_co(ranap_message *message) +/* free a decoded connection-oriented RANAP message */ +void ranap_cn_rx_co_free(ranap_message *message) { switch (message->direction) { case RANAP_RANAP_PDU_PR_initiatingMessage: @@ -281,27 +282,38 @@ } } -/* receive a connection-oriented RANAP message and call - * cn_ranap_handle_co() with the resulting ranap_message struct */ -int ranap_cn_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +/* decode a connection-oriented RANAP message */ +int ranap_cn_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len) { RANAP_RANAP_PDU_t *pdu = NULL; - ranap_message message; asn_dec_rval_t dec_ret; int rc; - memset(&message, 0, sizeof(message)); + memset(message, 0, sizeof(*message)); - dec_ret = aper_decode(NULL,&asn_DEF_RANAP_RANAP_PDU, (void **) &pdu, - data, len, 0, 0); + dec_ret = aper_decode(NULL, &asn_DEF_RANAP_RANAP_PDU, (void **)&pdu, data, len, 0, 0); if (dec_ret.code != RC_OK) { LOGP(DRANAP, LOGL_ERROR, "Error in RANAP ASN.1 decode\n"); return -1; } - message.direction = pdu->present; + message->direction = pdu->present; - rc = _cn_ranap_rx_co(ctx, pdu, &message); + rc = _cn_ranap_rx_co(ctx, pdu, message); + + ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + + return rc; +} + +/* receive a connection-oriented RANAP message and call + * cn_ranap_handle_co() with the resulting ranap_message struct */ +int ranap_cn_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +{ + ranap_message message; + int rc; + + rc = ranap_cn_rx_co_decode(ctx, &message, data, len); if (rc == 0) (*cb)(ctx, &message); @@ -309,9 +321,7 @@ LOGP(DRANAP, LOGL_ERROR, "Not calling cn_ranap_handle_co() due to rc=%d\n", rc); /* Free the asn1 structs in message */ - _cn_ranap_free_co(&message); - - ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + ranap_cn_rx_co_free(&message); return rc; } @@ -496,7 +506,8 @@ return rc; } -static void _cn_ranap_free_cl(ranap_message *message) +/* free a decoded connection-less RANAP message */ +void ranap_cn_rx_cl_free(ranap_message *message) { switch (message->direction) { case RANAP_RANAP_PDU_PR_initiatingMessage: @@ -516,27 +527,38 @@ } } -/* receive a connection-less RANAP message and call - * cn_ranap_handle_co() with the resulting ranap_message struct */ -int ranap_cn_rx_cl(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +/* decode a connection-less RANAP message */ +int ranap_cn_rx_cl_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len) { RANAP_RANAP_PDU_t *pdu = NULL; - ranap_message message; asn_dec_rval_t dec_ret; int rc; - memset(&message, 0, sizeof(message)); + memset(message, 0, sizeof(*message)); - dec_ret = aper_decode(NULL,&asn_DEF_RANAP_RANAP_PDU, (void **) &pdu, - data, len, 0, 0); + dec_ret = aper_decode(NULL, &asn_DEF_RANAP_RANAP_PDU, (void **)&pdu, data, len, 0, 0); if (dec_ret.code != RC_OK) { LOGP(DRANAP, LOGL_ERROR, "Error in RANAP ASN.1 decode\n"); return -1; } - message.direction = pdu->present; + message->direction = pdu->present; - rc = _cn_ranap_rx_cl(ctx, pdu, &message); + rc = _cn_ranap_rx_cl(ctx, pdu, message); + + ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + + return rc; +} + +/* receive a connection-less RANAP message and call + * cn_ranap_handle_co() with the resulting ranap_message struct */ +int ranap_cn_rx_cl(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +{ + ranap_message message; + int rc; + + rc = ranap_cn_rx_cl_decode(ctx, &message, data, len); if (rc == 0) (*cb)(ctx, &message); @@ -544,9 +566,7 @@ LOGP(DRANAP, LOGL_ERROR, "Not calling cn_ranap_handle_cl() due to rc=%d\n", rc); /* Free the asn1 structs in message */ - _cn_ranap_free_cl(&message); - - ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + ranap_cn_rx_cl_free(&message); return rc; } -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/27002 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I14d2ed8e597a5d12024a6a6c72ff011dbeb2549d Gerrit-Change-Number: 27002 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-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-iuh[master]: ranap_common_cn: add functions for direct access to decoder
by laforge 31 Jan '22

31 Jan '22
Attention is currently required from: neels, daniel, dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/27002 ) Change subject: ranap_common_cn: add functions for direct access to decoder ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/27002 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I14d2ed8e597a5d12024a6a6c72ff011dbeb2549d Gerrit-Change-Number: 27002 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-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Mon, 31 Jan 2022 18:46:50 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • ...
  • 79
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.