laforge submitted this change.

View Change


Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
gprs: fix has_valid_nsvc(): permit local udp port 0

NSVC local port 0 is actually a valid value, which tells the PCU to
pick a random port for bind()ing. It was supported before 315af2f9e,
but now osmo-bsc would simply ignore NSVCs with 'local udp port 0'
and leave the respective MOs unconfigured in the BTS.

Change-Id: I0afd83e77f3daeeb082e7db911610428b5bc587c
Fixes: 315af2f9e "bts: ipa/osmo-bts/sysmobts: MO: add support for the second NSVC"
Related: OS#5979
---
M src/osmo-bsc/nm_gprs_nsvc_fsm.c
1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/osmo-bsc/nm_gprs_nsvc_fsm.c b/src/osmo-bsc/nm_gprs_nsvc_fsm.c
index 5186082..906ba2a 100644
--- a/src/osmo-bsc/nm_gprs_nsvc_fsm.c
+++ b/src/osmo-bsc/nm_gprs_nsvc_fsm.c
@@ -90,12 +90,17 @@
}
}

-static bool has_valid_nsvc(struct gsm_gprs_nsvc *nsvc)
+static bool has_valid_nsvc(const struct gsm_gprs_nsvc *nsvc)
{
+ /* remote address must be valid */
+ if (osmo_sockaddr_is_any(&nsvc->remote))
+ return false;
+ /* remote port must be valid */
switch (nsvc->remote.u.sa.sa_family) {
case AF_INET:
+ return nsvc->remote.u.sin.sin_port != 0;
case AF_INET6:
- return (nsvc->local_port > 0 && !osmo_sockaddr_is_any(&nsvc->remote));
+ return nsvc->remote.u.sin6.sin6_port != 0;
default:
return false;
}

To view, visit change 32176. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I0afd83e77f3daeeb082e7db911610428b5bc587c
Gerrit-Change-Number: 32176
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged