Change in osmo-pcu[master]: pcuif_proto: version 10: add support for IPv6 NSVCs

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Mon Sep 21 18:04:44 UTC 2020


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/20238 )

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.

Change-Id: Ia0852f9f4395f1248b39363ef90f6f5673b24e2f
Related: SYS#4915
---
M include/osmocom/pcu/pcuif_proto.h
M src/pcu_l1_if.cpp
2 files changed, 24 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h
index 61c63af..82d761d 100644
--- a/include/osmocom/pcu/pcuif_proto.h
+++ b/include/osmocom/pcu/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/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index c2cc2c1..21eacfd 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -567,11 +567,22 @@
 	LOGP(DL1IF, LOGL_DEBUG, " nsvci=%d\n", info_ind->nsvci[0]);
 	LOGP(DL1IF, LOGL_DEBUG, " local_port=%d\n", info_ind->local_port[0]);
 	LOGP(DL1IF, LOGL_DEBUG, " remote_port=%d\n", info_ind->remote_port[0]);
-	ia.s_addr = htonl(info_ind->remote_ip[0]);
+	ia.s_addr = info_ind->remote_ip[0].v4.s_addr;
 	LOGP(DL1IF, LOGL_DEBUG, " remote_ip=%s\n", inet_ntoa(ia));
 
+	switch (info_ind->address_type[0]) {
+	case PCU_IF_ADDR_TYPE_IPV4:
+		break;
+	case PCU_IF_ADDR_TYPE_IPV6:
+		LOGP(DL1IF, LOGL_ERROR, "This PCU does not support IPv6 NSVC!\n");
+		goto bssgp_failed;
+	default:
+		LOGP(DL1IF, LOGL_ERROR, "No IPv4 NSVC given!\n");
+		goto bssgp_failed;
+	}
+
 	pcu = gprs_bssgp_create_and_connect(bts, info_ind->local_port[0],
-		info_ind->remote_ip[0], info_ind->remote_port[0],
+		ntohl(info_ind->remote_ip[0].v4.s_addr), info_ind->remote_port[0],
 		info_ind->nsei, info_ind->nsvci[0], info_ind->bvci,
 		info_ind->mcc, info_ind->mnc, info_ind->mnc_3_digits, info_ind->lac, info_ind->rac,
 		info_ind->cell_id);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/20238
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ia0852f9f4395f1248b39363ef90f6f5673b24e2f
Gerrit-Change-Number: 20238
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200921/823d0501/attachment.htm>


More information about the gerrit-log mailing list