aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-09-21 18:35:24 +0200
committerlaforge <laforge@osmocom.org>2020-10-05 14:06:26 +0000
commit2f9df96eba22ce1b656cddffbf9c3da675eee5f3 (patch)
tree9eb6e2d6ad2ae5fee7a0433e7637c28478575e18 /src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
parent37474b2b382995a041f2f70366db9767166db4a6 (diff)
oml: encode IPv6 NSVC using the new OML attribute NM_ATT_OSMO_NS_LINK_CFG
The old IE NM_ATT_IPACC_NS_LINK_CFG didn't support IPv6 NSVC. Depends: Ic261bc43a07fa741b97a9c6ec5a9ed6f5ecae588 (libosmocore) Depends: I9e279bb20940c66eea5196f281184cb4f8a5cc5f (libosmocore) Change-Id: I6529876a3c1116a79dd624312243d8ae48a41fe2
Diffstat (limited to 'src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c')
-rw-r--r--src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
index b979cc73d..b7239326c 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
@@ -24,6 +24,7 @@
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/abis_nm.h>
#include <osmocom/bsc/bts.h>
+#include <osmocom/gsm/bts_features.h>
struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts)
{
@@ -202,13 +203,33 @@ struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts)
buf[1] = bts->gprs.nsvc[0].nsvci & 0xff;
msgb_tl16v_put(msgb, NM_ATT_IPACC_NSVCI, 2, buf);
- /* remote udp port */
- osmo_store16be(bts->gprs.nsvc[0].remote_port, &buf[0]);
- /* remote ip address */
- osmo_store32be(bts->gprs.nsvc[0].remote_ip, &buf[2]);
- /* local udp port */
- osmo_store16be(bts->gprs.nsvc[0].local_port, &buf[6]);
- msgb_tl16v_put(msgb, NM_ATT_IPACC_NS_LINK_CFG, 8, buf);
+ switch (bts->gprs.nsvc->remote.u.sa.sa_family) {
+ case AF_INET6:
+ /* all fields are encoded in network byte order */
+ /* protocol family */
+ buf[0] = OSMO_NSVC_ADDR_IPV6;
+ /* padding */
+ buf[1] = 0x00;
+ /* local udp port */
+ osmo_store16be(bts->gprs.nsvc[0].local_port, &buf[2]);
+ /* remote udp port */
+ memcpy(&buf[4], &bts->gprs.nsvc[0].remote.u.sin6.sin6_port, sizeof(uint16_t));
+ /* remote ip address */
+ memcpy(&buf[6], &bts->gprs.nsvc[0].remote.u.sin6.sin6_addr, sizeof(struct in6_addr));
+ msgb_tl16v_put(msgb, NM_ATT_OSMO_NS_LINK_CFG, 6 + sizeof(struct in6_addr), buf);
+ break;
+ case AF_INET:
+ /* remote udp port */
+ memcpy(&buf[0], &bts->gprs.nsvc[0].remote.u.sin.sin_port, sizeof(uint16_t));
+ /* remote ip address */
+ memcpy(&buf[2], &bts->gprs.nsvc[0].remote.u.sin.sin_addr, sizeof(struct in_addr));
+ /* local udp port */
+ osmo_store16be(bts->gprs.nsvc[0].local_port, &buf[6]);
+ msgb_tl16v_put(msgb, NM_ATT_IPACC_NS_LINK_CFG, 8, buf);
+ break;
+ default:
+ break;
+ }
return msgb;
}