mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc.git
synced 2025-10-23 08:22:19 +00:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
91ea92868a | ||
|
1b402db278 | ||
|
c5afbd3336 | ||
|
da85d1f75a | ||
|
2c34f95a04 | ||
|
1a454c9174 | ||
|
f25277e872 | ||
|
28d66aa8ec | ||
|
80184a4e41 | ||
|
cc02c15505 | ||
|
f4fa15cb0e | ||
|
16daffdc52 | ||
|
3bb05bafce |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
*.a
|
||||
*.lo
|
||||
*.la
|
||||
*~
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -20,7 +21,6 @@ depcomp
|
||||
install-sh
|
||||
missing
|
||||
stamp-h1
|
||||
configure~
|
||||
|
||||
# libtool
|
||||
ltmain.sh
|
||||
@@ -62,3 +62,4 @@ doc/manuals/vty/cbc_vty_reference.xml
|
||||
|
||||
contrib/osmo-cbc.spec
|
||||
libosmo-sbcap.pc
|
||||
include/osmocom/sbcap/version.h
|
||||
|
@@ -30,7 +30,6 @@ export LD_LIBRARY_PATH="$inst/lib"
|
||||
export PATH="$inst/bin:$PATH"
|
||||
|
||||
osmo-build-dep.sh libosmocore "" --disable-doxygen
|
||||
osmo-build-dep.sh libosmo-abis
|
||||
osmo-build-dep.sh libosmo-netif "" --disable-doxygen
|
||||
|
||||
# Additional configure options and depends
|
||||
|
13
debian/changelog
vendored
13
debian/changelog
vendored
@@ -1,3 +1,16 @@
|
||||
osmo-cbc (0.5.1) unstable; urgency=medium
|
||||
|
||||
[ Oliver Smith ]
|
||||
* contrib/jenkins: libosmo-abis after libosmo-netif
|
||||
|
||||
[ Pau Espin Pedrol ]
|
||||
* .gitignore: Add *~
|
||||
* cbsp_link: Log unexpected return error codes
|
||||
* abis: Fix reusing link->conn while it is being destroyed
|
||||
* jenkins.sh: Skip building unneeded libosmo-abis
|
||||
|
||||
-- Oliver Smith <osmith@sysmocom.de> Wed, 12 Feb 2025 14:30:50 +0100
|
||||
|
||||
osmo-cbc (0.5.0) unstable; urgency=medium
|
||||
|
||||
[ Harald Welte ]
|
||||
|
2
debian/osmo-cbc.install
vendored
2
debian/osmo-cbc.install
vendored
@@ -1,4 +1,4 @@
|
||||
/etc/osmocom/osmo-cbc.cfg
|
||||
lib/systemd/system/osmo-cbc.service
|
||||
usr/bin/osmo-cbc
|
||||
usr/share/doc/osmo-cbc/examples/osmo-cbc/*.cfg usr/share/doc/osmo-bsc/examples
|
||||
usr/share/doc/osmo-cbc/examples/osmo-cbc/*.cfg usr/share/doc/osmo-cbc/examples
|
||||
|
@@ -17,5 +17,5 @@ arguments:
|
||||
Fork the process as a daemon into background.
|
||||
*-c, --config-file 'CONFIGFILE'*::
|
||||
Specify the file and path name of the configuration file to be
|
||||
used. If none is specified, use `osmo-bsc.cfg` in the current
|
||||
used. If none is specified, use `osmo-cbc.cfg` in the current
|
||||
working directory.
|
||||
|
@@ -89,6 +89,7 @@ struct cbc {
|
||||
extern struct cbc *g_cbc;
|
||||
struct cbc *cbc_alloc(void *ctx);
|
||||
int cbc_start(struct cbc *cbc);
|
||||
void cbc_add_sbcap_default_local_host_if_needed(struct cbc *cbc);
|
||||
|
||||
/* rest_api.c */
|
||||
int rest_api_init(void *ctx, const char *bind_addr, uint16_t port);
|
||||
|
@@ -1,3 +1,16 @@
|
||||
version.h: version.h.tpl
|
||||
$(AM_V_GEN)$(MKDIR_P) $(dir $@)
|
||||
$(AM_V_GEN)sed \
|
||||
-e "s/{{VERSION}}/$$(echo '@VERSION@' | cut -d. -f1-3)/g" \
|
||||
-e "s/{{VERSION_MAJOR}}/$$(echo '@VERSION@' | cut -d. -f1)/g" \
|
||||
-e "s/{{VERSION_MINOR}}/$$(echo '@VERSION@' | cut -d. -f2)/g" \
|
||||
-e "s/{{VERSION_PATCH}}/$$(echo '@VERSION@' | cut -d. -f3)/g" \
|
||||
$< > $@
|
||||
|
||||
EXTRA_DIST = \
|
||||
version.h.tpl \
|
||||
$(NULL)
|
||||
|
||||
sbcap_HEADERS = \
|
||||
sbcap_common.h \
|
||||
sbcap_internal.h \
|
||||
@@ -115,6 +128,7 @@ sbcap_HEADERS = \
|
||||
SBcAP_Write-Replace-Warning-Indication.h \
|
||||
SBcAP_Write-Replace-Warning-Request.h \
|
||||
SBcAP_Write-Replace-Warning-Response.h \
|
||||
version.h \
|
||||
$(NULL)
|
||||
|
||||
sbcapdir = $(includedir)/osmocom/sbcap
|
||||
|
16
include/osmocom/sbcap/version.h.tpl
Normal file
16
include/osmocom/sbcap/version.h.tpl
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#define LIBOSMO_SBCAP_VERSION {{VERSION}}
|
||||
#define LIBOSMO_SBCAP_VERSION_STR "{{VERSION}}"
|
||||
|
||||
#define LIBOSMO_SBCAP_VERSION_MAJOR {{VERSION_MAJOR}}
|
||||
#define LIBOSMO_SBCAP_VERSION_MINOR {{VERSION_MINOR}}
|
||||
#define LIBOSMO_SBCAP_VERSION_PATCH {{VERSION_PATCH}}
|
||||
|
||||
#define LIBOSMO_SBCAP_VERSION_GREATER_EQUAL(major, minor, patch) \
|
||||
(LIBOSMO_SBCAP_VERSION_MAJOR > (major) || \
|
||||
(LIBOSMO_SBCAP_VERSION_MAJOR == (major) && \
|
||||
LIBOSMO_SBCAP_VERSION_MINOR > (minor)) || \
|
||||
(LIBOSMO_SBCAP_VERSION_MAJOR == (major) && \
|
||||
LIBOSMO_SBCAP_VERSION_MINOR == (minor) && \
|
||||
LIBOSMO_SBCAP_VERSION_PATCH >= (patch)))
|
@@ -85,7 +85,9 @@ struct cbc *cbc_alloc(void *ctx)
|
||||
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) */
|
||||
/* Due to SCTP multi-home support, cbc->config.sbcap.local_host is not set here,
|
||||
* but through VTY (user or vty_go_parent()), or if not set default is set after
|
||||
* VTY cfg read, during cbc_start(). */
|
||||
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;
|
||||
@@ -103,6 +105,17 @@ struct cbc *cbc_alloc(void *ctx)
|
||||
return cbc;
|
||||
}
|
||||
|
||||
/* If no local addr set, add a default one: */
|
||||
void cbc_add_sbcap_default_local_host_if_needed(struct cbc *cbc)
|
||||
{
|
||||
if (g_cbc->config.sbcap.num_local_host > 0)
|
||||
return;
|
||||
|
||||
g_cbc->config.sbcap.local_host[0] = talloc_strdup(g_cbc, "127.0.0.1");
|
||||
g_cbc->config.sbcap.local_host[1] = talloc_strdup(g_cbc, "::1");
|
||||
g_cbc->config.sbcap.num_local_host = 2;
|
||||
}
|
||||
|
||||
int cbc_start(struct cbc *cbc)
|
||||
{
|
||||
void *tall_rest_ctx;
|
||||
@@ -115,6 +128,12 @@ int cbc_start(struct cbc *cbc)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* User didn't configure an SBcAP node with a local address, use default: */
|
||||
if (!cbc->config.sbcap.configured) {
|
||||
cbc_add_sbcap_default_local_host_if_needed(cbc);
|
||||
cbc->config.sbcap.configured = true;
|
||||
}
|
||||
|
||||
if ((rc = cbc_sbcap_mgr_open_srv(cbc->sbcap.mgr)) < 0) {
|
||||
LOGP(DMAIN, LOGL_ERROR, "Error binding SBc-AP port\n");
|
||||
return rc;
|
||||
|
@@ -113,10 +113,7 @@ static int cbc_vty_go_parent(struct vty *vty)
|
||||
break;
|
||||
case SBcAP_NODE:
|
||||
/* If no local addr set, add a default one: */
|
||||
if (g_cbc->config.sbcap.num_local_host == 0) {
|
||||
g_cbc->config.sbcap.local_host[0] = talloc_strdup(g_cbc, "127.0.0.1");
|
||||
g_cbc->config.sbcap.num_local_host = 1;
|
||||
}
|
||||
cbc_add_sbcap_default_local_host_if_needed(g_cbc);
|
||||
g_cbc->config.sbcap.configured = true;
|
||||
vty->node = CONFIG_NODE;
|
||||
vty->index = NULL;
|
||||
@@ -147,7 +144,6 @@ static struct vty_app_info vty_info = {
|
||||
.copyright = cbc_copyright,
|
||||
.go_parent_cb = cbc_vty_go_parent,
|
||||
.version = PACKAGE_VERSION,
|
||||
.is_config_node = NULL,
|
||||
};
|
||||
|
||||
static struct {
|
||||
@@ -274,6 +270,8 @@ int main(int argc, char **argv)
|
||||
sbcap_set_log_area(DSBcAP, DASN1C);
|
||||
osmo_stats_init(tall_cbc_ctx);
|
||||
osmo_fsm_log_timeouts(true);
|
||||
|
||||
vty_info.tall_ctx = tall_cbc_ctx;
|
||||
vty_init(&vty_info);
|
||||
|
||||
g_cbc = cbc_alloc(tall_cbc_ctx);
|
||||
@@ -284,6 +282,8 @@ int main(int argc, char **argv)
|
||||
|
||||
logging_vty_add_cmds();
|
||||
osmo_fsm_vty_add_cmds();
|
||||
osmo_stats_vty_add_cmds();
|
||||
osmo_talloc_vty_add_cmds();
|
||||
|
||||
rc = vty_read_config_file(cmdline_config.config_file, NULL);
|
||||
if (rc < 0) {
|
||||
|
@@ -551,9 +551,10 @@ DEFUN_DEPRECATED(cfg_cbc_peer_old, cfg_cbc_peer_old_cmd,
|
||||
{
|
||||
struct cbc_peer *peer;
|
||||
|
||||
vty_out(vty, "%% This function is deprecated, use "
|
||||
vty_out(vty, "%% '%s' is deprecated, use "
|
||||
"'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead. "
|
||||
"Assuming 'cbsp' for peers being created%s", VTY_NEWLINE);
|
||||
"Assuming 'cbsp' for peers being created%s",
|
||||
self->string, VTY_NEWLINE);
|
||||
|
||||
peer = cbc_peer_by_name(argv[0]);
|
||||
if (!peer)
|
||||
@@ -629,8 +630,9 @@ DEFUN_DEPRECATED(cfg_peer_proto, cfg_peer_proto_cmd,
|
||||
"Configure Protocol of Peer\n"
|
||||
CBC_PEER_PROTO_NAME_VTY_STR)
|
||||
{
|
||||
vty_out(vty, "%% This function is deprecated and does nothing, use "
|
||||
"'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead%s", VTY_NEWLINE);
|
||||
vty_out(vty, "%% '%s' is deprecated and does nothing, use "
|
||||
"'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead%s",
|
||||
self->string, VTY_NEWLINE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -102,6 +102,8 @@ static int cbc_cbsp_link_cli_connect_cb(struct osmo_stream_cli *conn)
|
||||
static int cbc_cbsp_link_cli_disconnect_cb(struct osmo_stream_cli *conn)
|
||||
{
|
||||
struct cbc_cbsp_link *link = osmo_stream_cli_get_data(conn);
|
||||
if (!link->conn) /* conn is being destroyed by us, we called osmo_stream_cli_destroy() */
|
||||
return 0;
|
||||
LOGPCC(link, LOGL_NOTICE, "Disconnected.\n");
|
||||
LOGPCC(link, LOGL_NOTICE, "Reconnecting...\n");
|
||||
osmo_stream_cli_reconnect(conn);
|
||||
@@ -121,6 +123,7 @@ static int cbc_cbsp_link_cli_read_cb(struct osmo_stream_cli *conn)
|
||||
/* message de-segmentation */
|
||||
rc = osmo_cbsp_recv_buffered(conn, ofd->fd, &msg, &link->rx_msg);
|
||||
if (rc <= 0) {
|
||||
LOGPCC(link, LOGL_NOTICE, "osmo_cbsp_recv_buffered() ret %d\n", rc);
|
||||
if (rc == -EAGAIN || rc == -EINTR) {
|
||||
/* more data needs to be read */
|
||||
return 0;
|
||||
@@ -205,6 +208,7 @@ static int cbsp_cbc_srv_read_cb(struct osmo_stream_srv *conn)
|
||||
/* message de-segmentation */
|
||||
rc = osmo_cbsp_recv_buffered(conn, ofd->fd, &msg, &link->rx_msg);
|
||||
if (rc <= 0) {
|
||||
LOGPCC(link, LOGL_NOTICE, "osmo_cbsp_recv_buffered() ret %d\n", rc);
|
||||
if (rc == -EAGAIN || rc == -EINTR) {
|
||||
/* more data needs to be read */
|
||||
return 0;
|
||||
@@ -362,10 +366,11 @@ void cbc_cbsp_link_close(struct cbc_cbsp_link *link)
|
||||
return;
|
||||
|
||||
if (link->is_client) {
|
||||
osmo_stream_cli_destroy(link->cli_conn);
|
||||
struct osmo_stream_cli *cli_conn = link->cli_conn;
|
||||
link->cli_conn = NULL;
|
||||
osmo_stream_cli_destroy(cli_conn);
|
||||
if (link->peer)
|
||||
link->peer->link.cbsp = NULL;
|
||||
link->cli_conn = NULL;
|
||||
if (link->fi)
|
||||
osmo_fsm_inst_dispatch(link->fi, CBSP_LINK_E_CMD_CLOSE, NULL);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user