This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/20294 )
Change subject: pcuif_proto: version 10: add support for IPv6 NSVCs
......................................................................
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
---
M include/osmocom/bsc/pcuif_proto.h
M src/osmo-bsc/pcu_sock.c
2 files changed, 28 insertions(+), 10 deletions(-)
Approvals:
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/include/osmocom/bsc/pcuif_proto.h b/include/osmocom/bsc/pcuif_proto.h
index 80d4f90..8f72602 100644
--- a/include/osmocom/bsc/pcuif_proto.h
+++ b/include/osmocom/bsc/pcuif_proto.h
@@ -2,6 +2,7 @@
#define _PCUIF_PROTO_H
#include <osmocom/gsm/l1sap.h>
+#include <arpa/inet.h>
#define PCU_SOCK_DEFAULT "/tmp/pcu_bts"
@@ -50,6 +51,11 @@
#define PCU_IF_FLAG_MCS8 (1 << 27)
#define PCU_IF_FLAG_MCS9 (1 << 28)
+/* NSVC address type */
+#define PCU_IF_ADDR_TYPE_UNSPEC 0x00 /* No address - empty entry */
+#define PCU_IF_ADDR_TYPE_IPV4 0x04 /* IPv4 address */
+#define PCU_IF_ADDR_TYPE_IPV6 0x29 /* IPv6 address */
+
enum gsm_pcu_if_text_type {
PCU_VERSION,
PCU_OML_ALERT,
@@ -164,7 +170,11 @@
uint16_t nsvci[2];
uint16_t local_port[2];
uint16_t remote_port[2];
- uint32_t remote_ip[2];
+ uint8_t address_type[2];
+ union {
+ struct in_addr v4;
+ struct in6_addr v6;
+ } remote_ip[2];
} __attribute__ ((packed));
struct gsm_pcu_if_act_req {
diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index 4e9f7bf..a1a1cfc 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -204,17 +204,25 @@
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++) {
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/20294
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I740be0a401612bb5ed4e8ccd7f4be8176b936449
Gerrit-Change-Number: 20294
Gerrit-PatchSet: 5
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201005/089c73d9/attachment.htm>