Change in osmo-pcu[master]: pcuif_proto: version 0xa: add support for NSVC IPv6 support

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

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Jul 28 11:47:32 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/19419 )


Change subject: pcuif_proto: version 0xa: add support for NSVC IPv6 support
......................................................................

pcuif_proto: version 0xa: add support for NSVC IPv6 support

Introduce a remote_proto to define the given protocol.
IPPROTO is more universal than address_family and is defined by an RFC.
IPPROTO_IPIP is used for IPv4, IPPROTO_IPV6 for IPv6. 0 means unset or
unused entry.

The remote_ip is network byte order, the default encoding for in_addr and in6_addr.

Change-Id: If26958d5b584973dca79159cf9e7f3f266519ce9
---
M include/osmocom/pcu/pcuif_proto.h
M src/pcu_l1_if.cpp
2 files changed, 15 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/19/19419/1

diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h
index e88607e..c5ab8f6 100644
--- a/include/osmocom/pcu/pcuif_proto.h
+++ b/include/osmocom/pcu/pcuif_proto.h
@@ -2,10 +2,11 @@
 #define _PCUIF_PROTO_H
 
 #include <osmocom/gsm/l1sap.h>
+#include <arpa/inet.h>
 
 #define PCU_SOCK_DEFAULT	"/tmp/pcu_bts"
 
-#define PCU_IF_VERSION		0x09
+#define PCU_IF_VERSION		0x0a
 #define TXT_MAX_LEN	128
 
 /* msg_type */
@@ -155,7 +156,13 @@
 	uint16_t	nsvci[2];
 	uint16_t	local_port[2];
 	uint16_t	remote_port[2];
-	uint32_t	remote_ip[2];
+	/* use IP PROTOCOL instead of address_family, because address_family is
+	 * OS dependent. IPIP => v4, IPV6 => v6, 0 => unused */
+	uint8_t		remote_proto[2];
+	union {
+		struct in_addr ipv4;
+		struct in6_addr ipv6;
+	} 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 7fa82fb..8df9156 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -568,11 +568,15 @@
 	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].ipv4.s_addr;
 	LOGP(DL1IF, LOGL_DEBUG, " remote_ip=%s\n", inet_ntoa(ia));
 
+	if (info_ind->remote_proto[0] != IPPROTO_IPIP) {
+		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].ipv4.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/+/19419
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: If26958d5b584973dca79159cf9e7f3f266519ce9
Gerrit-Change-Number: 19419
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200728/133ddcf4/attachment.htm>


More information about the gerrit-log mailing list