Projects
osmocom:nightly
osmo-cbc
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 26
View file
osmo-cbc.spec
Changed
@@ -17,14 +17,14 @@ %define _lto_cflags %{nil} Name: osmo-cbc -Requires: osmocom-nightly = 1.0.0.202207220002 -Version: 0.3.0.42.85bc.202207220002 +Requires: osmocom-nightly = 1.0.0.202207230002 +Version: 0.3.0.50.5661.202207230002 Release: 0 Summary: OsmoCBC: Osmocom's Cell Broadcast Centre for 3GPP mobile networks License: AGPL-3.0-or-later Group: Hardware/Mobile URL: https://osmocom.org/projects/osmo-cbc -Source: osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz +Source: osmo-cbc_0.3.0.50.5661.202207230002.tar.gz BuildRequires: automake >= 1.9 BuildRequires: libtool >= 2 BuildRequires: pkgconfig >= 0.20 @@ -44,7 +44,7 @@ OsmoCBC: Osmocom's Cell Broadcast Centre for 3GPP mobile networks. %package utils -Requires: osmocom-nightly = 1.0.0.202207220002 +Requires: osmocom-nightly = 1.0.0.202207230002 Summary: CLI utility to interface osmo-cbc REST interface License: MIT Group: Productivity/Telephony/Utilities @@ -53,7 +53,7 @@ CLI utility to interface with the osmo-cbc REST interface (ECBE). %package -n libosmo-sbcap0 -Requires: osmocom-nightly = 1.0.0.202207220002 +Requires: osmocom-nightly = 1.0.0.202207230002 Summary: Osmocom's library to encode/decode SBc-AP messages Group: System/Libraries @@ -61,7 +61,7 @@ Osmocom's library to encode/decode SBc-AP messages. %package -n libosmo-sbcap-devel -Requires: osmocom-nightly = 1.0.0.202207220002 +Requires: osmocom-nightly = 1.0.0.202207230002 Summary: Development files for libosmo-sbcap Group: Development/Libraries/C and C++ Requires: libosmo-sbcap0 = %{version}
View file
osmo-cbc_0.3.0.42.85bc.202207220002.dsc -> osmo-cbc_0.3.0.50.5661.202207230002.dsc
Changed
@@ -2,7 +2,7 @@ Source: osmo-cbc Binary: osmo-cbc, osmo-cbc-utils, osmo-cbc-dbg, osmo-cbc-doc, libosmo-sbcap0, libosmo-sbcap-dev Architecture: any all -Version: 0.3.0.42.85bc.202207220002 +Version: 0.3.0.50.5661.202207230002 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://projects.osmocom.org/projects/osmo-cbc Standards-Version: 3.9.8 @@ -17,8 +17,8 @@ osmo-cbc-doc deb doc optional arch=all osmo-cbc-utils deb net extra arch=any Checksums-Sha1: - 58bad6e4f17563e997bbb023c1d6e854774312eb 248751 osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz + a7f59449024690a405531148e98936e03c84ea08 249497 osmo-cbc_0.3.0.50.5661.202207230002.tar.gz Checksums-Sha256: - 193a9fd3f9d60fd2c5bf74d6309f76d6d19a54b712bb5afc350e6cd36df18c4e 248751 osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz + 35209b7305a6d1d76c23403db2e55995eb15ab9f6b59c5aa0476af5ff245dda5 249497 osmo-cbc_0.3.0.50.5661.202207230002.tar.gz Files: - f6e755b0b678b53b454d415afaca8bd3 248751 osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz + 35ae87a517ad7b84dda08aba077b2fff 249497 osmo-cbc_0.3.0.50.5661.202207230002.tar.gz
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/.tarball-version -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/.tarball-version
Changed
@@ -1 +1 @@ -0.3.0.42-85bc \ No newline at end of file +0.3.0.50-5661 \ No newline at end of file
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/debian/changelog -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -osmo-cbc (0.3.0.42.85bc.202207220002) UNRELEASED; urgency=medium +osmo-cbc (0.3.0.50.5661.202207230002) UNRELEASED; urgency=medium * Snapshot build - -- Pau Espin Pedrol <pespin@sysmocom.de> Fri, 22 Jul 2022 00:09:41 +0000 + -- Pau Espin Pedrol <pespin@sysmocom.de> Sat, 23 Jul 2022 00:09:59 +0000 osmo-cbc (0.3.0) unstable; urgency=medium
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/debian/control -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/debian/control
Changed
@@ -25,27 +25,27 @@ Package: osmo-cbc Architecture: any Multi-Arch: foreign -Depends: osmocom-nightly (= 1.0.0.202207220002), ${misc:Depends}, ${shlibs:Depends} +Depends: osmocom-nightly (= 1.0.0.202207230002), ${misc:Depends}, ${shlibs:Depends} Description: OsmoCBC: Osmocom's Cell Broadcast Center Package: osmo-cbc-utils Architecture: any Multi-Arch: foreign -Depends: osmocom-nightly (= 1.0.0.202207220002), ${misc:Depends}, ${shlibs:Depends}, python3 +Depends: osmocom-nightly (= 1.0.0.202207230002), ${misc:Depends}, ${shlibs:Depends}, python3 Description: Utilities for OsmoCBC: Osmocom's Cell Broadcast Center Package: osmo-cbc-dbg Section: debug Architecture: any Multi-Arch: same -Depends: osmocom-nightly (= 1.0.0.202207220002), osmo-cbc (= ${binary:Version}), ${misc:Depends} +Depends: osmocom-nightly (= 1.0.0.202207230002), osmo-cbc (= ${binary:Version}), ${misc:Depends} Description: OsmoCBC: Osmocom's Cell Broadcast Center Package: osmo-cbc-doc Architecture: all Section: doc Priority: optional -Depends: osmocom-nightly (= 1.0.0.202207220002), ${misc:Depends} +Depends: osmocom-nightly (= 1.0.0.202207230002), ${misc:Depends} Description: ${misc:Package} PDF documentation Various manuals: user manual, VTY reference manual and/or protocol/interface manuals. @@ -55,12 +55,12 @@ Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} -Depends: osmocom-nightly (= 1.0.0.202207220002), ${misc:Depends}, ${shlibs:Depends} +Depends: osmocom-nightly (= 1.0.0.202207230002), ${misc:Depends}, ${shlibs:Depends} Description: libosmo-sbcap: Osmocom's library to encode/decode SBc-AP messages Package: libosmo-sbcap-dev Section: libdevel Architecture: any Multi-Arch: same -Depends: osmocom-nightly (= 1.0.0.202207220002), libosmo-sbcap0 (= ${binary:Version}), ${misc:Depends} +Depends: osmocom-nightly (= 1.0.0.202207230002), libosmo-sbcap0 (= ${binary:Version}), ${misc:Depends} Description: libosmo-sbcap: Osmocom's library to encode/decode SBc-AP messages
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/doc/examples/osmo-cbc/osmo-cbc.cfg -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/doc/examples/osmo-cbc/osmo-cbc.cfg
Changed
@@ -1,4 +1,5 @@ log stderr + logging level main notice logging level rest notice logging level cbsp notice logging level sbcap notice @@ -14,12 +15,10 @@ local-ip 127.0.0.1 local-ip ::1 local-port 29168 - peer example-bsc - protocol cbsp + peer cbsp example-bsc remote-ip 127.0.0.2 remote-port 48049 - peer example-mme - protocol sbcap + peer sbcap example-mme remote-ip 127.0.0.2 remote-ip ::2 remote-port 29168
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/include/osmocom/cbc/cbc_data.h -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/include/osmocom/cbc/cbc_data.h
Changed
@@ -42,6 +42,8 @@ /********************************************************************************* * CBC itself *********************************************************************************/ +struct cbc_cbsp_mgr; +struct cbc_sbcap_mgr; struct cbc { struct { @@ -61,6 +63,13 @@ } ecbe; } config; + struct { + struct cbc_cbsp_mgr *mgr; + } cbsp; + struct { + struct cbc_sbcap_mgr *mgr; + } sbcap; + struct llist_head messages; /* cbc_message.list */ struct llist_head expired_messages; /* cbc_message.list */ struct llist_head peers; /* cbc_peer.list */ @@ -70,6 +79,8 @@ }; extern struct cbc *g_cbc; +struct cbc *cbc_alloc(void *ctx); +int cbc_start(struct cbc *cbc); /* rest_api.c */ int rest_api_init(void *ctx, const char *bind_addr, uint16_t port);
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/include/osmocom/cbc/cbsp_link.h -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/include/osmocom/cbc/cbsp_link.h
Changed
@@ -40,6 +40,8 @@ struct cbc_peer *peer; }; +struct cbc_cbsp_link *cbc_cbsp_link_alloc(struct cbc_cbsp_mgr *cbc, struct cbc_peer *peer); +void cbc_cbsp_link_free(struct cbc_cbsp_link *link); const char *cbc_cbsp_link_name(const struct cbc_cbsp_link *link); void cbc_cbsp_link_tx(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *cbsp); void cbc_cbsp_link_close(struct cbc_cbsp_link *link);
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/include/osmocom/cbc/debug.h -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/include/osmocom/cbc/debug.h
Changed
@@ -1,6 +1,7 @@ #pragma once enum { + DMAIN, DCBSP, DSBcAP, DREST,
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/include/osmocom/cbc/sbcap_link.h -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/include/osmocom/cbc/sbcap_link.h
Changed
@@ -38,6 +38,8 @@ struct cbc_peer *peer; }; +struct cbc_sbcap_link *cbc_sbcap_link_alloc(struct cbc_sbcap_mgr *cbc, struct cbc_peer *peer); +void cbc_sbcap_link_free(struct cbc_sbcap_link *link); const char *cbc_sbcap_link_name(const struct cbc_sbcap_link *link); void cbc_sbcap_link_tx(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu); void cbc_sbcap_link_close(struct cbc_sbcap_link *link);
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/src/Makefile.am -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/Makefile.am
Changed
@@ -10,6 +10,7 @@ bin_PROGRAMS = osmo-cbc osmo_cbc_SOURCES = \ + cbc_data.c \ cbc_main.c \ cbc_message.c \ cbc_peer.c \
View file
osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/cbc_data.c
Added
@@ -0,0 +1,83 @@ +/* Osmocom CBC (Cell Broacast Centre) */ + +/* (C) 2022 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> + * All Rights Reserved + * Author: Pau Espin Pedrol <pespin@sysmocom.de> + * + * SPDX-License-Identifier: AGPL-3.0+ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + + +#include <string.h> +#include <errno.h> + +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/talloc.h> +#include <osmocom/core/utils.h> + +#include <osmocom/cbc/cbc_data.h> +#include <osmocom/cbc/cbsp_link.h> +#include <osmocom/cbc/sbcap_link.h> +#include <osmocom/cbc/rest_it_op.h> +#include <osmocom/cbc/debug.h> + +struct cbc *cbc_alloc(void *ctx) +{ + struct cbc *cbc; + + cbc = talloc_zero(ctx, struct cbc); + INIT_LLIST_HEAD(&cbc->peers); + INIT_LLIST_HEAD(&cbc->messages); + INIT_LLIST_HEAD(&cbc->expired_messages); + cbc->config.cbsp.local_host = talloc_strdup(cbc, "127.0.0.1"); + cbc->config.cbsp.local_port = CBSP_TCP_PORT; + /* cbc->config.sbcap local_host set up during VTY (and vty_go_parent) */ + cbc->config.sbcap.local_port = SBcAP_SCTP_PORT; + cbc->config.ecbe.local_host = talloc_strdup(cbc, "127.0.0.1"); + cbc->config.ecbe.local_port = 12345; + + cbc->it_q.rest2main = osmo_it_q_alloc(cbc, "rest2main", 10, rest2main_read_cb, NULL); + OSMO_ASSERT(cbc->it_q.rest2main); + osmo_fd_register(&cbc->it_q.rest2main->event_ofd); + + return cbc; +} + +int cbc_start(struct cbc *cbc) +{ + void *tall_rest_ctx; + int rc; + + tall_rest_ctx = talloc_named_const(cbc, 0, "REST"); + + if (!(cbc->cbsp.mgr = cbc_cbsp_mgr_create(cbc))) { + LOGP(DMAIN, LOGL_ERROR, "Error binding CBSP port\n"); + return -EIO; + } + + if (!(cbc->sbcap.mgr = cbc_sbcap_mgr_create(cbc))) { + LOGP(DMAIN, LOGL_ERROR, "Error binding SBc-AP port\n"); + return -EIO; + } + + rc = rest_api_init(tall_rest_ctx, cbc->config.ecbe.local_host, cbc->config.ecbe.local_port); + if (rc < 0) { + LOGP(DMAIN, LOGL_ERROR, "Error binding ECBE port\n"); + return -EIO; + } + return 0; +}
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/src/cbc_main.c -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/cbc_main.c
Changed
@@ -45,9 +45,6 @@ #include <osmocom/vty/misc.h> #include <osmocom/cbc/debug.h> -#include <osmocom/cbc/rest_it_op.h> -#include <osmocom/cbc/cbsp_link.h> -#include <osmocom/cbc/sbcap_link.h> #include <osmocom/cbc/cbc_data.h> #include <osmocom/cbc/cbc_vty.h> @@ -55,6 +52,13 @@ struct cbc *g_cbc; static const struct log_info_cat log_info_cat = { + DMAIN = { + .name = "DMAIN", + .description = "Main logging category", + .color = "\0331;30m", + .enabled = 1, + .loglevel = LOGL_NOTICE, + }, DCBSP = { .name = "DCBSP", .description = "Cell Broadcast Service Protocol (CBC-BSC)", @@ -88,7 +92,7 @@ switch (vty->node) { case SBcAP_NODE: /* If no local addr set, add a default one: */ - if (g_cbc->config.sbcap.num_local_host) { + if (g_cbc->config.sbcap.num_local_host == 0) { g_cbc->config.sbcap.local_host0 = talloc_strdup(g_cbc, "127.0.0.1"); g_cbc->config.sbcap.num_local_host = 1; } @@ -116,7 +120,6 @@ .copyright = cbc_copyright, .go_parent_cb = cbc_vty_go_parent, .version = PACKAGE_VERSION, - .go_parent_cb = NULL, .is_config_node = NULL, }; @@ -235,27 +238,16 @@ int main(int argc, char **argv) { - void *tall_rest_ctx; int rc; tall_cbc_ctx = talloc_named_const(NULL, 1, "osmo-cbc"); - tall_rest_ctx = talloc_named_const(tall_cbc_ctx, 0, "REST"); msgb_talloc_ctx_init(tall_cbc_ctx, 0); osmo_init_logging2(tall_cbc_ctx, &log_info); log_enable_multithread(); osmo_stats_init(tall_cbc_ctx); vty_init(&vty_info); - g_cbc = talloc_zero(tall_cbc_ctx, struct cbc); - INIT_LLIST_HEAD(&g_cbc->peers); - INIT_LLIST_HEAD(&g_cbc->messages); - INIT_LLIST_HEAD(&g_cbc->expired_messages); - g_cbc->config.cbsp.local_host = talloc_strdup(g_cbc, "127.0.0.1"); - g_cbc->config.cbsp.local_port = CBSP_TCP_PORT; - /* g_cbc->config.sbcap local_host set up during VTY (and vty_go_parent) */ - g_cbc->config.sbcap.local_port = SBcAP_SCTP_PORT; - g_cbc->config.ecbe.local_host = talloc_strdup(g_cbc, "127.0.0.1"); - g_cbc->config.ecbe.local_port = 12345; + g_cbc = cbc_alloc(tall_cbc_ctx); cbc_vty_init(); @@ -277,26 +269,9 @@ exit(1); } - if (cbc_cbsp_mgr_create(tall_cbc_ctx) == NULL) { - perror("Error binding CBSP port"); - exit(1); - } - - if (cbc_sbcap_mgr_create(tall_cbc_ctx) == NULL) { - perror("Error binding SBc-AP port\n"); + rc = cbc_start(g_cbc); + if (rc < 0) exit(1); - } - - rc = rest_api_init(tall_rest_ctx, g_cbc->config.ecbe.local_host, g_cbc->config.ecbe.local_port); - if (rc < 0) { - perror("Error binding ECBE port"); - exit(1); - } - - LOGP(DREST, LOGL_INFO, "Main thread tid: %lu\n", pthread_self()); - g_cbc->it_q.rest2main = osmo_it_q_alloc(g_cbc, "rest2main", 10, rest2main_read_cb, NULL); - OSMO_ASSERT(g_cbc->it_q.rest2main); - osmo_fd_register(&g_cbc->it_q.rest2main->event_ofd); signal(SIGUSR1, &signal_handler); signal(SIGUSR2, &signal_handler);
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/src/cbc_vty.c -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/cbc_vty.c
Changed
@@ -44,6 +44,10 @@ { 0, NULL } }; +#define CBC_PEER_PROTO_NAME_VTY_CMD "(cbsp|sbcap)" +#define CBC_PEER_PROTO_NAME_VTY_STR "Cell Broadcast Service Protocol (GSM)\n" \ + "SBc Application Part (LTE)\n" + static void dump_one_cbc_peer(struct vty *vty, const struct cbc_peer *peer) { const char *state = "<disconnected>"; @@ -321,11 +325,20 @@ return CMD_SUCCESS; } +static int config_write_ecbe(struct vty *vty); +static int config_write_cbsp(struct vty *vty); +static int config_write_sbcap(struct vty *vty); +static int config_write_peer(struct vty *vty); + static int config_write_cbc(struct vty *vty) { vty_out(vty, "cbc%s", VTY_NEWLINE); vty_out(vty, " unknown-peers %s%s", g_cbc->config.permit_unknown_peers ? "accept" : "reject", VTY_NEWLINE); + config_write_ecbe(vty); + config_write_cbsp(vty); + config_write_sbcap(vty); + config_write_peer(vty); return CMD_SUCCESS; } @@ -510,13 +523,17 @@ /* PEER */ -DEFUN(cfg_cbc_peer, cfg_cbc_peer_cmd, +DEFUN_DEPRECATED(cfg_cbc_peer_old, cfg_cbc_peer_old_cmd, "peer NAME", "Remote Peer\n" "Name identifying the peer\n") { struct cbc_peer *peer; + vty_out(vty, "%% This function is deprecated, use " + "'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead. " + "Assuming 'cbsp' for peers being created%s", VTY_NEWLINE); + peer = cbc_peer_by_name(argv0); if (!peer) peer = cbc_peer_create(argv0, CBC_PEER_PROTO_CBSP); @@ -528,6 +545,27 @@ return CMD_SUCCESS; } +DEFUN(cfg_cbc_peer, cfg_cbc_peer_cmd, + "peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME", + "Remote Peer\n" + CBC_PEER_PROTO_NAME_VTY_STR + "Name identifying the peer\n") +{ + struct cbc_peer *peer; + enum cbc_peer_protocol proto; + + proto = get_string_value(cbc_peer_proto_name_vty, argv0); + peer = cbc_peer_by_name(argv1); + if (!peer) + peer = cbc_peer_create(argv1, proto); + if (!peer) + return CMD_WARNING; + + vty->node = PEER_NODE; + vty->index = peer; + return CMD_SUCCESS; +} + DEFUN(cfg_cbc_no_peer, cfg_cbc_no_peer_cmd, "no peer NAME", NO_STR "Remote Peer\n" @@ -545,13 +583,13 @@ } -DEFUN(cfg_peer_proto, cfg_peer_proto_cmd, - "protocol (cbsp|sbcap)", +DEFUN_DEPRECATED(cfg_peer_proto, cfg_peer_proto_cmd, + "protocol " CBC_PEER_PROTO_NAME_VTY_CMD, "Configure Protocol of Peer\n" - "Cell Broadcast Service Protocol (GSM)\n") + CBC_PEER_PROTO_NAME_VTY_STR) { - struct cbc_peer *peer = (struct cbc_peer *) vty->index; - peer->proto = get_string_value(cbc_peer_proto_name_vty, argv0); + vty_out(vty, "%% This function is deprecated and does nothing, use " + "'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead%s", VTY_NEWLINE); return CMD_SUCCESS; } @@ -637,9 +675,8 @@ static void write_one_peer(struct vty *vty, struct cbc_peer *peer) { unsigned int i; - vty_out(vty, " peer %s%s", peer->name, VTY_NEWLINE); - vty_out(vty, " protocol %s%s", - get_value_string(cbc_peer_proto_name_vty, peer->proto), VTY_NEWLINE); + vty_out(vty, " peer %s %s%s", get_value_string(cbc_peer_proto_name_vty, peer->proto), + peer->name, VTY_NEWLINE); if (peer->remote_port == -1) vty_out(vty, " no remote-port%s", VTY_NEWLINE); else @@ -662,38 +699,39 @@ void cbc_vty_init(void) { - install_lib_element_ve(&show_peers_cmd); - install_lib_element_ve(&show_message_cbs_cmd); - install_lib_element_ve(&show_messages_cbs_cmd); - install_lib_element_ve(&show_messages_etws_cmd); + install_element_ve(&show_peers_cmd); + install_element_ve(&show_message_cbs_cmd); + install_element_ve(&show_messages_cbs_cmd); + install_element_ve(&show_messages_etws_cmd); - install_lib_element(CONFIG_NODE, &cfg_cbc_cmd); + install_element(CONFIG_NODE, &cfg_cbc_cmd); install_node(&cbc_node, config_write_cbc); - install_lib_element(CBC_NODE, &cfg_permit_unknown_peers_cmd); + install_element(CBC_NODE, &cfg_permit_unknown_peers_cmd); - install_lib_element(CBC_NODE, &cfg_cbsp_cmd); - install_node(&cbsp_node, config_write_cbsp); - install_lib_element(CBSP_NODE, &cfg_cbsp_local_ip_cmd); - install_lib_element(CBSP_NODE, &cfg_cbsp_local_port_cmd); - - install_lib_element(CBC_NODE, &cfg_ecbe_cmd); - install_node(&ecbe_node, config_write_ecbe); - install_lib_element(ECBE_NODE, &cfg_ecbe_local_ip_cmd); - install_lib_element(ECBE_NODE, &cfg_ecbe_local_port_cmd); - - install_lib_element(CBC_NODE, &cfg_sbcap_cmd); - install_node(&sbcap_node, config_write_sbcap); - install_lib_element(SBcAP_NODE, &cfg_sbcap_local_ip_cmd); - install_lib_element(SBcAP_NODE, &cfg_sbcap_no_local_ip_cmd); - install_lib_element(SBcAP_NODE, &cfg_sbcap_local_port_cmd); - - install_lib_element(CBC_NODE, &cfg_cbc_peer_cmd); - install_lib_element(CBC_NODE, &cfg_cbc_no_peer_cmd); - install_node(&peer_node, config_write_peer); - install_lib_element(PEER_NODE, &cfg_peer_proto_cmd); - install_lib_element(PEER_NODE, &cfg_peer_remote_port_cmd); - install_lib_element(PEER_NODE, &cfg_peer_no_remote_port_cmd); - install_lib_element(PEER_NODE, &cfg_peer_remote_ip_cmd); - install_lib_element(PEER_NODE, &cfg_peer_no_remote_ip_cmd); + install_element(CBC_NODE, &cfg_cbsp_cmd); + install_node(&cbsp_node, NULL); + install_element(CBSP_NODE, &cfg_cbsp_local_ip_cmd); + install_element(CBSP_NODE, &cfg_cbsp_local_port_cmd); + + install_element(CBC_NODE, &cfg_ecbe_cmd); + install_node(&ecbe_node, NULL); + install_element(ECBE_NODE, &cfg_ecbe_local_ip_cmd); + install_element(ECBE_NODE, &cfg_ecbe_local_port_cmd); + + install_element(CBC_NODE, &cfg_sbcap_cmd); + install_node(&sbcap_node, NULL); + install_element(SBcAP_NODE, &cfg_sbcap_local_ip_cmd); + install_element(SBcAP_NODE, &cfg_sbcap_no_local_ip_cmd); + install_element(SBcAP_NODE, &cfg_sbcap_local_port_cmd); + + install_element(CBC_NODE, &cfg_cbc_peer_old_cmd); + install_element(CBC_NODE, &cfg_cbc_peer_cmd); + install_element(CBC_NODE, &cfg_cbc_no_peer_cmd); + install_node(&peer_node, NULL); + install_element(PEER_NODE, &cfg_peer_proto_cmd); + install_element(PEER_NODE, &cfg_peer_remote_port_cmd); + install_element(PEER_NODE, &cfg_peer_no_remote_port_cmd); + install_element(PEER_NODE, &cfg_peer_remote_ip_cmd); + install_element(PEER_NODE, &cfg_peer_no_remote_ip_cmd); }
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/src/cbsp_link.c -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/cbsp_link.c
Changed
@@ -19,6 +19,7 @@ */ #include <errno.h> +#include <unistd.h> #include <sys/types.h> #include <sys/socket.h> @@ -37,6 +38,36 @@ #include <osmocom/cbc/cbsp_link_fsm.h> #include <osmocom/cbc/cbc_peer.h> +struct cbc_cbsp_link *cbc_cbsp_link_alloc(struct cbc_cbsp_mgr *cbc, struct cbc_peer *peer) +{ + struct cbc_cbsp_link *link; + + link = talloc_zero(cbc, struct cbc_cbsp_link); + OSMO_ASSERT(link); + + link->peer = peer; + + link->fi = osmo_fsm_inst_alloc(&cbsp_link_fsm, link, link, LOGL_DEBUG, NULL); + if (!link->fi) { + LOGPCC(link, LOGL_ERROR, "Unable to allocate FSM\n"); + talloc_free(link); + return NULL; + } + + llist_add_tail(&link->list, &cbc->links); + return link; +} + +void cbc_cbsp_link_free(struct cbc_cbsp_link *link) +{ + if (!link) + return; + llist_del(&link->list); + if (link->fi) + osmo_fsm_inst_free(link->fi); + talloc_free(link); +} + const char *cbc_cbsp_link_name(const struct cbc_cbsp_link *link) { OSMO_ASSERT(link); @@ -112,10 +143,10 @@ static int cbsp_cbc_accept_cb(struct osmo_stream_srv_link *srv_link, int fd) { struct cbc_cbsp_mgr *cbc = osmo_stream_srv_link_get_data(srv_link); - struct cbc_cbsp_link *link = talloc_zero(cbc, struct cbc_cbsp_link); + struct cbc_peer *peer; + struct cbc_cbsp_link *link; char remote_ipINET6_ADDRSTRLEN, portbuf6; int remote_port; - OSMO_ASSERT(link); remote_ip0 = '\0'; portbuf0 = '\0'; @@ -124,45 +155,41 @@ LOGP(DCBSP, LOGL_NOTICE, "New CBSP link connection from %s:%u\n", remote_ip, remote_port); - link->conn = osmo_stream_srv_create(srv_link, srv_link, fd, cbsp_cbc_read_cb, cbsp_cbc_closed_cb, link); - if (!link->conn) { - LOGP(DCBSP, LOGL_ERROR, "Unable to create stream server for %s:%d\n", - remote_ip, remote_port); - talloc_free(link); - return -1; - } - link->fi = osmo_fsm_inst_alloc(&cbsp_link_fsm, link, link, LOGL_DEBUG, NULL); - if (!link->fi) { - LOGPCC(link, LOGL_ERROR, "Unable to allocate FSM\n"); - cbc_cbsp_link_close(link); - talloc_free(link); - return -1; - } - llist_add_tail(&link->list, &cbc->links); - /* Match link to peer */ - link->peer = cbc_peer_by_addr_proto(remote_ip, remote_port, CBC_PEER_PROTO_CBSP); - if (!link->peer) { - if (g_cbc->config.permit_unknown_peers) { - LOGPCC(link, LOGL_NOTICE, "Accepting unknown CBSP peer %s:%d\n", - remote_ip, remote_port); - link->peer = cbc_peer_create(NULL, CBC_PEER_PROTO_CBSP); - OSMO_ASSERT(link->peer); - link->peer->unknown_dynamic_peer = true; - } else { - LOGPCC(link, LOGL_NOTICE, "Rejecting unknown CBSP peer %s:%d (not permitted)\n", - remote_ip, remote_port); - cbc_cbsp_link_close(link); + peer = cbc_peer_by_addr_proto(remote_ip, remote_port, CBC_PEER_PROTO_CBSP); + if (!peer) { + if (!g_cbc->config.permit_unknown_peers) { + LOGP(DCBSP, LOGL_NOTICE, + "Rejecting unknown CBSP peer %s:%d (not permitted)\n", + remote_ip, remote_port); + close(fd); return -1; } - } else { - if (link->peer->link.cbsp) { - LOGPCC(link, LOGL_ERROR, "We already have a connection for peer %s\n", - link->peer->name); - /* FIXME */ - } - link->peer->link.cbsp = link; + LOGP(DCBSP, LOGL_NOTICE, "Accepting unknown CBSP peer %s:%d\n", + remote_ip, remote_port); + peer = cbc_peer_create(NULL, CBC_PEER_PROTO_CBSP); + OSMO_ASSERT(peer); + peer->unknown_dynamic_peer = true; + } + if (peer->link.cbsp) { + LOGPCC(peer->link.cbsp, LOGL_ERROR, + "We already have a connection for peer %s, closing it\n", + peer->name); + cbc_cbsp_link_close(peer->link.cbsp); + } + link = cbc_cbsp_link_alloc(cbc, peer); + OSMO_ASSERT(link); + link->conn = osmo_stream_srv_create(srv_link, srv_link, fd, + cbsp_cbc_read_cb, cbsp_cbc_closed_cb, + link); + if (!link->conn) { + LOGPCC(link, LOGL_ERROR, + "Unable to create stream server for %s:%u\n", + remote_ip, remote_port); + cbc_cbsp_link_free(link); + return -1; } + peer->link.cbsp = link; osmo_fsm_inst_dispatch(link->fi, CBSP_LINK_E_CMD_RESET, NULL); return 0;
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/src/cbsp_link_fsm.c -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/cbsp_link_fsm.c
Changed
@@ -197,13 +197,13 @@ struct cbc_cbsp_link *link = (struct cbc_cbsp_link *) fi->priv; cbc_cbsp_link_close(link); - llist_del(&link->list); - link->fi = NULL; /* reparent the fsm_inst to the cbc as we're about to free() it's talloc * parent 'link' */ + link->fi = NULL; talloc_steal(g_cbc, fi); - talloc_free(link); + + cbc_cbsp_link_free(link); } static const struct osmo_fsm_state cbsp_link_fsm_states = {
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/src/rest_api.c -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/rest_api.c
Changed
@@ -686,6 +686,8 @@ struct osmo_sockaddr_str sastr; int i; + LOGP(DREST, LOGL_INFO, "Main thread tid: %lu\n", pthread_self()); + #ifdef ULFIUS_MALLOC_NOT_BROKEN /* See https://github.com/babelouest/ulfius/issues/63 */ g_tall_rest = ctx;
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/src/sbcap_link.c -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/sbcap_link.c
Changed
@@ -19,6 +19,7 @@ */ #include <errno.h> +#include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> @@ -41,6 +42,36 @@ #include <osmocom/cbc/cbc_peer.h> #include <osmocom/cbc/debug.h> +struct cbc_sbcap_link *cbc_sbcap_link_alloc(struct cbc_sbcap_mgr *cbc, struct cbc_peer *peer) +{ + struct cbc_sbcap_link *link; + + link = talloc_zero(cbc, struct cbc_sbcap_link); + OSMO_ASSERT(link); + + link->peer = peer; + + link->fi = osmo_fsm_inst_alloc(&sbcap_link_fsm, link, link, LOGL_DEBUG, NULL); + if (!link->fi) { + LOGPSBCAPC(link, LOGL_ERROR, "Unable to allocate FSM\n"); + talloc_free(link); + return NULL; + } + + llist_add_tail(&link->list, &cbc->links); + return link; +} + +void cbc_sbcap_link_free(struct cbc_sbcap_link *link) +{ + if (!link) + return; + llist_del(&link->list); + if (link->fi) + osmo_fsm_inst_free(link->fi); + talloc_free(link); +} + const char *cbc_sbcap_link_name(const struct cbc_sbcap_link *link) { struct osmo_fd *ofd; @@ -140,10 +171,10 @@ static int sbcap_cbc_accept_cb(struct osmo_stream_srv_link *srv_link, int fd) { struct cbc_sbcap_mgr *cbc = osmo_stream_srv_link_get_data(srv_link); - struct cbc_sbcap_link *link = talloc_zero(cbc, struct cbc_sbcap_link); + struct cbc_peer *peer; + struct cbc_sbcap_link *link; char remote_ipINET6_ADDRSTRLEN, portbuf6; int remote_port; - OSMO_ASSERT(link); remote_ip0 = '\0'; portbuf0 = '\0'; @@ -152,45 +183,42 @@ LOGP(DSBcAP, LOGL_NOTICE, "New SBc-AP link connection from %s:%u\n", remote_ip, remote_port); - link->conn = osmo_stream_srv_create(srv_link, srv_link, fd, sbcap_cbc_read_cb, sbcap_cbc_closed_cb, link); - if (!link->conn) { - LOGP(DSBcAP, LOGL_ERROR, "Unable to create stream server for %s:%d\n", - remote_ip, remote_port); - talloc_free(link); - return -1; - } - link->fi = osmo_fsm_inst_alloc(&sbcap_link_fsm, link, link, LOGL_DEBUG, NULL); - if (!link->fi) { - LOGPSBCAPC(link, LOGL_ERROR, "Unable to allocate FSM\n"); - cbc_sbcap_link_close(link); - talloc_free(link); - return -1; - } - llist_add_tail(&link->list, &cbc->links); - /* Match link to peer */ - link->peer = cbc_peer_by_addr_proto(remote_ip, remote_port, CBC_PEER_PROTO_SBcAP); - if (!link->peer) { - if (g_cbc->config.permit_unknown_peers) { - LOGPSBCAPC(link, LOGL_NOTICE, "Accepting unknown SBc-AP peer %s:%d\n", - remote_ip, remote_port); - link->peer = cbc_peer_create(NULL, CBC_PEER_PROTO_SBcAP); - OSMO_ASSERT(link->peer); - link->peer->unknown_dynamic_peer = true; - } else { - LOGPSBCAPC(link, LOGL_NOTICE, "Rejecting unknown SBc-AP peer %s:%d (not permitted)\n", - remote_ip, remote_port); - cbc_sbcap_link_close(link); + peer = cbc_peer_by_addr_proto(remote_ip, remote_port, CBC_PEER_PROTO_SBcAP); + if (!peer) { + if (!g_cbc->config.permit_unknown_peers) { + LOGP(DSBcAP, LOGL_NOTICE, + "Rejecting unknown SBc-AP peer %s:%d (not permitted)\n", + remote_ip, remote_port); + close(fd); return -1; } - } else { - if (link->peer->link.sbcap) { - LOGPSBCAPC(link, LOGL_ERROR, "We already have a connection for peer %s\n", - link->peer->name); - /* FIXME */ - } - link->peer->link.sbcap = link; + LOGP(DSBcAP, LOGL_NOTICE, "Accepting unknown SBc-AP peer %s:%d\n", + remote_ip, remote_port); + peer = cbc_peer_create(NULL, CBC_PEER_PROTO_SBcAP); + OSMO_ASSERT(peer); + peer->unknown_dynamic_peer = true; + } + if (peer->link.sbcap) { + LOGPSBCAPC(peer->link.sbcap, LOGL_ERROR, + "We already have a connection for peer %s, closing it\n", + peer->name); + cbc_sbcap_link_close(peer->link.sbcap); + } + link = cbc_sbcap_link_alloc(cbc, peer); + OSMO_ASSERT(link); + + link->conn = osmo_stream_srv_create(srv_link, srv_link, fd, + sbcap_cbc_read_cb, sbcap_cbc_closed_cb, + link); + if (!link->conn) { + LOGPSBCAPC(link, LOGL_ERROR, + "Unable to create stream server for %s:%u\n", + remote_ip, remote_port); + cbc_sbcap_link_free(link); + return -1; } + peer->link.sbcap = link; osmo_fsm_inst_dispatch(link->fi, SBcAP_LINK_E_CMD_RESET, NULL); return 0;
View file
osmo-cbc_0.3.0.42.85bc.202207220002.tar.gz/src/sbcap_link_fsm.c -> osmo-cbc_0.3.0.50.5661.202207230002.tar.gz/src/sbcap_link_fsm.c
Changed
@@ -95,13 +95,13 @@ struct cbc_sbcap_link *link = (struct cbc_sbcap_link *) fi->priv; cbc_sbcap_link_close(link); - llist_del(&link->list); - link->fi = NULL; /* reparent the fsm_inst to the cbc as we're about to free() it's talloc * parent 'link' */ + link->fi = NULL; talloc_steal(g_cbc, fi); - talloc_free(link); + + cbc_sbcap_link_free(link); } static const struct osmo_fsm_state sbcap_link_fsm_states = {
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.