neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/19833 )


Change subject: cbsp_link.c: disable server with listen_port = 0, not -1
......................................................................

cbsp_link.c: disable server with listen_port = 0, not -1

smscb.h defines listen_port as "0 for disabling local server", so rather
conform to that. That also allows using uint16_t for port numbers.

Change-Id: Ibe743fb17f0bde22004932076d45a6ba929ac565
---
M src/osmo-bsc/bsc_init.c
M src/osmo-bsc/cbsp_link.c
2 files changed, 6 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/33/19833/1

diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c
index 22eba50..4dfe868 100644
--- a/src/osmo-bsc/bsc_init.c
+++ b/src/osmo-bsc/bsc_init.c
@@ -131,8 +131,8 @@
        net->cbc->net = net;
        /* no cbc_hostname: client not started by default */
        net->cbc->config.cbc_port = CBSP_TCP_PORT;
-       /* listen_port == -1: server not started by default */
-       net->cbc->config.listen_port = -1;
+       /* listen_port == 0: server not started by default */
+       net->cbc->config.listen_port = 0;
        net->cbc->config.listen_hostname = talloc_strdup(net->cbc, "127.0.0.1");

        return net;
diff --git a/src/osmo-bsc/cbsp_link.c b/src/osmo-bsc/cbsp_link.c
index 6a0884e..bf9d853 100644
--- a/src/osmo-bsc/cbsp_link.c
+++ b/src/osmo-bsc/cbsp_link.c
@@ -203,7 +203,7 @@
        }

        /* shut down server, if no longer configured */
-       if (cbc->config.listen_port == -1) {
+       if (!cbc->config.listen_port) {
                if (cbc->server.srv || cbc->server.link)
                        LOGP(DCBS, LOGL_NOTICE, "Stopping CBSP server\n");
                if (cbc->server.srv) {
@@ -236,7 +236,7 @@
        }

        /* start server, if configured */
-       if (cbc->config.listen_port != -1) {
+       if (cbc->config.listen_port > 0) {
                LOGP(DCBS, LOGL_NOTICE, "Starting CBSP Server (bound to 
%s:%u)\n",
                        cbc->config.listen_hostname, cbc->config.listen_port);
                if (!cbc->server.link) {
@@ -347,7 +347,7 @@
        NO_STR "Remove CBSP Listen Port; disables inbound CBSP connections\n")
 {
        struct bsc_cbc_link *cbc = vty_cbc_data(vty);
-       cbc->config.listen_port = -1;
+       cbc->config.listen_port = 0;
        return CMD_SUCCESS;
 }

@@ -402,7 +402,7 @@
                vty_out(vty, "CBSP Client Connection: %s%s",
                        cbc->client.sock_name ? cbc->client.sock_name : 
"Disconnected", VTY_NEWLINE);
        }
-       if (cbc->config.listen_port < 0)
+       if (!cbc->config.listen_port)
                vty_out(vty, "CBSP Server Config: Disabled%s\n", VTY_NEWLINE);
        else {
                vty_out(vty, "CBSP Server Config: Listen IP=%s, Port=%u%s\n",

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/19833
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ibe743fb17f0bde22004932076d45a6ba929ac565
Gerrit-Change-Number: 19833
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to