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-bts/+/20272 )
Change subject: Introduce the new OML NM_ATT_OSMO_NS_LINK_CFG to configure IPv6 NSVC for PCU
......................................................................
Introduce the new OML NM_ATT_OSMO_NS_LINK_CFG to configure IPv6 NSVC for PCU
With PCU interface version 10 it supports IPv6 NSVC. The new OML IE
NM_ATT_OSMO_NS_LINK_CFG allows to configure IPv6 NSVC.
Change-Id: I310699fabbfec4255f0474f31717f215c1201eca
---
M include/osmo-bts/bts.h
M src/common/oml.c
M src/common/pcu_sock.c
3 files changed, 65 insertions(+), 10 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index ccbcf9a..4e496b5 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -2,6 +2,7 @@
#define _BTS_H
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/socket.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/bts_trx.h>
@@ -69,9 +70,8 @@
* via OML from BSC */
int id;
uint16_t nsvci;
- uint16_t local_port; /* on the BTS */
- uint16_t remote_port; /* on the SGSN */
- uint32_t remote_ip; /* on the SGSN */
+ struct osmo_sockaddr local; /* on the BTS */
+ struct osmo_sockaddr remote; /* on the SGSN */
struct gsm_abis_mo mo;
};
diff --git a/src/common/oml.c b/src/common/oml.c
index 9fca008..1f74cac 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1259,16 +1259,59 @@
uint16_t _cur_s;
uint32_t _cur_l;
+ memset(&nsvc->local, 0, sizeof(nsvc->local));
+ memset(&nsvc->remote, 0, sizeof(nsvc->remote));
+
+ nsvc->local.u.sin.sin_family = AF_INET;
+ nsvc->remote.u.sin.sin_family = AF_INET;
+
memcpy(&_cur_s, cur, 2);
- nsvc->remote_port = ntohs(_cur_s);
+ nsvc->remote.u.sin.sin_port = _cur_s;
cur += 2;
memcpy(&_cur_l, cur, 4);
- nsvc->remote_ip = ntohl(_cur_l);
+ nsvc->remote.u.sin.sin_addr.s_addr = _cur_l;
cur += 4;
memcpy(&_cur_s, cur, 2);
- nsvc->local_port = ntohs(_cur_s);
+ nsvc->local.u.sin.sin_port = ntohs(_cur_s);
}
+ if (TLVP_PRES_LEN(tp, NM_ATT_OSMO_NS_LINK_CFG, 10)) {
+ const uint8_t *cur = TLVP_VAL(tp, NM_ATT_OSMO_NS_LINK_CFG);
+ uint16_t address_family;
+
+ memset(&nsvc->local, 0, sizeof(nsvc->local));
+ memset(&nsvc->remote, 0, sizeof(nsvc->remote));
+
+ address_family = osmo_load16be(cur);
+ cur += 2;
+
+ memcpy(&nsvc->local.u.sin.sin_port, cur, 2);
+ cur += 2;
+
+ memcpy(&nsvc->remote.u.sin.sin_port, cur, 2);
+ cur += 2;
+
+ switch (address_family) {
+ case OSMO_NSVC_ADDR_IPV4:
+ /* we already checked for 10 bytes */
+ nsvc->remote.u.sas.ss_family = AF_INET;
+ nsvc->local.u.sas.ss_family = AF_INET;
+ memcpy(&nsvc->remote.u.sin.sin_addr.s_addr, cur, sizeof(in_addr_t));
+ break;
+ case OSMO_NSVC_ADDR_IPV6:
+ if (TLVP_LEN(tp, NM_ATT_OSMO_NS_LINK_CFG) < 22) {
+ return -1;
+ }
+ nsvc->remote.u.sas.ss_family = AF_INET6;
+ nsvc->local.u.sas.ss_family = AF_INET6;
+ memcpy(&nsvc->remote.u.sin6.sin6_addr, cur, sizeof(struct in6_addr));
+ break;
+ default:
+ return -1;
+ }
+ }
+
+
osmo_signal_dispatch(SS_GLOBAL, S_NEW_NSVC_ATTR, nsvc);
return 0;
@@ -1505,6 +1548,7 @@
DEBUGP(DOML, "Initializing OML attribute definitions\n");
tlv_def_patch(&abis_nm_att_tlvdef_ipa_local, &abis_nm_att_tlvdef_ipa);
tlv_def_patch(&abis_nm_att_tlvdef_ipa_local, &abis_nm_att_tlvdef);
+ tlv_def_patch(&abis_nm_att_tlvdef_ipa_local, &abis_nm_osmo_att_tlvdef);
return 0;
}
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index c922584..68cd039 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -330,10 +330,21 @@
for (i = 0; i < 2; i++) {
nsvc = &bts->gprs.nsvc[i];
info_ind->nsvci[i] = nsvc->nsvci;
- info_ind->local_port[i] = nsvc->local_port;
- info_ind->remote_port[i] = nsvc->remote_port;
- info_ind->remote_ip[i].v4.s_addr = htonl(nsvc->remote_ip);
- info_ind->address_type[i] = PCU_IF_ADDR_TYPE_IPV4;
+ info_ind->local_port[i] = nsvc->local.u.sin.sin_port;
+ info_ind->remote_port[i] = nsvc->remote.u.sin.sin_port;
+ 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;
+ break;
+ case AF_INET6:
+ info_ind->address_type[i] = PCU_IF_ADDR_TYPE_IPV6;
+ info_ind->remote_ip[i].v6 = nsvc->remote.u.sin6.sin6_addr;
+ break;
+ default:
+ info_ind->address_type[i] = PCU_IF_ADDR_TYPE_UNSPEC;
+ break;
+ }
}
llist_for_each_entry(trx, &bts->trx_list, list) {
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/20272
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I310699fabbfec4255f0474f31717f215c1201eca
Gerrit-Change-Number: 20272
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201006/7c21585a/attachment.htm>