Bug #5979
closed@nsvc local port 0@ is not properly handled by osmo-bsc
100%
Description
I've recently started osmo-bsc using an old config file, and then saved the config again.
In the old config file there was no nsvc 0 local udp port
configured. Not sure why, and whether that ever worked. However, the problem is that the PCU obviously cannot bind to port 0, and will keep re-starting.
We should have a sane default value for the local UDP port (like our usual 23000). "0" is not a sane default, as it can never work. The user might simply add remote ip/port and not explicitly set a local port and run into that problem.
Maybe we shouldn't even permit a local/remote port number 0 in the VTY and instead use <1-65535>. Or the 0
becomes the implicit This NSVC is not configured? But in that case we should probably suppress printing anything about it?
Updated by fixeria about 1 year ago
- Status changed from New to In Progress
- % Done changed from 0 to 80
laforge wrote:
We should have a sane default value for the local UDP port (like our usual 23000). "0" is not a sane default, as it can never work. The user might simply add remote ip/port and not explicitly set a local port and run into that problem.
remote: https://gerrit.osmocom.org/c/osmo-bsc/+/32168 doc/{examples,manuals}: remove dummy 'gprs nsvc 1' [NEW]
remote: https://gerrit.osmocom.org/c/osmo-bsc/+/32169 tests: rename and extend gprs_{bvci_default->params}.vty [NEW]
remote: https://gerrit.osmocom.org/c/osmo-bsc/+/32170 gprs: use sane default local UDP ports for NSVSs [NEW]
remote: https://gerrit.osmocom.org/c/osmo-bsc/+/32171 tests: add more tests for GPRS NSVC parameters [NEW]
Maybe we shouldn't even permit a local/remote port number 0 in the VTY and instead use <1-65535>. Or the
0
becomes the implicit This NSVC is not configured? But in that case we should probably suppress printing anything about it?
Ideally, yes, we should not permit local/remote port number 0. Currently an NSVC is considered not configured (by the VTY logic) if osmo_sockaddr_str_from_sockaddr()
fails to convert the remote addr/port. The OML logic defines its own has_valid_nsvc()
, which checks a) if local port if not 0 and b) if !osmo_sockaddr_is_any()
. We cannot just change the value range to <1-65535> because then osmo-bsc would fail to parse config files it previously generated...
Updated by fixeria about 1 year ago
fixeria wrote in #note-1:
Ideally, yes, we should not permit local/remote port number 0. Currently an NSVC is considered not configured (by the VTY logic) if
osmo_sockaddr_str_from_sockaddr()
fails to convert the remote addr/port. The OML logic defines its ownhas_valid_nsvc()
, which checks a) if local port if not 0 and b) if!osmo_sockaddr_is_any()
. We cannot just change the value range to <1-65535> because then osmo-bsc would fail to parse config files it previously generated...
I investigated this a bit further and found out that local udp port 0
is a perfectly valid (special) value, which has been supported until the following patch was merged:
commit 315af2f9ea1e8b9bf6e58caebd9dd7829edecfed Author: Alexander Couzens <lynxis@fe80.eu> Date: Mon Dec 19 21:21:32 2022 +0100 bts: ipa/osmo-bts/sysmobts: MO: add support for the second NSVC
This commit added has_valid_nsvc()
returning false if the local bind port is 0, so after this commit would simply ignore NSVCs with local udp port 0
and leave the respective MOs unconfigured in the BTS, even if a valid pair of remote address/port is set.
I abandoned my previously submitted patch:
https://gerrit.osmocom.org/c/osmo-bsc/+/32170 gprs: use sane default local UDP ports for NSVSs
and submitted another new one fixing has_valid_nsvc()
:
https://gerrit.osmocom.org/c/osmo-bsc/+/32169 gprs: fix has_valid_nsvc(): permit local udp port 0
I also confirmed in the leaked ip.access A-bis document that 0 is a permitted local port value for nanoBTS.
Updated by fixeria about 1 year ago
- Subject changed from @nsvc local port 0@ makes no sense to @nsvc local port 0@ is not properly handled by osmo-bsc
- Status changed from In Progress to Resolved
- % Done changed from 80 to 100
All patches have been merged. nsvc local port 0
is confirmed to work now.