<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/19836">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">CBC VTY: make CBSP server and client mutually exclusive<br><br>Do not allow osmo-bsc to be configured as CBC client *and* CBC server at the<br>same time.<br><br>This patch will break all BSC_Tests_CBSP, until the 'cbc' section in<br>osmo-bsc.cfg is removed, and until the patch to apply the CBC config via<br>f_vty_transceive is applied. See I7eea0dd39de50ed80af79e0f10c836b8685d8644 in<br>osmo-ttcn3-hacks.<br><br>Rationale:<br><br>cbsp_link.c expects at most one CBSP link to be established, and, upon sending<br>CBSP messages, probes whether to send the message to a CBSP server or client<br>link. When both listen-port and remote-ip are configured (regardless of an<br>actual CBSP connection), osmo-bsc gets confused about where to send CBSP<br>messages.<br><br>One solution would be more accurate probing for an actual established TCP<br>connection. But the simpler and less confusing solution is to force the user to<br>configure only server or only client mode, never both.<br><br>Related: I7eea0dd39de50ed80af79e0f10c836b8685d8644 (osmo-ttcn3-hacks)<br>Related: OS#4702<br>Change-Id: Icf901848e666f079d14450962f0a1d74b0996c56<br>---<br>M src/osmo-bsc/cbsp_link.c<br>1 file changed, 16 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/36/19836/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/cbsp_link.c b/src/osmo-bsc/cbsp_link.c</span><br><span>index 33f2e11..d6e688e 100644</span><br><span>--- a/src/osmo-bsc/cbsp_link.c</span><br><span>+++ b/src/osmo-bsc/cbsp_link.c</span><br><span>@@ -308,6 +308,14 @@</span><br><span>        CBSP_REMOTE "IP Address of the Cell Broadcast Centre\n")</span><br><span> {</span><br><span>      struct bsc_cbc_link *cbc = vty_cbc_data(vty);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       if (cbc->config.listen_port > 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+              vty_out(vty, "%% Error: CBC server and CBC client cannot be enabled at the same time.%s"</span><br><span style="color: hsl(120, 100%, 40%);">+                    "%% To set a 'cbc' / 'remote-ip', first set 'cbc' / 'no listen-port'.%s",</span><br><span style="color: hsl(120, 100%, 40%);">+                   VTY_NEWLINE, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+            return CMD_WARNING;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  osmo_talloc_replace_string(cbc, &cbc->config.cbc_hostname, argv[0]);</span><br><span>  return CMD_SUCCESS;</span><br><span> }</span><br><span>@@ -339,6 +347,14 @@</span><br><span>      "Local TCP port at which BSC listens for incoming CBSP connections from CBC\n")</span><br><span> {</span><br><span>       struct bsc_cbc_link *cbc = vty_cbc_data(vty);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       if (cbc->config.cbc_hostname) {</span><br><span style="color: hsl(120, 100%, 40%);">+            vty_out(vty, "%% Error: CBC server and CBC client cannot be enabled at the same time.%s"</span><br><span style="color: hsl(120, 100%, 40%);">+                    "%% To set a 'cbc' / 'listen-port', first set 'cbc' / 'no remote-ip'.%s",</span><br><span style="color: hsl(120, 100%, 40%);">+                   VTY_NEWLINE, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+            return CMD_WARNING;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  cbc->config.listen_port = atoi(argv[0]);</span><br><span>  return CMD_SUCCESS;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/19836">change 19836</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/19836"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Icf901848e666f079d14450962f0a1d74b0996c56 </div>
<div style="display:none"> Gerrit-Change-Number: 19836 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>