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.orglynxis lazus has uploaded this change for review. ( 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, 63 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/72/20272/1 diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index da321b0..78909fa 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 14fc80f..cc8e083 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -1255,16 +1255,60 @@ 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 IPPROTO_IPIP: + /* 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 IPPROTO_IPV6: + if (TLVP_LEN(tp, NM_ATT_OSMO_NS_LINK_CFG) < 22) { + /* TODO error message */ + return -1; + } + nsvc->remote.u.sas.ss_family = AF_INET6; + nsvc->local.u.sas.ss_family = AF_INET; + 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; @@ -1501,6 +1545,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..b3124a3 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -326,14 +326,20 @@ info_ind->initial_cs = rlcc->initial_cs; info_ind->initial_mcs = rlcc->initial_mcs; - /* NSVC */ - for (i = 0; i < 2; i++) { + /* NSVC + * TODO: get the second nsvc in static configuration */ + for (i = 0; i < 1; 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; + if (nsvc->remote.u.sas.ss_family == AF_INET) { + info_ind->address_type[i] = IPPROTO_IPIP; + info_ind->remote_ip[i].v4 = nsvc->remote.u.sin.sin_addr; + } else { + info_ind->address_type[i] = IPPROTO_IPV6; + info_ind->remote_ip[i].v6 = nsvc->remote.u.sin6.sin6_addr; + } } 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: 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/20200924/521f1353/attachment.htm>