aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-09-27 00:04:37 +0200
committerlaforge <laforge@osmocom.org>2020-10-05 14:06:26 +0000
commit62af292f38356311f92c8ec1b8307339349db70b (patch)
treeecad83b8d702001e0c1a44d17d789af03a28a968 /src
parent97d3978dd03f9ce6a6afce4b0140e1a6f3b200a4 (diff)
pcuif_proto: version 10: add support for IPv6 NSVCs
Introduce a address_type in the NSVC configuration pass the given protocol. The remote_ip is network byte order, the default encoding for in_addr and in6_addr. Related: Iae854875a45dbc29cd46a267ccaf60f1f2ac2973 Related: SYS#4915 Change-Id: I740be0a401612bb5ed4e8ccd7f4be8176b936449
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/pcu_sock.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index 4e9f7bf2b..a1a1cfc18 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -204,17 +204,25 @@ static int pcu_tx_info_ind(struct gsm_bts *bts)
for (i = 0; i < ARRAY_SIZE(info_ind->nsvci); i++) {
nsvc = &bts->gprs.nsvc[i];
- if (nsvc->remote.u.sa.sa_family == AF_INET6) {
- LOGP(DPCU, LOGL_ERROR, "PCU does not support IPv6 NSVC but an IPv6 NSVC was configured!\n");
- continue;
- }
- if (nsvc->remote.u.sa.sa_family != AF_INET)
- continue;
-
info_ind->nsvci[i] = nsvc->nsvci;
info_ind->local_port[i] = nsvc->local_port;
- info_ind->remote_port[i] = osmo_ntohs(nsvc->remote.u.sin.sin_port);
- info_ind->remote_ip[i] = osmo_ntohl(nsvc->remote.u.sin.sin_addr.s_addr);
+ switch (nsvc->remote.u.sas.ss_family) {
+ case AF_INET:
+ info_ind->address_type[i] = PCU_IF_ADDR_TYPE_IPV4;
+ info_ind->remote_ip[i].v4 = nsvc->remote.u.sin.sin_addr;
+ info_ind->remote_port[i] = nsvc->remote.u.sin.sin_port;
+ break;
+ case AF_INET6:
+ info_ind->address_type[i] = PCU_IF_ADDR_TYPE_IPV6;
+ memcpy(&info_ind->remote_ip[i].v6,
+ &nsvc->remote.u.sin6.sin6_addr,
+ sizeof(struct in6_addr));
+ info_ind->remote_port[i] = nsvc->remote.u.sin6.sin6_port;
+ break;
+ default:
+ info_ind->address_type[i] = PCU_IF_ADDR_TYPE_UNSPEC;
+ break;
+ }
}
for (i = 0; i < ARRAY_SIZE(info_ind->trx); i++) {