mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-02 13:03:33 +00:00
Compare commits
286 Commits
3G_2016_09
...
fairwaves/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd6784dbe8 | ||
|
|
5788904242 | ||
|
|
362a757f56 | ||
|
|
444a9b9304 | ||
|
|
8d8bedff4c | ||
|
|
084a35588f | ||
|
|
03bf40f6a5 | ||
|
|
842e599c5c | ||
|
|
16e9c4a70f | ||
|
|
fdee81b35f | ||
|
|
582242d2f5 | ||
|
|
fb5a18db4b | ||
|
|
8a8703e06c | ||
|
|
d68abba3d0 | ||
|
|
bbd3c7cd46 | ||
|
|
0a2a92a4f5 | ||
|
|
a52726dae8 | ||
|
|
8af593e4e4 | ||
|
|
fb11fc1a7a | ||
|
|
0904c1de19 | ||
|
|
c301ef4ea7 | ||
|
|
59dc70462b | ||
|
|
e7dc282b51 | ||
|
|
45fdb6a728 | ||
|
|
32906636f1 | ||
|
|
b314380065 | ||
|
|
8bb11c90fc | ||
|
|
933de8cb48 | ||
|
|
1bcfaa7119 | ||
|
|
6c079bb981 | ||
|
|
c572ac8733 | ||
|
|
53d1a9186c | ||
|
|
2f749ef103 | ||
|
|
17276417ef | ||
|
|
234f6714a7 | ||
|
|
3e7a48c475 | ||
|
|
9d53708f58 | ||
|
|
da8c96e097 | ||
|
|
d4839fe14a | ||
|
|
db0e216845 | ||
|
|
2d9f39ec43 | ||
|
|
e5e251c396 | ||
|
|
991691f8df | ||
|
|
955d8800e5 | ||
|
|
9a4936a234 | ||
|
|
012c9203e4 | ||
|
|
5087f994fd | ||
|
|
420e4d445c | ||
|
|
a8f56961be | ||
|
|
b2679b822e | ||
|
|
0ce3516a47 | ||
|
|
2b5eb8ddb0 | ||
|
|
fd245fcfa8 | ||
|
|
9f24671589 | ||
|
|
acddb2a632 | ||
|
|
800369d258 | ||
|
|
236d81fa0c | ||
|
|
8e58f575e7 | ||
|
|
da0864dfde | ||
|
|
fc969503e1 | ||
|
|
1e4a954c73 | ||
|
|
2f4878a90f | ||
|
|
70e6f2ec74 | ||
|
|
be9419881c | ||
|
|
a363aa3fc0 | ||
|
|
9cddaeafd5 | ||
|
|
9fe68b0fbc | ||
|
|
1c30463e76 | ||
|
|
bcc2567579 | ||
|
|
924292977f | ||
|
|
a317e334c2 | ||
|
|
76c7cec298 | ||
|
|
c70110945a | ||
|
|
f5fe345dbb | ||
|
|
07a5b120e9 | ||
|
|
dfeabbbff6 | ||
|
|
1371303689 | ||
|
|
f7cb56572a | ||
|
|
014316f514 | ||
|
|
b96f1912da | ||
|
|
adc681331e | ||
|
|
8516d533db | ||
|
|
c6e735fd00 | ||
|
|
cc75a7f014 | ||
|
|
1c33b89886 | ||
|
|
077e62cded | ||
|
|
a78396dcb3 | ||
|
|
e9c81d2581 | ||
|
|
5ba6fb3ef4 | ||
|
|
1013550218 | ||
|
|
17a29ef311 | ||
|
|
2b5fb8ed66 | ||
|
|
4f8da6dfd5 | ||
|
|
48324fed11 | ||
|
|
bcfee2a0a6 | ||
|
|
d09b26d487 | ||
|
|
89837d422e | ||
|
|
22a735bfd4 | ||
|
|
e1f8b9244a | ||
|
|
e02e1e782f | ||
|
|
d675515bd4 | ||
|
|
ba1468e4c6 | ||
|
|
b39053ad6d | ||
|
|
7d17c3ef61 | ||
|
|
35706ddd80 | ||
|
|
26adfd099b | ||
|
|
a5c71bf39a | ||
|
|
150abfffbf | ||
|
|
2d02775b91 | ||
|
|
725f3f1de0 | ||
|
|
dac5867af5 | ||
|
|
3f940fc9ee | ||
|
|
6934a0fa9e | ||
|
|
f188623091 | ||
|
|
42def7205b | ||
|
|
6c4382b998 | ||
|
|
471ac7d99c | ||
|
|
cc7db18e1a | ||
|
|
d0ef1ed78c | ||
|
|
f6e51709fc | ||
|
|
76f048a1fd | ||
|
|
d32b6d13ed | ||
|
|
e610e700da | ||
|
|
881064e9b8 | ||
|
|
47e1781907 | ||
|
|
a5e369300f | ||
|
|
93bafb611a | ||
|
|
59504dc80f | ||
|
|
f5e74b5988 | ||
|
|
b7f41d554b | ||
|
|
34f012639d | ||
|
|
c8fc41c2f6 | ||
|
|
04db87a89f | ||
|
|
3d07aef800 | ||
|
|
98bc7fa50d | ||
|
|
fd161ccce8 | ||
|
|
34be86b93c | ||
|
|
fa9abaca26 | ||
|
|
80abe522e2 | ||
|
|
532480a705 | ||
|
|
db142dc59d | ||
|
|
a191dcd8f0 | ||
|
|
b42dc43e28 | ||
|
|
9fdb4e5f2f | ||
|
|
5fa8b083cc | ||
|
|
549ebc7d6c | ||
|
|
6903848029 | ||
|
|
b735390284 | ||
|
|
59d57da1e5 | ||
|
|
0c32685898 | ||
|
|
ea619f1704 | ||
|
|
ecdfd6d097 | ||
|
|
37f9252361 | ||
|
|
2fa74faf92 | ||
|
|
3cbc052101 | ||
|
|
73ed45599b | ||
|
|
2e109f08c0 | ||
|
|
28786bb209 | ||
|
|
2c1f8c8ceb | ||
|
|
3d6b9f4fe9 | ||
|
|
11ecc9320c | ||
|
|
49012f14dd | ||
|
|
736474ce45 | ||
|
|
ef022783c3 | ||
|
|
eaaee92db5 | ||
|
|
814fef04b0 | ||
|
|
3df5d53a04 | ||
|
|
4f8e34b226 | ||
|
|
08586c68db | ||
|
|
bd33f54444 | ||
|
|
82caa3e9b7 | ||
|
|
688231331b | ||
|
|
3e6768937e | ||
|
|
d53e9b51b6 | ||
|
|
c3b94f92c5 | ||
|
|
1611df5226 | ||
|
|
b8e8d0a402 | ||
|
|
c59e28fa5e | ||
|
|
1cd50585e9 | ||
|
|
4a7d0e79cc | ||
|
|
2327cede9c | ||
|
|
8d35965f24 | ||
|
|
c346f87371 | ||
|
|
8825c69409 | ||
|
|
e14f4b93f2 | ||
|
|
2440f49a72 | ||
|
|
ec16c16193 | ||
|
|
f788d93382 | ||
|
|
2b9c53408f | ||
|
|
ce090f890b | ||
|
|
50669bebdb | ||
|
|
42eb0141d7 | ||
|
|
640b794de0 | ||
|
|
7398395cc0 | ||
|
|
1a60644eb2 | ||
|
|
ea11bf8095 | ||
|
|
06d39fdb72 | ||
|
|
b90eabfb46 | ||
|
|
2c05f75bbf | ||
|
|
e235441f73 | ||
|
|
6a366055dd | ||
|
|
05667a0aff | ||
|
|
ac1f1436e9 | ||
|
|
43273c63de | ||
|
|
eb52aad198 | ||
|
|
143a274051 | ||
|
|
487436138e | ||
|
|
be67050a36 | ||
|
|
3c165d02bb | ||
|
|
54f44ec585 | ||
|
|
18712f0bd1 | ||
|
|
96df077083 | ||
|
|
b0993e61d0 | ||
|
|
7b6bae6584 | ||
|
|
28f637ec2c | ||
|
|
e78ae21ff4 | ||
|
|
2d521a0296 | ||
|
|
27681a3407 | ||
|
|
402006dfdf | ||
|
|
c69ee8527c | ||
|
|
16606c9007 | ||
|
|
5085e0bf4c | ||
|
|
26f6ced05c | ||
|
|
80ccb95267 | ||
|
|
96638d141e | ||
|
|
309425e105 | ||
|
|
38cba5aa79 | ||
|
|
fb89b9b00b | ||
|
|
c04c6ed4af | ||
|
|
7d3093506a | ||
|
|
bb42eee113 | ||
|
|
beade314d0 | ||
|
|
58273f4b88 | ||
|
|
eae68292bd | ||
|
|
fe7be8ddd0 | ||
|
|
c1efa67c13 | ||
|
|
dfe48fdecf | ||
|
|
af9a9b0b44 | ||
|
|
87ef68eb33 | ||
|
|
f926f45c4b | ||
|
|
194b4cb4fd | ||
|
|
b4ecc1d43b | ||
|
|
6bbcfbb78c | ||
|
|
8136e4b9af | ||
|
|
7975ddf0ec | ||
|
|
4579978983 | ||
|
|
46edbc4162 | ||
|
|
686f4d6a85 | ||
|
|
424656e527 | ||
|
|
591e1d7daa | ||
|
|
b748012d31 | ||
|
|
350f93e1e4 | ||
|
|
0c566a444b | ||
|
|
5e5d94cd1b | ||
|
|
d37981e8f7 | ||
|
|
b4cb838092 | ||
|
|
05adbdcb2e | ||
|
|
87c0056480 | ||
|
|
ae9beda150 | ||
|
|
1b76a03cdd | ||
|
|
8c53c59bfb | ||
|
|
582e4f6276 | ||
|
|
fbd96f55fd | ||
|
|
39ae17fb69 | ||
|
|
4c2d4ab5db | ||
|
|
e072da9d2e | ||
|
|
20436c8506 | ||
|
|
30f7310a62 | ||
|
|
3edd0b03d5 | ||
|
|
b6591072d8 | ||
|
|
f1a56dea7b | ||
|
|
1e646f02f4 | ||
|
|
756fb30c8a | ||
|
|
a6ba6a370b | ||
|
|
5275c152e5 | ||
|
|
2d66bb2099 | ||
|
|
63c18ca791 | ||
|
|
3316397921 | ||
|
|
92f552f344 | ||
|
|
38e9ea3f7f | ||
|
|
a8f91df851 | ||
|
|
b81031292b | ||
|
|
ea291e3004 | ||
|
|
0867b72055 | ||
|
|
0a45c1e77d | ||
|
|
aba82097b6 |
@@ -5,64 +5,47 @@ set -ex
|
||||
base="$PWD"
|
||||
deps="$base/deps"
|
||||
inst="$deps/install"
|
||||
export deps inst
|
||||
|
||||
mkdir "$deps" || true
|
||||
rm -rf "$inst"
|
||||
|
||||
build_dep() {
|
||||
project="$1"
|
||||
branch="$2"
|
||||
cfg="$3"
|
||||
set +x
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo " =============================== $project ==============================="
|
||||
echo
|
||||
set -x
|
||||
if [ -z "$project" ]; then
|
||||
echo "internal failure"
|
||||
exit 1
|
||||
fi
|
||||
cd "$deps"
|
||||
rm -rf "$project"
|
||||
osmo-deps.sh "$project"
|
||||
cd "$project"
|
||||
if [ -n "$branch" ]; then
|
||||
git checkout "$branch"
|
||||
fi
|
||||
git rev-parse HEAD
|
||||
autoreconf --install --force
|
||||
./configure --prefix="$inst" $cfg
|
||||
$MAKE $PARALLEL_MAKE install
|
||||
}
|
||||
osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
|
||||
|
||||
build_dep libosmocore "" ac_cv_path_DOXYGEN=false
|
||||
|
||||
# All below builds want this PKG_CONFIG_PATH
|
||||
export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
export LD_LIBRARY_PATH="$inst/lib"
|
||||
|
||||
if [ "x$IU" = "x--enable-iu" ]; then
|
||||
netif_branch="sysmocom/sctp"
|
||||
sccp_branch="sysmocom/iu"
|
||||
fi
|
||||
|
||||
build_dep libosmo-abis
|
||||
build_dep libosmo-netif $netif_branch
|
||||
build_dep libosmo-sccp $sccp_branch
|
||||
PARALLEL_MAKE="" build_dep libsmpp34
|
||||
build_dep openggsn
|
||||
osmo-build-dep.sh libosmo-abis
|
||||
osmo-build-dep.sh libosmo-netif $netif_branch
|
||||
osmo-build-dep.sh libosmo-sccp $sccp_branch
|
||||
PARALLEL_MAKE="" osmo-build-dep.sh libsmpp34
|
||||
osmo-build-dep.sh openggsn
|
||||
|
||||
if [ "x$IU" = "x--enable-iu" ]; then
|
||||
build_dep libasn1c
|
||||
#build_dep asn1c aper-prefix # only needed for make regen in osmo-iuh
|
||||
build_dep osmo-iuh
|
||||
osmo-build-dep.sh libasn1c
|
||||
#osmo-build-dep.sh asn1c aper-prefix # only needed for make regen in osmo-iuh
|
||||
osmo-build-dep.sh osmo-iuh
|
||||
fi
|
||||
|
||||
set +x
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo " =============================== openbsc ==============================="
|
||||
echo
|
||||
set -x
|
||||
|
||||
cd "$base"
|
||||
cd openbsc
|
||||
autoreconf --install --force
|
||||
./configure --enable-osmo-bsc --enable-nat $SMPP $MGCP $IU --enable-vty-tests --enable-external-tests
|
||||
$MAKE $PARALLEL_MAKE
|
||||
LD_LIBRARY_PATH="$inst/lib" $MAKE check
|
||||
LD_LIBRARY_PATH="$inst/lib" $MAKE distcheck
|
||||
LD_LIBRARY_PATH="$inst/lib" $MAKE check \
|
||||
|| cat-testlogs.sh
|
||||
LD_LIBRARY_PATH="$inst/lib" $MAKE distcheck \
|
||||
|| cat-testlogs.sh
|
||||
|
||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,3 +1,9 @@
|
||||
openbsc (0.15.1-fw.1) UNRELEASED; urgency=medium
|
||||
|
||||
* New release of openbsc for fairwaves build.
|
||||
|
||||
-- Ivan Klyuchnikov <kluchnikovi@gmail.com> Tue, 14 Feb 2017 15:12:30 +0200
|
||||
|
||||
openbsc (0.15.1) UNRELEASED; urgency=medium
|
||||
|
||||
* Move forward toward a new release.
|
||||
|
||||
2
debian/compat
vendored
2
debian/compat
vendored
@@ -1 +1 @@
|
||||
7
|
||||
9
|
||||
|
||||
139
debian/control
vendored
139
debian/control
vendored
@@ -1,121 +1,78 @@
|
||||
Source: openbsc
|
||||
Maintainer: Harald Welte <laforge@gnumonks.org>
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Harald Welte <laforge@gnumonks.org>
|
||||
Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev, dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, libssl-dev, libc-ares-dev, libsmpp34-dev
|
||||
Standards-Version: 3.8.4
|
||||
Homepage: http://openbsc.osmocom.org/
|
||||
Build-Depends: debhelper (>= 9),
|
||||
autotools-dev,
|
||||
autoconf-archive,
|
||||
pkg-config,
|
||||
libosmocore-dev,
|
||||
libosmo-sccp-dev,
|
||||
libdbi0-dev,
|
||||
dh-autoreconf,
|
||||
libosmo-abis-dev,
|
||||
libosmo-netif-dev,
|
||||
libdbd-sqlite3,
|
||||
libpcap-dev,
|
||||
libssl-dev,
|
||||
libc-ares-dev,
|
||||
libsmpp34-dev,
|
||||
libosip2-dev,
|
||||
libsofia-sip-ua-dev
|
||||
Standards-Version: 3.9.8
|
||||
Vcs-Git: git://bs11-abis.gnumonks.org/openbsc.git
|
||||
Vcs-Browser: http://openbsc.osmocom.org/trac/browser
|
||||
|
||||
Package: osmocom-bsc
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: GSM Base Station Controller; BSC-only version of OpenBSC. Needs a real MSC!
|
||||
Classical BSC which requires MSC to operate.
|
||||
Homepage: https://projects.osmocom.org/projects/openbsc
|
||||
|
||||
Package: osmocom-nitb
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libdbd-sqlite3
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libdbd-sqlite3
|
||||
Description: GSM Network-in-a-Box, implements BSC, MSC, SMSC, HLR, VLR
|
||||
All the GSM network components bundled together.
|
||||
This is the Network-in-a-Box version of OpenBSC. It has all the GSM network
|
||||
components bundled together. When using osmocom-nitb, there is no need for a
|
||||
Mobile Switching Center (MSC) which is needed when using osmocom-bsc.
|
||||
|
||||
Package: osmocom-ipaccess-utils
|
||||
Package: osmocom-meas-utils
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Command line utilities for ip.access nanoBTS
|
||||
Utilities specific for ip.access unit.
|
||||
|
||||
Package: osmocom-bs11-utils
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Command line utilities for Siemens BS-11 BTS
|
||||
Utilities specific for BS-11 unit.
|
||||
|
||||
Package: osmocom-sgsn
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Osmocom Serving GPRS Support Node
|
||||
SGSN implementation.
|
||||
|
||||
Package: osmocom-gbproxy
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Osmocom GPRS Gb Interface Proxy
|
||||
Proxy for Gb interface.
|
||||
|
||||
Package: osmocom-bsc-nat
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Osmocom Base Station Controller Network Address Translation
|
||||
Network address translation for BSC.
|
||||
|
||||
Package: osmo-gtphub
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Osmocom GTP Hub
|
||||
Proxy for comms between multiple SGSNs and GGSNs.
|
||||
|
||||
Package: osmocom-bsc-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmocom-bsc (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC BSC
|
||||
Make debugging possible
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libcdk5,
|
||||
sqlite3
|
||||
Description: Measurement utilities for the OpenBSC
|
||||
Measurement utilities for the OpenBSC.
|
||||
|
||||
Package: osmocom-nitb-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmocom-nitb (= ${binary:Version}), ${misc:Depends}
|
||||
Depends: osmocom-nitb (= ${binary:Version}),
|
||||
${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC NITB
|
||||
Make debugging possible
|
||||
|
||||
Package: osmocom-ipaccess-utils-dbg
|
||||
Package: osmocom-meas-utils-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmocom-ipaccess-utils (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC ip.access utils
|
||||
Depends: osmocom-meas-utils (= ${binary:Version}),
|
||||
${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC measurement utilities
|
||||
Make debugging possible
|
||||
|
||||
Package: osmocom-bs11-utils-dbg
|
||||
Package: osmocom-proxy
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmocom-bs11-utils (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC BS11 utils
|
||||
Make debugging possible
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: GSM Network-in-a-Box, implements BSC, MSC, SMSC, HLR, VLR
|
||||
reg and ussd proxies
|
||||
|
||||
Package: osmocom-sgsn-dbg
|
||||
Package: osmocom-proxy-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmocom-sgsn (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC Serving GPRS Support Node
|
||||
Make debugging possible
|
||||
|
||||
Package: osmocom-gbproxy-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmocom-gbproxy (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC GPRS GBProxy
|
||||
Make debugging possible
|
||||
|
||||
Package: osmocom-bsc-nat-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmocom-bsc-nat (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC Network Address Translation
|
||||
Make debugging possible
|
||||
|
||||
Package: osmo-gtphub-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmo-gtphub (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Debug symbols for Osmocom GTP Hub
|
||||
Depends: osmocom-nitb (= ${binary:Version}),
|
||||
${misc:Depends}
|
||||
Description: Debug symbols for the OpenBSC Proxies
|
||||
Make debugging possible
|
||||
|
||||
158
debian/copyright
vendored
158
debian/copyright
vendored
@@ -1,47 +1,137 @@
|
||||
This work was packaged for Debian by:
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: OpenBSC
|
||||
Source: http://openbsc.osmocom.org/
|
||||
|
||||
Harald Welte <laforge@gnumonks.org> on Tue, 24 Aug 2010 10:55:04 +0200
|
||||
Files: *
|
||||
Copyright: 2008-2015 Harald Welte <laforge@gnumonks.org>
|
||||
2008-2015 Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
2009-2015 On-Waves
|
||||
2008 Jan Luebbe <jluebbe@debian.org>
|
||||
2008,2010-2011 Daniel Willmann <daniel@totalueberwachung.de>
|
||||
2009,2011,2013 Andreas Eversberg <Andreas.Eversberg@versatel.de>
|
||||
2009,2011 Dieter Spaar <spaar@mirider.augusta.de>
|
||||
2009 Mike Haben <michael.haben@btinternet.com>
|
||||
2010 Sylvain Munaut <246tnt@gmail.com>
|
||||
2012-2013 Pablo Neira Ayuso <pablo@gnumonks.org>
|
||||
2013-2015 Sysmocom s.f.m.c. GmbH (Jacob Erlbeck)
|
||||
2014 Alexander Chemeris <Alexander.Chemeris@fairwaves.co>
|
||||
License: AGPL-3+
|
||||
Comment: Contributions by Stefan Schmidt <stefan@datenfreihafen.org> as well
|
||||
|
||||
It was downloaded from:
|
||||
Files: wireshark/0001-abis_oml.patch
|
||||
wireshark/0002-ericsson_rbs2409.patch
|
||||
wireshark/0003-lucent-hnb.patch
|
||||
wireshark/0005-rsl-hsl.patch
|
||||
Copyright: 1998 Gerald Combs <gerald@wireshark.org>
|
||||
2007,2011 Anders Broman <anders.broman@ericsson.com>
|
||||
2009 Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
2009-2011 Harald Welte <laforge@gnumonks.org>
|
||||
License: GPL-2+
|
||||
|
||||
git://bs11-abis.gnumonks.org/openbsc.git
|
||||
Files: openbsc/include/mISDNif.h
|
||||
Copyright: 2008 Karsten Keil <kkeil@novell.com>
|
||||
License: LGPL-2.1
|
||||
|
||||
Upstream Authors:
|
||||
Files: openbsc/src/libmgcp/g711common.h
|
||||
Copyright: 2009 Abramo Bagnara <abramo@alsa-project.org>
|
||||
License: GPL-2+
|
||||
|
||||
Harald Welte <laforge@gnumonks.org>
|
||||
Dieter Spaar <spaar@mirider.augusta.de>
|
||||
Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
Sylvain Munaut <tnt@246tNt.com>
|
||||
Daniel Willmann <daniel@totalueberwachung.de>
|
||||
Jan Luebbe <jluebbe@debian.org>
|
||||
Mike Haben <michael.haben@btinternet.com>
|
||||
Andreas Eversberg <Andreas.Eversberg@versatel.de>
|
||||
Files: openbsc/git-version-gen
|
||||
Copyright: 2007-2010 Free Software Foundation
|
||||
License: GPL-3+
|
||||
|
||||
Copyright:
|
||||
Files: openbsc/osmoappdesc.py
|
||||
openbsc/tests/smpp_test_runner.py
|
||||
openbsc/tests/ctrl_test_runner.py
|
||||
openbsc/tests/vty_test_runner.py
|
||||
Copyright: 2013 Katerina Barone-Adesi <kat.obsc@gmail.com>
|
||||
2013 Jacob Erlbeck <jerlbeck@sysmocom.de>
|
||||
2013-2014 Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
License: GPL-3+
|
||||
|
||||
Copyright (C) 2008-2010 Harald Welte <laforge@gnumonks.org>
|
||||
Copyright (C) 2008-2009 Dieter Spaar <spaar@mirider.augusta.de>
|
||||
Copyright (C) 2008-2010 Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
Copyright (C) 2009-2010 Sylvain Munaut <tnt@246tNt.com>
|
||||
Copyright (C) 2009-2010 On-Waves
|
||||
Copyright (C) 2008 Daniel Willmann <daniel@totalueberwachung.de>
|
||||
Copyright (C) 2008 Jan Luebbe <jluebbe@debian.org>
|
||||
Copyright (C) 2009 by Mike Haben <michael.haben@btinternet.com>
|
||||
Copyright (C) 2009 Andreas Eversberg <Andreas.Eversberg@versatel.de>
|
||||
Files: openbsc/src/libbsc/bsc_ctrl_lookup.c
|
||||
Copyright: 2010-2011 Daniel Willmann <daniel@totalueberwachung.de>
|
||||
2010-2011 On-Waves
|
||||
License: GPL-2+
|
||||
|
||||
License:
|
||||
Files: openbsc/src/libmsc/mncc_sock.c
|
||||
openbsc/src/libmsc/mncc_builtin.c
|
||||
Copyright: 2008-2010 Harald Welte <laforge@gnumonks.org>
|
||||
2009 Andreas Eversberg <Andreas.Eversberg@versatel.de>
|
||||
2012 Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
License: GPL-2+
|
||||
|
||||
GNU General Public License, Version 2 or later
|
||||
Files: debian/*
|
||||
Copyright: 2012-2015 Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
2016 Ruben Undheim <ruben.undheim@gmail.com>
|
||||
License: GPL-2+
|
||||
|
||||
The Debian packaging is:
|
||||
|
||||
Copyright (C) 2010 Harald Welte <laforge@gnumonks.org>
|
||||
License: AGPL-3+
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please chose a license for your packaging work. If the program you package
|
||||
# uses a mainstream license, using the same license is the safest choice.
|
||||
# Please avoid to pick license terms that are more restrictive than the
|
||||
# packaged work, as it may make Debian's contributions unacceptable upstream.
|
||||
# If you just want it to be GPL version 3, leave the following lines in.
|
||||
|
||||
and is licensed under the GPL version 3,
|
||||
see "/usr/share/common-licenses/GPL-3".
|
||||
License: GPL-2+
|
||||
This package is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or (at
|
||||
your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General Public
|
||||
License version 2 can be found in "/usr/share/common-licenses/GPL-2".
|
||||
|
||||
|
||||
License: GPL-3+
|
||||
This package is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at
|
||||
your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General Public
|
||||
License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
|
||||
|
||||
License: LGPL-2.1
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; version
|
||||
2.1 of the License.
|
||||
.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU Lesser General
|
||||
Public License version 2.1 can be found in
|
||||
"/usr/share/common-licenses/LGPL-2.1".
|
||||
|
||||
3
debian/openbsc-dev.install
vendored
Normal file
3
debian/openbsc-dev.install
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
openbsc/include/openbsc/gsm_data_shared.h usr/src/osmocom/openbsc/openbsc/include/openbsc/
|
||||
openbsc/include/openbsc/common_cs.h usr/src/osmocom/openbsc/openbsc/include/openbsc/
|
||||
openbsc/src/libcommon/gsm_data_shared.c usr/src/osmocom/openbsc/openbsc/src/libcommon/
|
||||
4
debian/osmocom-meas-utils.install
vendored
Normal file
4
debian/osmocom-meas-utils.install
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/usr/bin/osmo-meas-udp2db
|
||||
/usr/bin/osmo-meas-pcap2db
|
||||
/usr/bin/meas_vis
|
||||
/usr/bin/meas_json
|
||||
9
debian/osmocom-proxy.install
vendored
Normal file
9
debian/osmocom-proxy.install
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
usr/bin/reg-proxy
|
||||
etc/sv/reg-proxy
|
||||
etc/service/reg-proxy
|
||||
etc/reg-proxy.config
|
||||
|
||||
usr/bin/ussd-proxy
|
||||
etc/sv/ussd-proxy
|
||||
etc/service/ussd-proxy
|
||||
etc/ussd-proxy.config
|
||||
26
debian/rules
vendored
26
debian/rules
vendored
@@ -1,14 +1,4 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
#
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
#
|
||||
# Modified to make a template file for a multi-binary package with separated
|
||||
# build-arch and build-indep targets by Bill Allombert 2001
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
@@ -17,26 +7,20 @@ DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)
|
||||
DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
|
||||
VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
|
||||
|
||||
export DEB_BUILD_HARDENING=1
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
%:
|
||||
dh --sourcedirectory=openbsc --with autoreconf $@
|
||||
dh $@ --sourcedirectory=openbsc --with autoreconf
|
||||
|
||||
# This is needed for debian stable (squeeze)
|
||||
override_dh_autoreconf:
|
||||
cd openbsc && autoreconf --install --force
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip -posmocom-bsc --dbg-package=osmocom-bsc-dbg
|
||||
dh_strip -posmocom-nitb --dbg-package=osmocom-nitb-dbg
|
||||
dh_strip -posmocom-ipaccess-utils --dbg-package=osmocom-ipaccess-utils-dbg
|
||||
dh_strip -posmocom-bs11-utils --dbg-package=osmocom-bs11-utils-dbg
|
||||
dh_strip -posmocom-sgsn --dbg-package=osmocom-sgsn-dbg
|
||||
dh_strip -posmocom-gbproxy --dbg-package=osmocom-gbproxy-dbg
|
||||
dh_strip -posmocom-bsc-nat --dbg-package=osmocom-bsc-nat-dbg
|
||||
dh_strip -posmo-gtphub --dbg-package=osmo-gtphub-dbg
|
||||
dh_strip -posmocom-meas-utils --dbg-package=osmocom-meas-utils-dbg
|
||||
dh_strip -posmocom-proxy --dbg-package=osmocom-proxy-dbg
|
||||
|
||||
override_dh_auto_configure:
|
||||
echo $(VERSION) > openbsc/.tarball-version
|
||||
dh_auto_configure --sourcedirectory=openbsc -- --enable-nat --enable-osmo-bsc --enable-smpp
|
||||
|
||||
dh_auto_configure --sourcedirectory=openbsc -- --enable-smpp --enable-ussd-proxy
|
||||
|
||||
3
etc/reg-proxy.config
Normal file
3
etc/reg-proxy.config
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
COMMAND_LINE="-S 172.31.0.16 -s 5040 -D 172.31.0.10 -d 5040"
|
||||
1
etc/service/reg-proxy
Symbolic link
1
etc/service/reg-proxy
Symbolic link
@@ -0,0 +1 @@
|
||||
../sv/reg-proxy
|
||||
1
etc/service/ussd-proxy
Symbolic link
1
etc/service/ussd-proxy
Symbolic link
@@ -0,0 +1 @@
|
||||
../sv/ussd-proxy/
|
||||
4
etc/sv/reg-proxy/log/run
Executable file
4
etc/sv/reg-proxy/log/run
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
LOG_FOLDER=/var/log/reg-proxy
|
||||
mkdir -p $LOG_FOLDER
|
||||
exec svlogd -tt $LOG_FOLDER
|
||||
6
etc/sv/reg-proxy/run
Executable file
6
etc/sv/reg-proxy/run
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /etc/reg-proxy.config
|
||||
exec 2>&1
|
||||
echo "reg-proxy restart" | /usr/bin/ts >> /var/log/runsv.log
|
||||
exec reg-proxy $COMMAND_LINE
|
||||
4
etc/sv/ussd-proxy/log/run
Executable file
4
etc/sv/ussd-proxy/log/run
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
LOG_FOLDER=/var/log/ussd-proxy
|
||||
mkdir -p $LOG_FOLDER
|
||||
exec svlogd -tt $LOG_FOLDER
|
||||
6
etc/sv/ussd-proxy/run
Executable file
6
etc/sv/ussd-proxy/run
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /etc/ussd-proxy.config
|
||||
exec 2>&1
|
||||
echo "ussd-proxy restart" | /usr/bin/ts >> /var/log/runsv.log
|
||||
exec ussd-proxy $COMMAND_LINE
|
||||
3
etc/ussd-proxy.config
Normal file
3
etc/ussd-proxy.config
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
COMMAND_LINE="-t sip:172.31.0.6:5060 -u sip:172.31.0.29:5090 -l8"
|
||||
3
openbsc/.gitignore
vendored
3
openbsc/.gitignore
vendored
@@ -55,7 +55,7 @@ src/gprs/osmo-sgsn
|
||||
src/gprs/osmo-gbproxy
|
||||
src/gprs/osmo-gtphub
|
||||
src/osmo-bsc_nat/osmo-bsc_nat
|
||||
src/osmo-cscn/osmo-cscn
|
||||
src/libcommon/gsup_test_client
|
||||
|
||||
#tests
|
||||
tests/testsuite.dir
|
||||
@@ -86,6 +86,7 @@ tests/xid/xid_test
|
||||
tests/sndcp_xid/sndcp_xid_test
|
||||
tests/slhc/slhc_test
|
||||
tests/v42bis/v42bis_test
|
||||
tests/nanobts_omlattr/nanobts_omlattr_test
|
||||
|
||||
tests/atconfig
|
||||
tests/atlocal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6
|
||||
|
||||
## FIXME: automake >= 1.13 or autoconf >= 2.70 provide better suited AC_CONFIG_MACRO_DIRS for configure.ac
|
||||
## remove line below when OE toolchain is updated to version which include those
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AM_CPPFLAGS = \
|
||||
$(all_includes) \
|
||||
-I$(top_srcdir)/include \
|
||||
|
||||
@@ -3,6 +3,9 @@ AC_INIT([openbsc],
|
||||
m4_esyscmd([./git-version-gen .tarball-version]),
|
||||
[openbsc@lists.osmocom.org])
|
||||
|
||||
dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
|
||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||
AC_CONFIG_TESTDIR(tests)
|
||||
|
||||
@@ -15,15 +18,27 @@ AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
|
||||
dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
|
||||
AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
|
||||
if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
|
||||
AC_MSG_WARN([You need to install pkg-config])
|
||||
fi
|
||||
PKG_PROG_PKG_CONFIG([0.20])
|
||||
|
||||
dnl check for AX_CHECK_COMPILE_FLAG
|
||||
m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [
|
||||
AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.])
|
||||
])
|
||||
|
||||
dnl checks for libraries
|
||||
AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
|
||||
AC_SUBST(LIBRARY_DL)
|
||||
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4)
|
||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5)
|
||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
|
||||
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.5)
|
||||
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
|
||||
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
|
||||
@@ -47,7 +62,7 @@ fi
|
||||
AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
|
||||
AC_SUBST(osmo_ac_build_bsc)
|
||||
|
||||
# Enable/disable smpp support in the cscn?
|
||||
# Enable/disable smpp support in the nitb?
|
||||
AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
|
||||
[osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
|
||||
if test "$osmo_ac_build_smpp" = "yes" ; then
|
||||
@@ -130,6 +145,13 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
AC_SUBST(SYMBOL_VISIBILITY)
|
||||
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
|
||||
|
||||
# Coverage build taken from WebKit's configure.in
|
||||
AC_MSG_CHECKING([whether to enable code coverage support])
|
||||
AC_ARG_ENABLE(coverage,
|
||||
@@ -189,6 +211,18 @@ AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
|
||||
AC_MSG_RESULT([$enable_ext_tests])
|
||||
AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
|
||||
|
||||
|
||||
# Enable/disable ussd_proxy utility
|
||||
AC_ARG_ENABLE([ussd_proxy], [AS_HELP_STRING([--enable-ussd-proxy], [Build the USSD MAP SUP to SIP proxy])],
|
||||
[osmo_ac_build_ussd_proxy="$enableval"],[osmo_ac_build_ussd_proxy="no"])
|
||||
if test "$osmo_ac_build_ussd_proxy" = "yes" ; then
|
||||
PKG_CHECK_MODULES(LIBSOFIA_SIP_UA, sofia-sip-ua >= 1.10)
|
||||
AC_DEFINE(BUILD_USSD_PROXY, 1, [Define if we want to build ussd_proxy])
|
||||
fi
|
||||
AM_CONDITIONAL(BUILD_USSD_PROXY, test "x$osmo_ac_build_ussd_proxy" = "xyes")
|
||||
AC_SUBST(osmo_ac_build_smpp)
|
||||
|
||||
|
||||
dnl Generate the output
|
||||
AM_CONFIG_HEADER(bscconfig.h)
|
||||
|
||||
@@ -204,17 +238,18 @@ AC_OUTPUT(
|
||||
src/libcommon/Makefile
|
||||
src/libfilter/Makefile
|
||||
src/libiu/Makefile
|
||||
src/libxsc/Makefile
|
||||
src/osmo-cscn/Makefile
|
||||
src/libcommon-cs/Makefile
|
||||
src/osmo-nitb/Makefile
|
||||
src/osmo-bsc/Makefile
|
||||
src/osmo-bsc_nat/Makefile
|
||||
src/osmo-bsc_mgcp/Makefile
|
||||
src/ipaccess/Makefile
|
||||
src/utils/Makefile
|
||||
src/gprs/Makefile
|
||||
src/reg-proxy/Makefile
|
||||
src/ussd-proxy/Makefile
|
||||
tests/Makefile
|
||||
tests/atlocal
|
||||
tests/libiudummy/Makefile
|
||||
tests/gsm0408/Makefile
|
||||
tests/db/Makefile
|
||||
tests/channel/Makefile
|
||||
@@ -236,6 +271,8 @@ AC_OUTPUT(
|
||||
tests/sndcp_xid/Makefile
|
||||
tests/slhc/Makefile
|
||||
tests/v42bis/Makefile
|
||||
tests/nanobts_omlattr/Makefile
|
||||
tests/ussd/Makefile
|
||||
doc/Makefile
|
||||
doc/examples/Makefile
|
||||
Makefile)
|
||||
|
||||
@@ -1,75 +1,54 @@
|
||||
#!/usr/bin/python
|
||||
# -*- mode: python-mode; py-indent-tabs-mode: nil -*-
|
||||
|
||||
import sys,os, random
|
||||
from optparse import OptionParser
|
||||
from ipa import Ctrl
|
||||
import socket
|
||||
import struct
|
||||
|
||||
verbose = False
|
||||
|
||||
def prefix_ipa_ctrl_header(data):
|
||||
return struct.pack(">HBB", len(data)+1, 0xee, 0) + data
|
||||
|
||||
def ipa_ctrl_header(header):
|
||||
(plen, ipa_proto, osmo_proto) = struct.unpack(">HBB", header)
|
||||
return None if (ipa_proto != 0xee or osmo_proto != 0) else plen
|
||||
|
||||
def remove_ipa_ctrl_header(data):
|
||||
if (len(data) < 4):
|
||||
raise BaseException("Answer too short!")
|
||||
plen = ipa_ctrl_header(data[:4])
|
||||
if (None == plen):
|
||||
raise BaseException("Wrong protocol in answer!")
|
||||
if (plen + 3 > len(data)):
|
||||
print "Warning: Wrong payload length (expected %i, got %i)" % (plen, len(data) - 3)
|
||||
return data[4:plen+3], data[plen+3:]
|
||||
|
||||
def connect(host, port):
|
||||
if verbose:
|
||||
print "Connecting to host %s:%i" % (host, port)
|
||||
if verbose:
|
||||
print "Connecting to host %s:%i" % (host, port)
|
||||
|
||||
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sck.setblocking(1)
|
||||
sck.connect((host, port))
|
||||
return sck
|
||||
|
||||
def send(sck, data):
|
||||
if verbose:
|
||||
print "Sending \"%s\"" %(data)
|
||||
data = prefix_ipa_ctrl_header(data)
|
||||
sck.send(data)
|
||||
|
||||
def do_set(var, value, op_id, sck):
|
||||
setmsg = "SET %s %s %s" %(op_id, var, value)
|
||||
send(sck, setmsg)
|
||||
|
||||
def do_get(var, op_id, sck):
|
||||
getmsg = "GET %s %s" %(op_id, var)
|
||||
send(sck, getmsg)
|
||||
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sck.setblocking(1)
|
||||
sck.connect((host, port))
|
||||
return sck
|
||||
|
||||
def do_set_get(sck, var, value = None):
|
||||
r = random.randint(1, sys.maxint)
|
||||
if (value != None):
|
||||
s = 'SET_REPLY'
|
||||
do_set(var, value, r, sck)
|
||||
else:
|
||||
s = 'GET_REPLY'
|
||||
do_get(var, r, sck)
|
||||
(answer, data) = remove_ipa_ctrl_header(sck.recv(4096))
|
||||
x = answer.split()
|
||||
if (s == x[0] and str(r) == x[1] and var == x[2]):
|
||||
return None if ('SET_REPLY' == s and value != x[3]) else x[3]
|
||||
return None
|
||||
(r, c) = Ctrl().cmd(var, value)
|
||||
sck.send(c)
|
||||
answer = Ctrl().rem_header(sck.recv(4096))
|
||||
return (answer,) + Ctrl().verify(answer, r, var, value)
|
||||
|
||||
def set_var(sck, var, val):
|
||||
return do_set_get(sck, var, val)
|
||||
(a, _, _) = do_set_get(sck, var, val)
|
||||
return a
|
||||
|
||||
def get_var(sck, var):
|
||||
return do_set_get(sck, var)
|
||||
(_, _, v) = do_set_get(sck, var)
|
||||
return v
|
||||
|
||||
def _leftovers(sck, fl):
|
||||
"""
|
||||
Read outstanding data if any according to flags
|
||||
"""
|
||||
try:
|
||||
data = sck.recv(1024, fl)
|
||||
except socket.error as (s_errno, strerror):
|
||||
return False
|
||||
if len(data) != 0:
|
||||
tail = data
|
||||
while True:
|
||||
(head, tail) = Ctrl().split_combined(tail)
|
||||
print "Got message:", Ctrl().rem_header(head)
|
||||
if len(tail) == 0:
|
||||
break
|
||||
return True
|
||||
return False
|
||||
|
||||
if __name__ == '__main__':
|
||||
random.seed()
|
||||
|
||||
parser = OptionParser("Usage: %prog [options] var [value]")
|
||||
parser.add_option("-d", "--host", dest="host",
|
||||
help="connect to HOST", metavar="HOST")
|
||||
@@ -79,8 +58,6 @@ if __name__ == '__main__':
|
||||
dest="cmd_get", help="perform GET operation")
|
||||
parser.add_option("-s", "--set", action="store_true",
|
||||
dest="cmd_set", help="perform SET operation")
|
||||
parser.add_option("-i", "--id", dest="op_id", default=random.randint(1, sys.maxint),
|
||||
help="set id manually", metavar="ID")
|
||||
parser.add_option("-v", "--verbose", action="store_true",
|
||||
dest="verbose", help="be verbose", default=False)
|
||||
parser.add_option("-m", "--monitor", action="store_true",
|
||||
@@ -91,40 +68,32 @@ if __name__ == '__main__':
|
||||
verbose = options.verbose
|
||||
|
||||
if options.cmd_set and options.cmd_get:
|
||||
parser.error("Get and set options are mutually exclusive!")
|
||||
parser.error("Get and set options are mutually exclusive!")
|
||||
|
||||
if not (options.cmd_get or options.cmd_set or options.monitor):
|
||||
parser.error("One of -m, -g, or -s must be set")
|
||||
parser.error("One of -m, -g, or -s must be set")
|
||||
|
||||
if not (options.host):
|
||||
parser.error("Destination host and port required!")
|
||||
parser.error("Destination host and port required!")
|
||||
|
||||
sock = connect(options.host, options.port)
|
||||
|
||||
if options.cmd_set:
|
||||
if len(args) < 2:
|
||||
parser.error("Set requires var and value arguments")
|
||||
do_set(args[0], ' '.join(args[1:]), options.op_id, sock)
|
||||
if len(args) < 2:
|
||||
parser.error("Set requires var and value arguments")
|
||||
_leftovers(sock, socket.MSG_DONTWAIT)
|
||||
print "Got message:", set_var(sock, args[0], ' '.join(args[1:]))
|
||||
|
||||
if options.cmd_get:
|
||||
if len(args) != 1:
|
||||
parser.error("Get requires the var argument")
|
||||
do_get(args[0], options.op_id, sock)
|
||||
|
||||
data = sock.recv(1024)
|
||||
while (len(data)>0):
|
||||
(answer, data) = remove_ipa_ctrl_header(data)
|
||||
print "Got message:", answer
|
||||
if len(args) != 1:
|
||||
parser.error("Get requires the var argument")
|
||||
_leftovers(sock, socket.MSG_DONTWAIT)
|
||||
(a, _, _) = do_set_get(sock, args[0])
|
||||
print "Got message:", a
|
||||
|
||||
if options.monitor:
|
||||
while (True):
|
||||
data = sock.recv(1024)
|
||||
if len(data) == 0:
|
||||
print "Connection is gone."
|
||||
break
|
||||
|
||||
while (len(data)>0):
|
||||
(answer, data) = remove_ipa_ctrl_header(data)
|
||||
print "Got message:", answer
|
||||
|
||||
while True:
|
||||
if not _leftovers(sock, 0):
|
||||
print "Connection is gone."
|
||||
break
|
||||
sock.close()
|
||||
|
||||
278
openbsc/contrib/ipa.py
Executable file
278
openbsc/contrib/ipa.py
Executable file
@@ -0,0 +1,278 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- mode: python-mode; py-indent-tabs-mode: nil -*-
|
||||
"""
|
||||
/*
|
||||
* Copyright (C) 2016 sysmocom s.f.m.c. GmbH
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
"""
|
||||
|
||||
import struct, random, sys
|
||||
|
||||
class IPA(object):
|
||||
"""
|
||||
Stateless IPA protocol multiplexer: add/remove/parse (extended) header
|
||||
"""
|
||||
version = "0.0.5"
|
||||
TCP_PORT_OML = 3002
|
||||
TCP_PORT_RSL = 3003
|
||||
# OpenBSC extensions: OSMO, MGCP_OLD
|
||||
PROTO = dict(RSL=0x00, CCM=0xFE, SCCP=0xFD, OML=0xFF, OSMO=0xEE, MGCP_OLD=0xFC)
|
||||
# ...OML Router Control, GSUP GPRS extension, Osmocom Authn Protocol
|
||||
EXT = dict(CTRL=0, MGCP=1, LAC=2, SMSC=3, ORC=4, GSUP=5, OAP=6)
|
||||
# OpenBSC extension: SCCP_OLD
|
||||
MSGT = dict(PING=0x00, PONG=0x01, ID_GET=0x04, ID_RESP=0x05, ID_ACK=0x06, SCCP_OLD=0xFF)
|
||||
_IDTAG = dict(SERNR=0, UNITNAME=1, LOCATION=2, TYPE=3, EQUIPVERS=4, SWVERSION=5, IPADDR=6, MACADDR=7, UNIT=8)
|
||||
CTRL_GET = 'GET'
|
||||
CTRL_SET = 'SET'
|
||||
CTRL_REP = 'REPLY'
|
||||
CTRL_ERR = 'ERR'
|
||||
CTRL_TRAP = 'TRAP'
|
||||
|
||||
def _l(self, d, p):
|
||||
"""
|
||||
Reverse dictionary lookup: return key for a given value
|
||||
"""
|
||||
if p is None:
|
||||
return 'UNKNOWN'
|
||||
return list(d.keys())[list(d.values()).index(p)]
|
||||
|
||||
def _tag(self, t, v):
|
||||
"""
|
||||
Create TAG as TLV data
|
||||
"""
|
||||
return struct.pack(">HB", len(v) + 1, t) + v
|
||||
|
||||
def proto(self, p):
|
||||
"""
|
||||
Lookup protocol name
|
||||
"""
|
||||
return self._l(self.PROTO, p)
|
||||
|
||||
def ext(self, p):
|
||||
"""
|
||||
Lookup protocol extension name
|
||||
"""
|
||||
return self._l(self.EXT, p)
|
||||
|
||||
def msgt(self, p):
|
||||
"""
|
||||
Lookup message type name
|
||||
"""
|
||||
return self._l(self.MSGT, p)
|
||||
|
||||
def idtag(self, p):
|
||||
"""
|
||||
Lookup ID tag name
|
||||
"""
|
||||
return self._l(self._IDTAG, p)
|
||||
|
||||
def ext_name(self, proto, exten):
|
||||
"""
|
||||
Return proper extension byte name depending on the protocol used
|
||||
"""
|
||||
if self.PROTO['CCM'] == proto:
|
||||
return self.msgt(exten)
|
||||
if self.PROTO['OSMO'] == proto:
|
||||
return self.ext(exten)
|
||||
return None
|
||||
|
||||
def add_header(self, data, proto, ext=None):
|
||||
"""
|
||||
Add IPA header (with extension if necessary), data must be represented as bytes
|
||||
"""
|
||||
if ext is None:
|
||||
return struct.pack(">HB", len(data) + 1, proto) + data
|
||||
return struct.pack(">HBB", len(data) + 1, proto, ext) + data
|
||||
|
||||
def del_header(self, data):
|
||||
"""
|
||||
Strip IPA protocol header correctly removing extension if present
|
||||
Returns data length, IPA protocol, extension (or None if not defined for a give protocol) and the data without header
|
||||
"""
|
||||
if not len(data):
|
||||
return None, None, None, None
|
||||
(dlen, proto) = struct.unpack('>HB', data[:3])
|
||||
if self.PROTO['OSMO'] == proto or self.PROTO['CCM'] == proto: # there's extension which we have to unpack
|
||||
return struct.unpack('>HBB', data[:4]) + (data[4:], ) # length, protocol, extension, data
|
||||
return dlen, proto, None, data[3:] # length, protocol, _, data
|
||||
|
||||
def split_combined(self, data):
|
||||
"""
|
||||
Split the data which contains multiple concatenated IPA messages into tuple (first, rest) where rest contains remaining messages, first is the single IPA message
|
||||
"""
|
||||
(length, _, _, _) = self.del_header(data)
|
||||
return data[:(length + 3)], data[(length + 3):]
|
||||
|
||||
def tag_serial(self, data):
|
||||
"""
|
||||
Make TAG for serial number
|
||||
"""
|
||||
return self._tag(self._IDTAG['SERNR'], data)
|
||||
|
||||
def tag_name(self, data):
|
||||
"""
|
||||
Make TAG for unit name
|
||||
"""
|
||||
return self._tag(self._IDTAG['UNITNAME'], data)
|
||||
|
||||
def tag_loc(self, data):
|
||||
"""
|
||||
Make TAG for location
|
||||
"""
|
||||
return self._tag(self._IDTAG['LOCATION'], data)
|
||||
|
||||
def tag_type(self, data):
|
||||
"""
|
||||
Make TAG for unit type
|
||||
"""
|
||||
return self._tag(self._IDTAG['TYPE'], data)
|
||||
|
||||
def tag_equip(self, data):
|
||||
"""
|
||||
Make TAG for equipment version
|
||||
"""
|
||||
return self._tag(self._IDTAG['EQUIPVERS'], data)
|
||||
|
||||
def tag_sw(self, data):
|
||||
"""
|
||||
Make TAG for software version
|
||||
"""
|
||||
return self._tag(self._IDTAG['SWVERSION'], data)
|
||||
|
||||
def tag_ip(self, data):
|
||||
"""
|
||||
Make TAG for IP address
|
||||
"""
|
||||
return self._tag(self._IDTAG['IPADDR'], data)
|
||||
|
||||
def tag_mac(self, data):
|
||||
"""
|
||||
Make TAG for MAC address
|
||||
"""
|
||||
return self._tag(self._IDTAG['MACADDR'], data)
|
||||
|
||||
def tag_unit(self, data):
|
||||
"""
|
||||
Make TAG for unit ID
|
||||
"""
|
||||
return self._tag(self._IDTAG['UNIT'], data)
|
||||
|
||||
def identity(self, unit=b'', mac=b'', location=b'', utype=b'', equip=b'', sw=b'', name=b'', serial=b''):
|
||||
"""
|
||||
Make IPA IDENTITY tag list, by default returns empty concatenated bytes of tag list
|
||||
"""
|
||||
return self.tag_unit(unit) + self.tag_mac(mac) + self.tag_loc(location) + self.tag_type(utype) + self.tag_equip(equip) + self.tag_sw(sw) + self.tag_name(name) + self.tag_serial(serial)
|
||||
|
||||
def ping(self):
|
||||
"""
|
||||
Make PING message
|
||||
"""
|
||||
return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PING'])
|
||||
|
||||
def pong(self):
|
||||
"""
|
||||
Make PONG message
|
||||
"""
|
||||
return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PONG'])
|
||||
|
||||
def id_ack(self):
|
||||
"""
|
||||
Make ID_ACK CCM message
|
||||
"""
|
||||
return self.add_header(b'', self.PROTO['CCM'], self.MSGT['ID_ACK'])
|
||||
|
||||
def id_get(self):
|
||||
"""
|
||||
Make ID_GET CCM message
|
||||
"""
|
||||
return self.add_header(self.identity(), self.PROTO['CCM'], self.MSGT['ID_GET'])
|
||||
|
||||
def id_resp(self, data):
|
||||
"""
|
||||
Make ID_RESP CCM message
|
||||
"""
|
||||
return self.add_header(data, self.PROTO['CCM'], self.MSGT['ID_RESP'])
|
||||
|
||||
class Ctrl(IPA):
|
||||
"""
|
||||
Osmocom CTRL protocol implemented on top of IPA multiplexer
|
||||
"""
|
||||
def __init__(self):
|
||||
random.seed()
|
||||
|
||||
def add_header(self, data):
|
||||
"""
|
||||
Add CTRL header
|
||||
"""
|
||||
return super(Ctrl, self).add_header(data.encode('utf-8'), IPA.PROTO['OSMO'], IPA.EXT['CTRL'])
|
||||
|
||||
def rem_header(self, data):
|
||||
"""
|
||||
Remove CTRL header, check for appropriate protocol and extension
|
||||
"""
|
||||
(_, proto, ext, d) = super(Ctrl, self).del_header(data)
|
||||
if self.PROTO['OSMO'] != proto or self.EXT['CTRL'] != ext:
|
||||
return None
|
||||
return d
|
||||
|
||||
def parse(self, data, op=None):
|
||||
"""
|
||||
Parse Ctrl string returning (var, value) pair
|
||||
var could be None in case of ERROR message
|
||||
value could be None in case of GET message
|
||||
"""
|
||||
(s, i, v) = data.split(' ', 2)
|
||||
if s == self.CTRL_ERR:
|
||||
return None, v
|
||||
if s == self.CTRL_GET:
|
||||
return v, None
|
||||
(s, i, var, val) = data.split(' ', 3)
|
||||
if s == self.CTRL_TRAP and i != '0':
|
||||
return None, '%s with non-zero id %s' % (s, i)
|
||||
if op is not None and i != op:
|
||||
if s == self.CTRL_GET + '_' + self.CTRL_REP or s == self.CTRL_SET + '_' + self.CTRL_REP:
|
||||
return None, '%s with unexpected id %s' % (s, i)
|
||||
return var, val
|
||||
|
||||
def trap(self, var, val):
|
||||
"""
|
||||
Make TRAP message with given (vak, val) pair
|
||||
"""
|
||||
return self.add_header("%s 0 %s %s" % (self.CTRL_TRAP, var, val))
|
||||
|
||||
def cmd(self, var, val=None):
|
||||
"""
|
||||
Make SET/GET command message: returns (r, m) tuple where r is random operation id and m is assembled message
|
||||
"""
|
||||
r = random.randint(1, sys.maxsize)
|
||||
if val is not None:
|
||||
return r, self.add_header("%s %s %s %s" % (self.CTRL_SET, r, var, val))
|
||||
return r, self.add_header("%s %s %s" % (self.CTRL_GET, r, var))
|
||||
|
||||
def verify(self, reply, r, var, val=None):
|
||||
"""
|
||||
Verify reply to SET/GET command: returns (b, v) tuple where v is True/False verification result and v is the variable value
|
||||
"""
|
||||
(k, v) = self.parse(reply)
|
||||
if k != var or (val is not None and v != val):
|
||||
return False, v
|
||||
return True, v
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("IPA multiplexer v%s loaded." % IPA.version)
|
||||
373
openbsc/contrib/twisted_ipa.py
Executable file
373
openbsc/contrib/twisted_ipa.py
Executable file
@@ -0,0 +1,373 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- mode: python-mode; py-indent-tabs-mode: nil -*-
|
||||
"""
|
||||
/*
|
||||
* Copyright (C) 2016 sysmocom s.f.m.c. GmbH
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
"""
|
||||
|
||||
from ipa import Ctrl, IPA
|
||||
from twisted.internet.protocol import ReconnectingClientFactory
|
||||
from twisted.internet import reactor
|
||||
from twisted.protocols import basic
|
||||
import argparse
|
||||
|
||||
class IPACommon(basic.Int16StringReceiver):
|
||||
"""
|
||||
Generic IPA protocol handler: include some routines for simpler subprotocols.
|
||||
It's not intended as full implementation of all subprotocols, rather common ground and example code.
|
||||
"""
|
||||
def dbg(self, line):
|
||||
"""
|
||||
Debug print helper
|
||||
"""
|
||||
if self.factory.debug:
|
||||
print(line)
|
||||
|
||||
def osmo_CTRL(self, data):
|
||||
"""
|
||||
OSMO CTRL protocol
|
||||
Placeholder, see corresponding derived class
|
||||
"""
|
||||
pass
|
||||
|
||||
def osmo_MGCP(self, data):
|
||||
"""
|
||||
OSMO MGCP extension
|
||||
"""
|
||||
self.dbg('OSMO MGCP received %s' % data)
|
||||
|
||||
def osmo_LAC(self, data):
|
||||
"""
|
||||
OSMO LAC extension
|
||||
"""
|
||||
self.dbg('OSMO LAC received %s' % data)
|
||||
|
||||
def osmo_SMSC(self, data):
|
||||
"""
|
||||
OSMO SMSC extension
|
||||
"""
|
||||
self.dbg('OSMO SMSC received %s' % data)
|
||||
|
||||
def osmo_ORC(self, data):
|
||||
"""
|
||||
OSMO ORC extension
|
||||
"""
|
||||
self.dbg('OSMO ORC received %s' % data)
|
||||
|
||||
def osmo_GSUP(self, data):
|
||||
"""
|
||||
OSMO GSUP extension
|
||||
"""
|
||||
self.dbg('OSMO GSUP received %s' % data)
|
||||
|
||||
def osmo_OAP(self, data):
|
||||
"""
|
||||
OSMO OAP extension
|
||||
"""
|
||||
self.dbg('OSMO OAP received %s' % data)
|
||||
|
||||
def osmo_UNKNOWN(self, data):
|
||||
"""
|
||||
OSMO defaul extension handler
|
||||
"""
|
||||
self.dbg('OSMO unknown extension received %s' % data)
|
||||
|
||||
def handle_RSL(self, data, proto, extension):
|
||||
"""
|
||||
RSL protocol handler
|
||||
"""
|
||||
self.dbg('IPA RSL received message with extension %s' % extension)
|
||||
|
||||
def handle_CCM(self, data, proto, msgt):
|
||||
"""
|
||||
CCM (IPA Connection Management)
|
||||
Placeholder, see corresponding derived class
|
||||
"""
|
||||
pass
|
||||
|
||||
def handle_SCCP(self, data, proto, extension):
|
||||
"""
|
||||
SCCP protocol handler
|
||||
"""
|
||||
self.dbg('IPA SCCP received message with extension %s' % extension)
|
||||
|
||||
def handle_OML(self, data, proto, extension):
|
||||
"""
|
||||
OML protocol handler
|
||||
"""
|
||||
self.dbg('IPA OML received message with extension %s' % extension)
|
||||
|
||||
def handle_OSMO(self, data, proto, extension):
|
||||
"""
|
||||
Dispatcher point for OSMO subprotocols based on extension name, lambda default should never happen
|
||||
"""
|
||||
method = getattr(self, 'osmo_' + IPA().ext(extension), lambda: "extension dispatch failure")
|
||||
method(data)
|
||||
|
||||
def handle_MGCP(self, data, proto, extension):
|
||||
"""
|
||||
MGCP protocol handler
|
||||
"""
|
||||
self.dbg('IPA MGCP received message with attribute %s' % extension)
|
||||
|
||||
def handle_UNKNOWN(self, data, proto, extension):
|
||||
"""
|
||||
Default protocol handler
|
||||
"""
|
||||
self.dbg('IPA received message for %s (%s) protocol with attribute %s' % (IPA().proto(proto), proto, extension))
|
||||
|
||||
def process_chunk(self, data):
|
||||
"""
|
||||
Generic message dispatcher for IPA (sub)protocols based on protocol name, lambda default should never happen
|
||||
"""
|
||||
(_, proto, extension, content) = IPA().del_header(data)
|
||||
if content is not None:
|
||||
self.dbg('IPA received %s::%s [%d/%d] %s' % (IPA().proto(proto), IPA().ext_name(proto, extension), len(data), len(content), content))
|
||||
method = getattr(self, 'handle_' + IPA().proto(proto), lambda: "protocol dispatch failure")
|
||||
method(content, proto, extension)
|
||||
|
||||
def dataReceived(self, data):
|
||||
"""
|
||||
Override for dataReceived from Int16StringReceiver because of inherently incompatible interpretation of length
|
||||
If default handler is used than we would always get off-by-1 error (Int16StringReceiver use equivalent of l + 2)
|
||||
"""
|
||||
if len(data):
|
||||
(head, tail) = IPA().split_combined(data)
|
||||
self.process_chunk(head)
|
||||
self.dataReceived(tail)
|
||||
|
||||
def connectionMade(self):
|
||||
"""
|
||||
We have to resetDelay() here to drop internal state to default values to make reconnection logic work
|
||||
Make sure to call this via super() if overriding to keep reconnection logic intact
|
||||
"""
|
||||
self.dbg('IPA connection made!')
|
||||
self.factory.resetDelay()
|
||||
|
||||
|
||||
class CCM(IPACommon):
|
||||
"""
|
||||
Implementation of CCM protocol for IPA multiplex
|
||||
"""
|
||||
def ack(self):
|
||||
self.transport.write(IPA().id_ack())
|
||||
|
||||
def ping(self):
|
||||
self.transport.write(IPA().ping())
|
||||
|
||||
def pong(self):
|
||||
self.transport.write(IPA().pong())
|
||||
|
||||
def handle_CCM(self, data, proto, msgt):
|
||||
"""
|
||||
CCM (IPA Connection Management)
|
||||
Only basic logic necessary for tests is implemented (ping-pong, id ack etc)
|
||||
"""
|
||||
if msgt == IPA.MSGT['ID_GET']:
|
||||
self.transport.getHandle().sendall(IPA().id_resp(self.factory.ccm_id))
|
||||
# if we call
|
||||
# self.transport.write(IPA().id_resp(self.factory.test_id))
|
||||
# instead, than we would have to also call
|
||||
# reactor.callLater(1, self.ack)
|
||||
# instead of self.ack()
|
||||
# otherwise the writes will be glued together - hence the necessity for ugly hack with 1s timeout
|
||||
# Note: this still might work depending on the IPA implementation details on the other side
|
||||
self.ack()
|
||||
# schedule PING in 4s
|
||||
reactor.callLater(4, self.ping)
|
||||
if msgt == IPA.MSGT['PING']:
|
||||
self.pong()
|
||||
|
||||
|
||||
class CTRL(IPACommon):
|
||||
"""
|
||||
Implementation of Osmocom control protocol for IPA multiplex
|
||||
"""
|
||||
def ctrl_SET(self, data, op_id, v):
|
||||
"""
|
||||
Handle CTRL SET command
|
||||
"""
|
||||
self.dbg('CTRL SET [%s] %s' % (op_id, v))
|
||||
|
||||
def ctrl_SET_REPLY(self, data, op_id, v):
|
||||
"""
|
||||
Handle CTRL SET reply
|
||||
"""
|
||||
self.dbg('CTRL SET REPLY [%s] %s' % (op_id, v))
|
||||
|
||||
def ctrl_GET(self, data, op_id, v):
|
||||
"""
|
||||
Handle CTRL GET command
|
||||
"""
|
||||
self.dbg('CTRL GET [%s] %s' % (op_id, v))
|
||||
|
||||
def ctrl_GET_REPLY(self, data, op_id, v):
|
||||
"""
|
||||
Handle CTRL GET reply
|
||||
"""
|
||||
self.dbg('CTRL GET REPLY [%s] %s' % (op_id, v))
|
||||
|
||||
def ctrl_TRAP(self, data, op_id, v):
|
||||
"""
|
||||
Handle CTRL TRAP command
|
||||
"""
|
||||
self.dbg('CTRL TRAP [%s] %s' % (op_id, v))
|
||||
|
||||
def ctrl_ERROR(self, data, op_id, v):
|
||||
"""
|
||||
Handle CTRL ERROR reply
|
||||
"""
|
||||
self.dbg('CTRL ERROR [%s] %s' % (op_id, v))
|
||||
|
||||
def osmo_CTRL(self, data):
|
||||
"""
|
||||
OSMO CTRL message dispatcher, lambda default should never happen
|
||||
For basic tests only, appropriate handling routines should be replaced: see CtrlServer for example
|
||||
"""
|
||||
self.dbg('OSMO CTRL received %s::%s' % Ctrl().parse(data.decode('utf-8')))
|
||||
(cmd, op_id, v) = data.decode('utf-8').split(' ', 2)
|
||||
method = getattr(self, 'ctrl_' + cmd, lambda: "CTRL unknown command")
|
||||
method(data, op_id, v)
|
||||
|
||||
|
||||
class IPAServer(CCM):
|
||||
"""
|
||||
Test implementation of IPA server
|
||||
Demonstrate CCM opearation by overriding necessary bits from CCM
|
||||
"""
|
||||
def connectionMade(self):
|
||||
"""
|
||||
Keep reconnection logic working by calling routine from CCM
|
||||
Initiate CCM upon connection
|
||||
"""
|
||||
print('IPA server connection made!')
|
||||
super(IPAServer, self).connectionMade()
|
||||
self.transport.write(IPA().id_get())
|
||||
|
||||
|
||||
class CtrlServer(CTRL):
|
||||
"""
|
||||
Test implementation of CTRL server
|
||||
Demonstarte CTRL handling by overriding simpler routines from CTRL
|
||||
"""
|
||||
def connectionMade(self):
|
||||
"""
|
||||
Keep reconnection logic working by calling routine from CTRL
|
||||
Send TRAP upon connection
|
||||
Note: we can't use sendString() because of it's incompatibility with IPA interpretation of length prefix
|
||||
"""
|
||||
print('CTRL server connection made!')
|
||||
super(CtrlServer, self).connectionMade()
|
||||
self.transport.write(Ctrl().trap('LOL', 'what'))
|
||||
self.transport.write(Ctrl().trap('rulez', 'XXX'))
|
||||
|
||||
def reply(self, r):
|
||||
self.transport.write(Ctrl().add_header(r))
|
||||
|
||||
def ctrl_SET(self, data, op_id, v):
|
||||
"""
|
||||
CTRL SET command: always succeed
|
||||
"""
|
||||
print('SET [%s] %s' % (op_id, v))
|
||||
self.reply('SET_REPLY %s %s' % (op_id, v))
|
||||
|
||||
def ctrl_GET(self, data, op_id, v):
|
||||
"""
|
||||
CTRL GET command: always fail
|
||||
"""
|
||||
print('GET [%s] %s' % (op_id, v))
|
||||
self.reply('ERROR %s No variable found' % op_id)
|
||||
|
||||
|
||||
class IPAFactory(ReconnectingClientFactory):
|
||||
"""
|
||||
Generic IPA Client Factory which can be used to store state for various subprotocols and manage connections
|
||||
Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity
|
||||
"""
|
||||
protocol = IPACommon
|
||||
debug = False
|
||||
ccm_id = IPA().identity(unit=b'1515/0/1', mac=b'b0:0b:fa:ce:de:ad:be:ef', utype=b'sysmoBTS', name=b'StingRay', location=b'hell', sw=IPA.version.encode('utf-8'))
|
||||
|
||||
def __init__(self, proto=None, debug=False, ccm_id=None):
|
||||
if proto:
|
||||
self.protocol = proto
|
||||
if debug:
|
||||
self.debug = debug
|
||||
if ccm_id:
|
||||
self.ccm_id = ccm_id
|
||||
|
||||
def clientConnectionFailed(self, connector, reason):
|
||||
"""
|
||||
Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method
|
||||
"""
|
||||
if self.debug:
|
||||
print('IPAFactory connection failed:', reason.getErrorMessage())
|
||||
ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)
|
||||
|
||||
def clientConnectionLost(self, connector, reason):
|
||||
"""
|
||||
Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method
|
||||
"""
|
||||
if self.debug:
|
||||
print('IPAFactory connection lost:', reason.getErrorMessage())
|
||||
ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
p = argparse.ArgumentParser("Twisted IPA (module v%s) app" % IPA.version)
|
||||
p.add_argument('-v', '--version', action='version', version='%(prog)s v0.3')
|
||||
p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface")
|
||||
p.add_argument('-d', '--host', default='localhost', help="Adress to use for CTRL interface")
|
||||
cs = p.add_mutually_exclusive_group()
|
||||
cs.add_argument("-c", "--client", action='store_true', help="asume client role")
|
||||
cs.add_argument("-s", "--server", action='store_true', help="asume server role")
|
||||
ic = p.add_mutually_exclusive_group()
|
||||
ic.add_argument("--ipa", action='store_true', help="use IPA protocol")
|
||||
ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol")
|
||||
args = p.parse_args()
|
||||
test = False
|
||||
if args.ctrl:
|
||||
if args.client:
|
||||
# Start osmo-bsc to receive TRAP messages when osmo-bts-* connects to it
|
||||
print('CTRL client, connecting to %s:%d' % (args.host, args.port))
|
||||
reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, debug=True))
|
||||
test = True
|
||||
if args.server:
|
||||
# Use bsc_control.py to issue set/get commands
|
||||
print('CTRL server, listening on port %d' % args.port)
|
||||
reactor.listenTCP(args.port, IPAFactory(CtrlServer, debug=True))
|
||||
test = True
|
||||
if args.ipa:
|
||||
if args.client:
|
||||
# Start osmo-nitb which would initiate A-bis/IP session
|
||||
print('IPA client, connecting to %s ports %d and %d' % (args.host, IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL))
|
||||
reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, debug=True))
|
||||
reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, debug=True))
|
||||
test = True
|
||||
if args.server:
|
||||
# Start osmo-bts-* which would attempt to connect to us
|
||||
print('IPA server, listening on ports %d and %d' % (IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL))
|
||||
reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, debug=True))
|
||||
reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, debug=True))
|
||||
test = True
|
||||
if test:
|
||||
reactor.run()
|
||||
else:
|
||||
print("Please specify which protocol in which role you'd like to test.")
|
||||
@@ -1,36 +0,0 @@
|
||||
!
|
||||
! OsmoCSCN configuration saved from vty
|
||||
!
|
||||
line vty
|
||||
no login
|
||||
!
|
||||
network
|
||||
network country code 1
|
||||
mobile network code 1
|
||||
short name OsmoCSCN
|
||||
long name OsmoCSCN
|
||||
auth policy closed
|
||||
location updating reject cause 13
|
||||
encryption a5 0
|
||||
rrlp mode none
|
||||
mm info 1
|
||||
handover 0
|
||||
handover window rxlev averaging 10
|
||||
handover window rxqual averaging 1
|
||||
handover window rxlev neighbor averaging 10
|
||||
handover power budget interval 6
|
||||
handover power budget hysteresis 3
|
||||
handover maximum distance 9999
|
||||
timer t3101 10
|
||||
timer t3103 0
|
||||
timer t3105 0
|
||||
timer t3107 0
|
||||
timer t3109 4
|
||||
timer t3111 0
|
||||
timer t3113 60
|
||||
timer t3115 0
|
||||
timer t3117 0
|
||||
timer t3119 0
|
||||
timer t3141 0
|
||||
cscn
|
||||
subscriber-create-on-demand
|
||||
@@ -11,7 +11,10 @@ noinst_HEADERS = \
|
||||
bsc_nat_sccp.h \
|
||||
bsc_rll.h \
|
||||
bss.h \
|
||||
bts_ipaccess_nanobts_omlattr.h \
|
||||
chan_alloc.h \
|
||||
common_bsc.h \
|
||||
common_cs.h \
|
||||
crc24.h \
|
||||
ctrl.h \
|
||||
db.h \
|
||||
@@ -20,7 +23,6 @@ noinst_HEADERS = \
|
||||
gb_proxy.h \
|
||||
gprs_gb_parse.h \
|
||||
gprs_gmm.h \
|
||||
gprs_gsup_client.h \
|
||||
gprs_llc.h \
|
||||
gprs_llc_xid.h \
|
||||
gprs_sgsn.h \
|
||||
@@ -36,26 +38,23 @@ noinst_HEADERS = \
|
||||
gsm_data.h \
|
||||
gsm_data_shared.h \
|
||||
gsm_subscriber.h \
|
||||
gsup_client.h \
|
||||
gtphub.h \
|
||||
handover.h \
|
||||
handover_decision.h \
|
||||
ipaccess.h \
|
||||
iu.h \
|
||||
iucs.h \
|
||||
meas_feed.h \
|
||||
meas_rep.h \
|
||||
mgcp.h \
|
||||
mgcp_internal.h \
|
||||
mgcp_transcode.h \
|
||||
mgcpgw_client.h \
|
||||
misdn.h \
|
||||
mncc.h \
|
||||
mncc_int.h \
|
||||
msc_ifaces.h \
|
||||
nat_rewrite_trie.h \
|
||||
network_listen.h \
|
||||
oap.h \
|
||||
oap_messages.h \
|
||||
oap_client.h \
|
||||
openbscdefines.h \
|
||||
osmo_bsc.h \
|
||||
osmo_bsc_grace.h \
|
||||
@@ -84,7 +83,6 @@ noinst_HEADERS = \
|
||||
vty.h \
|
||||
v42bis.h \
|
||||
v42bis_private.h \
|
||||
xsc.h \
|
||||
$(NULL)
|
||||
|
||||
openbsc_HEADERS = \
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <osmocom/gsm/abis_nm.h>
|
||||
#include <osmocom/gsm/protocol/gsm_12_21.h>
|
||||
|
||||
#include <openbsc/gsm_data.h>
|
||||
|
||||
struct cell_global_id {
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
|
||||
@@ -41,13 +41,6 @@ enum om2k_mo_state {
|
||||
OM2K_MO_S_DISABLED,
|
||||
};
|
||||
|
||||
struct abis_om2k_mo {
|
||||
uint8_t class;
|
||||
uint8_t bts;
|
||||
uint8_t assoc_so;
|
||||
uint8_t inst;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* on-wire format for IS conn group */
|
||||
struct om2k_is_conn_grp {
|
||||
uint16_t icp1;
|
||||
@@ -63,6 +56,39 @@ struct is_conn_group {
|
||||
uint8_t ci;
|
||||
};
|
||||
|
||||
/* on-wire format for CON Path */
|
||||
struct om2k_con_path {
|
||||
uint16_t ccp;
|
||||
uint8_t ci;
|
||||
uint8_t tag;
|
||||
uint8_t tei;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* internal data format for CON group */
|
||||
struct con_group {
|
||||
/* links list of CON groups in BTS */
|
||||
struct llist_head list;
|
||||
struct gsm_bts *bts;
|
||||
/* CON Group ID */
|
||||
uint8_t cg;
|
||||
/* list of CON paths in this group */
|
||||
struct llist_head paths;
|
||||
};
|
||||
|
||||
/* internal data format for CON path */
|
||||
struct con_path {
|
||||
/* links with con_group.paths */
|
||||
struct llist_head list;
|
||||
/* CON Connection Point */
|
||||
uint16_t ccp;
|
||||
/* Contiguity Index */
|
||||
uint8_t ci;
|
||||
/* Tag */
|
||||
uint8_t tag;
|
||||
/* TEI */
|
||||
uint8_t tei;
|
||||
};
|
||||
|
||||
extern const struct abis_om2k_mo om2k_mo_cf;
|
||||
extern const struct abis_om2k_mo om2k_mo_is;
|
||||
extern const struct abis_om2k_mo om2k_mo_con;
|
||||
@@ -84,12 +110,17 @@ int abis_om2k_tx_disable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
|
||||
int abis_om2k_tx_test_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
|
||||
int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
|
||||
uint8_t operational);
|
||||
int abis_om2k_tx_cap_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
|
||||
int abis_om2k_tx_is_conf_req(struct gsm_bts *bts);
|
||||
int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts);
|
||||
int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx);
|
||||
int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx);
|
||||
int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts);
|
||||
|
||||
struct osmo_fsm_inst *om2k_bts_fsm_start(struct gsm_bts *bts);
|
||||
void abis_om2k_bts_init(struct gsm_bts *bts);
|
||||
void abis_om2k_trx_init(struct gsm_bts_trx *trx);
|
||||
|
||||
int abis_om2k_vty_init(void);
|
||||
|
||||
struct vty;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum {
|
||||
enum gsm48_range {
|
||||
ARFCN_RANGE_INVALID = -1,
|
||||
ARFCN_RANGE_128 = 127,
|
||||
ARFCN_RANGE_256 = 255,
|
||||
@@ -14,8 +14,8 @@ enum {
|
||||
#define RANGE_ENC_MAX_ARFCNS 29
|
||||
|
||||
int range_enc_determine_range(const int *arfcns, int size, int *f0_out);
|
||||
int range_enc_arfcns(const int rng, const int *arfcns, int sze, int *out, int idx);
|
||||
int range_enc_find_index(const int rng, const int *arfcns, int size);
|
||||
int range_enc_arfcns(enum gsm48_range rng, const int *arfcns, int sze, int *out, int idx);
|
||||
int range_enc_find_index(enum gsm48_range rng, const int *arfcns, int size);
|
||||
int range_enc_filter_arfcns(int *arfcns, const int sze, const int f0, int *f0_included);
|
||||
|
||||
int range_enc_range128(uint8_t *chan_list, int f0, int *w);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define _AUTH_H
|
||||
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <openbsc/gsm_data.h>
|
||||
|
||||
struct gsm_auth_tuple;
|
||||
struct gsm_subscriber;
|
||||
@@ -20,7 +21,8 @@ static inline const char *auth_action_str(enum auth_action a)
|
||||
return get_value_string(auth_action_names, a);
|
||||
}
|
||||
|
||||
int auth_get_tuple_for_subscr(struct gsm_auth_tuple *atuple,
|
||||
int auth_get_tuple_for_subscr(enum gsm_auth_policy auth_policy,
|
||||
struct gsm_auth_tuple *atuple,
|
||||
struct gsm_subscriber *subscr, int key_seq);
|
||||
|
||||
#endif /* _AUTH_H */
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Media Gateway Control Protocol Media Gateway: RFC 3435 */
|
||||
/* Implementations useful both for the MGCP GW as well as MGCP GW clients */
|
||||
/* OML attribute table generator for ipaccess nanobts */
|
||||
|
||||
/*
|
||||
* (C) 2016 by sysmocom s.m.f.c. GmbH <info@sysmocom.de>
|
||||
/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Author: Philipp Maier
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@@ -17,16 +17,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <openbsc/mgcp.h>
|
||||
#pragma once
|
||||
|
||||
const struct value_string mgcp_connection_mode_strs[] = {
|
||||
{ MGCP_CONN_NONE, "none" },
|
||||
{ MGCP_CONN_RECV_SEND, "sendrecv" },
|
||||
{ MGCP_CONN_SEND_ONLY, "sendonly" },
|
||||
{ MGCP_CONN_RECV_ONLY, "recvonly" },
|
||||
{ MGCP_CONN_LOOPBACK, "loopback" },
|
||||
};
|
||||
#include <stdint.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts);
|
||||
struct msgb *nanobts_attr_nse_get(struct gsm_bts *bts);
|
||||
struct msgb *nanobts_attr_cell_get(struct gsm_bts *bts);
|
||||
struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts);
|
||||
struct msgb *nanobts_attr_radio_get(struct gsm_bts *bts,
|
||||
struct gsm_bts_trx *trx);
|
||||
9
openbsc/include/openbsc/common_bsc.h
Normal file
9
openbsc/include/openbsc/common_bsc.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <openbsc/common_cs.h>
|
||||
|
||||
struct gsm_network *bsc_network_init(void *ctx,
|
||||
uint16_t country_code,
|
||||
uint16_t network_code,
|
||||
mncc_recv_cb_t mncc_recv);
|
||||
@@ -22,6 +22,6 @@ struct gsm_network *gsm_network_init(void *ctx,
|
||||
uint16_t network_code,
|
||||
mncc_recv_cb_t mncc_recv);
|
||||
|
||||
int xsc_vty_init(struct gsm_network *network,
|
||||
int common_cs_vty_init(struct gsm_network *network,
|
||||
int (* config_write_net )(struct vty *));
|
||||
struct gsm_network *gsmnet_from_vty(struct vty *v);
|
||||
@@ -38,7 +38,8 @@ enum {
|
||||
DRANAP,
|
||||
DSUA,
|
||||
DV42BIS,
|
||||
DIUCS,
|
||||
DSUP,
|
||||
DSS,
|
||||
Debug_LastEntry,
|
||||
};
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ struct gbproxy_link_info *gbproxy_update_link_state_ul(
|
||||
struct gbproxy_link_info *gbproxy_update_link_state_dl(
|
||||
struct gbproxy_peer *peer, time_t now,
|
||||
struct gprs_gb_parse_context *parse_ctx);
|
||||
void gbproxy_update_link_state_after(
|
||||
int gbproxy_update_link_state_after(
|
||||
struct gbproxy_peer *peer, struct gbproxy_link_info *link_info,
|
||||
time_t now, struct gprs_gb_parse_context *parse_ctx);
|
||||
int gbproxy_remove_stale_link_infos(struct gbproxy_peer *peer, time_t now);
|
||||
|
||||
@@ -46,6 +46,8 @@ enum gprs_llc_xid_type {
|
||||
GPRS_LLC_XID_T_RESET = 12,
|
||||
};
|
||||
|
||||
extern const struct value_string gprs_llc_xid_type_names[];
|
||||
|
||||
/* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */
|
||||
/* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */
|
||||
enum gprs_llc_primitive {
|
||||
@@ -270,7 +272,7 @@ void gprs_llme_copy_key(struct sgsn_mm_ctx *mm, struct gprs_llc_llme *llme);
|
||||
/* parse a GPRS LLC header, also check for invalid frames */
|
||||
int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
|
||||
uint8_t *llc_hdr, int len);
|
||||
void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph);
|
||||
void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph, struct gprs_llc_lle *lle);
|
||||
int gprs_llc_fcs(uint8_t *data, unsigned int len);
|
||||
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ enum gprs_pmm_state {
|
||||
PMM_DETACHED,
|
||||
PMM_CONNECTED,
|
||||
PMM_IDLE,
|
||||
MM_IDLE = PMM_DETACHED,
|
||||
MM_READY = PMM_CONNECTED,
|
||||
MM_STANDBY = PMM_IDLE,
|
||||
MM_IDLE,
|
||||
MM_READY,
|
||||
MM_STANDBY,
|
||||
};
|
||||
|
||||
enum gprs_mm_ctr {
|
||||
@@ -126,7 +126,7 @@ struct sgsn_mm_ctx {
|
||||
enum sgsn_ran_type ran_type;
|
||||
|
||||
char imsi[GSM23003_IMSI_MAX_DIGITS+1];
|
||||
enum gprs_gmm_state mm_state;
|
||||
enum gprs_gmm_state gmm_state;
|
||||
enum gprs_pmm_state pmm_state; /* Iu: page when in PMM-IDLE mode */
|
||||
uint32_t p_tmsi;
|
||||
uint32_t p_tmsi_old; /* old P-TMSI before new is confirmed */
|
||||
@@ -244,7 +244,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli_and_ptmsi(uint32_t tlli,
|
||||
const struct gprs_ra_id *raid);
|
||||
|
||||
/* Allocate a new SGSN MM context */
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli,
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_gb(uint32_t tlli,
|
||||
const struct gprs_ra_id *raid);
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx);
|
||||
|
||||
@@ -295,12 +295,7 @@ struct sgsn_pdp_ctx {
|
||||
//uint32_t qos_profile_req;
|
||||
//uint32_t qos_profile_neg;
|
||||
uint8_t radio_prio;
|
||||
uint32_t tx_npdu_nr;
|
||||
uint32_t rx_npdu_nr;
|
||||
uint32_t tx_gtp_snd;
|
||||
uint32_t rx_gtp_snu;
|
||||
//uint32_t charging_id;
|
||||
int reordering_reqd;
|
||||
|
||||
struct osmo_timer_list timer;
|
||||
unsigned int T; /* Txxxx number */
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <stdint.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
|
||||
#define CURRENT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */
|
||||
#define DEFAULT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */
|
||||
#define MAX_ENTITIES 32 /* 3GPP TS 44.065 reserves 5 bit
|
||||
* for compression enitity number */
|
||||
|
||||
@@ -197,13 +197,15 @@ enum gprs_sndcp_dcomp_v44_dcomp {
|
||||
|
||||
/* Transform a list with compression fields into an SNDCP-XID message (dst) */
|
||||
int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen,
|
||||
const struct llist_head *comp_fields);
|
||||
const struct llist_head *comp_fields, int version);
|
||||
|
||||
/* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */
|
||||
struct llist_head *gprs_sndcp_parse_xid(const void *ctx,
|
||||
const uint8_t * src,
|
||||
unsigned int src_len,
|
||||
const struct llist_head *comp_fields_req);
|
||||
struct llist_head *gprs_sndcp_parse_xid(int *version,
|
||||
const void *ctx,
|
||||
const uint8_t *src,
|
||||
unsigned int src_len,
|
||||
const struct llist_head
|
||||
*comp_fields_req);
|
||||
|
||||
/* Find out to which compression class the specified comp-field belongs
|
||||
* (header compression or data compression?) */
|
||||
|
||||
@@ -53,7 +53,8 @@ int get_reason_by_chreq(uint8_t ra, int neci);
|
||||
void gsm_net_update_ctype(struct gsm_network *net);
|
||||
|
||||
int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn);
|
||||
int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, int key_seq);
|
||||
int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand,
|
||||
uint8_t *autn, int key_seq);
|
||||
int gsm48_tx_mm_auth_rej(struct gsm_subscriber_connection *conn);
|
||||
int gsm48_tx_mm_serv_ack(struct gsm_subscriber_connection *conn);
|
||||
int gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
|
||||
@@ -77,8 +78,6 @@ int decode_bcd_number(char *output, int output_len, const uint8_t *bcd_lv,
|
||||
int send_siemens_mrpci(struct gsm_lchan *lchan, uint8_t *classmark2_lv);
|
||||
int gsm48_extract_mi(uint8_t *classmark2, int length, char *mi_string, uint8_t *mi_type);
|
||||
int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, uint8_t *mi_type);
|
||||
|
||||
/* TODO MSCSPLIT remove gsm48_handle_paging_resp() */
|
||||
int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, struct msgb *msg, struct gsm_subscriber *subscr);
|
||||
|
||||
int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode);
|
||||
@@ -95,4 +94,8 @@ void allocate_security_operation(struct gsm_subscriber_connection *conn);
|
||||
|
||||
int gsm48_multirate_config(uint8_t *lv, struct amr_multirate_conf *mr, struct amr_mode *modes);
|
||||
|
||||
int gsm0408_authorize(struct gsm_subscriber_connection *conn, struct msgb *msg);
|
||||
int gsm0408_loc_upd_rej(struct gsm_subscriber_connection *conn, uint8_t cause);
|
||||
void release_loc_updating_req(struct gsm_subscriber_connection *conn, int release);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,5 +38,8 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn,
|
||||
struct gsm_sms *sms);
|
||||
void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn);
|
||||
|
||||
int gsm411_send_rp_msg_subscr(struct gsm_subscriber *subscr,
|
||||
struct msgb *rp);
|
||||
|
||||
uint8_t sms_next_rp_msg_ref(uint8_t *next_rp_ref);
|
||||
#endif
|
||||
|
||||
@@ -7,23 +7,24 @@
|
||||
|
||||
struct gsm_subscriber_connection;
|
||||
|
||||
int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
|
||||
const struct msgb *in_msg, const char* response_text,
|
||||
const struct ussd_request *req);
|
||||
int gsm0480_send_component(struct gsm_subscriber_connection *conn,
|
||||
struct msgb *msg,
|
||||
struct ss_header* reqhdr);
|
||||
|
||||
int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
|
||||
const struct msgb *msg,
|
||||
const struct ussd_request *request);
|
||||
uint8_t invoke_id,
|
||||
uint8_t transaction_id);
|
||||
|
||||
struct msgb *gsm0480_gen_ussdNotify(int level, const char *text);
|
||||
struct msgb *gsm0480_gen_releaseComplete(void);
|
||||
struct msgb *gsm0480_compose_ussd_component(struct ss_request* req);
|
||||
|
||||
int msc_gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn,
|
||||
int level, const char *text);
|
||||
int msc_gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn);
|
||||
|
||||
/* TODO: move to a bsc_*.h file? */
|
||||
int bsc_gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn,
|
||||
int level, const char *text);
|
||||
int bsc_gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn);
|
||||
|
||||
int msc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level,
|
||||
const char *text);
|
||||
int msc_send_ussd_release_complete(struct gsm_subscriber_connection *conn);
|
||||
|
||||
int bsc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level,
|
||||
const char *text);
|
||||
int bsc_send_ussd_release_complete(struct gsm_subscriber_connection *conn);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include <osmocom/crypt/auth.h>
|
||||
|
||||
#include <openbsc/rest_octets.h>
|
||||
#include <openbsc/xsc.h>
|
||||
#include <openbsc/mgcpgw_client.h>
|
||||
#include <openbsc/common_cs.h>
|
||||
#include <openbsc/gsup_client.h>
|
||||
|
||||
/** annotations for msgb ownership */
|
||||
#define __uses
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
struct mncc_sock_state;
|
||||
struct gsm_subscriber_group;
|
||||
struct ue_conn_ctx;
|
||||
|
||||
#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
|
||||
|
||||
@@ -72,6 +71,7 @@ struct gsm_loc_updating_operation {
|
||||
struct osmo_timer_list updating_timer;
|
||||
unsigned int waiting_for_imsi : 1;
|
||||
unsigned int waiting_for_imei : 1;
|
||||
unsigned int waiting_for_remote_accept : 1;
|
||||
unsigned int key_seq : 4;
|
||||
};
|
||||
|
||||
@@ -106,18 +106,6 @@ struct neigh_meas_proc {
|
||||
uint8_t last_seen_nr;
|
||||
};
|
||||
|
||||
enum interface_type {
|
||||
IFACE_UNKNOWN = -1,
|
||||
IFACE_A = 0, /* A-interface for 2G */
|
||||
IFACE_IU = 1 /* Iu-interface for UMTS aka 3G (IuCS or IuPS) */
|
||||
};
|
||||
|
||||
enum integrity_protection_state {
|
||||
INTEGRITY_PROTECTION_NONE = 0,
|
||||
INTEGRITY_PROTECTION_IK = 1,
|
||||
INTEGRITY_PROTECTION_IK_CK = 2,
|
||||
};
|
||||
|
||||
/* active radio connection of a mobile subscriber */
|
||||
struct gsm_subscriber_connection {
|
||||
struct llist_head entry;
|
||||
@@ -160,21 +148,6 @@ struct gsm_subscriber_connection {
|
||||
struct osmo_timer_list T10; /* BSC */
|
||||
struct gsm_lchan *secondary_lchan; /* BSC */
|
||||
|
||||
uint16_t lac;
|
||||
struct gsm_encr encr;
|
||||
|
||||
/* 2G or 3G? See enum interface_type */
|
||||
int via_iface;
|
||||
|
||||
/* which Iu-CS connection, if any. */
|
||||
struct {
|
||||
struct ue_conn_ctx *ue_ctx;
|
||||
int integrity_protection;
|
||||
unsigned int mgcp_rtp_endpoint;
|
||||
uint16_t mgcp_rtp_port_ue;
|
||||
uint16_t mgcp_rtp_port_cn;
|
||||
uint8_t rab_id;
|
||||
} iu;
|
||||
};
|
||||
|
||||
|
||||
@@ -198,6 +171,11 @@ enum {
|
||||
BSC_CTR_CHAN_RLL_ERR,
|
||||
BSC_CTR_BTS_OML_FAIL,
|
||||
BSC_CTR_BTS_RSL_FAIL,
|
||||
BSC_CTR_CODEC_AMR_F,
|
||||
BSC_CTR_CODEC_AMR_H,
|
||||
BSC_CTR_CODEC_EFR,
|
||||
BSC_CTR_CODEC_V1_FR,
|
||||
BSC_CTR_CODEC_V1_HR,
|
||||
};
|
||||
|
||||
static const struct rate_ctr_desc bsc_ctr_description[] = {
|
||||
@@ -216,6 +194,11 @@ static const struct rate_ctr_desc bsc_ctr_description[] = {
|
||||
[BSC_CTR_CHAN_RLL_ERR] = {"chan.rll_err", "Received a RLL failure with T200 cause from BTS."},
|
||||
[BSC_CTR_BTS_OML_FAIL] = {"bts.oml_fail", "Received a TEI down on a OML link."},
|
||||
[BSC_CTR_BTS_RSL_FAIL] = {"bts.rsl_fail", "Received a TEI down on a OML link."},
|
||||
[BSC_CTR_CODEC_AMR_F] = {"bts.codec_amr_f", "Count the usage of AMR/F codec by channel mode requested."},
|
||||
[BSC_CTR_CODEC_AMR_H] = {"bts.codec_amr_h", "Count the usage of AMR/H codec by channel mode requested."},
|
||||
[BSC_CTR_CODEC_EFR] = {"bts.codec_efr", "Count the usage of EFR codec by channel mode requested."},
|
||||
[BSC_CTR_CODEC_V1_FR] = {"bts.codec_fr", "Count the usage of FR codec by channel mode requested."},
|
||||
[BSC_CTR_CODEC_V1_HR] = {"bts.codec_hr", "Count the usage of HR codec by channel mode requested."},
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -223,8 +206,8 @@ enum {
|
||||
MSC_CTR_LOC_UPDATE_TYPE_NORMAL,
|
||||
MSC_CTR_LOC_UPDATE_TYPE_PERIODIC,
|
||||
MSC_CTR_LOC_UPDATE_TYPE_DETACH,
|
||||
MSC_CTR_LOC_UPDATE_FAILED,
|
||||
MSC_CTR_LOC_UPDATE_COMPLETED,
|
||||
MSC_CTR_LOC_UPDATE_RESP_REJECT,
|
||||
MSC_CTR_LOC_UPDATE_RESP_ACCEPT,
|
||||
MSC_CTR_SMS_SUBMITTED,
|
||||
MSC_CTR_SMS_NO_RECEIVER,
|
||||
MSC_CTR_SMS_DELIVERED,
|
||||
@@ -235,6 +218,9 @@ enum {
|
||||
MSC_CTR_CALL_MO_CONNECT_ACK,
|
||||
MSC_CTR_CALL_MT_SETUP,
|
||||
MSC_CTR_CALL_MT_CONNECT,
|
||||
MSC_CTR_CALL_ACTIVE,
|
||||
MSC_CTR_CALL_COMPLETE,
|
||||
MSC_CTR_CALL_INCOMPLETE,
|
||||
};
|
||||
|
||||
static const struct rate_ctr_desc msc_ctr_description[] = {
|
||||
@@ -242,8 +228,8 @@ static const struct rate_ctr_desc msc_ctr_description[] = {
|
||||
[MSC_CTR_LOC_UPDATE_TYPE_NORMAL] = {"loc_update_type.normal", "Received location update normal requests."},
|
||||
[MSC_CTR_LOC_UPDATE_TYPE_PERIODIC] = {"loc_update_type.periodic", "Received location update periodic requests."},
|
||||
[MSC_CTR_LOC_UPDATE_TYPE_DETACH] = {"loc_update_type.detach", "Received location update detach indication."},
|
||||
[MSC_CTR_LOC_UPDATE_FAILED] = {"loc_update_resp.failed", "Rejected location updates."},
|
||||
[MSC_CTR_LOC_UPDATE_COMPLETED] = {"loc_update_resp.completed", "Successful location updates."},
|
||||
[MSC_CTR_LOC_UPDATE_RESP_REJECT] = {"loc_update_resp.reject", "Sent location update reject responses."},
|
||||
[MSC_CTR_LOC_UPDATE_RESP_ACCEPT] = {"loc_update_resp.accept", "Sent location update accept responses."},
|
||||
[MSC_CTR_SMS_SUBMITTED] = {"sms.submitted", "Received a RPDU from a MS (MO)."},
|
||||
[MSC_CTR_SMS_NO_RECEIVER] = {"sms.no_receiver", "Counts SMS which couldn't routed because no receiver found."},
|
||||
[MSC_CTR_SMS_DELIVERED] = {"sms.delivered", "Global SMS Deliver attempts."},
|
||||
@@ -255,6 +241,9 @@ static const struct rate_ctr_desc msc_ctr_description[] = {
|
||||
[MSC_CTR_CALL_MO_CONNECT_ACK] = {"call.mo_connect_ack", "Received a connect ack from MS of a MO call. Call is now succesful connected up."},
|
||||
[MSC_CTR_CALL_MT_SETUP] = {"call.mt_setup", "Sent setup requests to the MS (MT)."},
|
||||
[MSC_CTR_CALL_MT_CONNECT] = {"call.mt_connect", "Sent a connect to the MS (MT)."},
|
||||
[MSC_CTR_CALL_ACTIVE] = {"call.active", "Count total amount of calls that ever reached active state."},
|
||||
[MSC_CTR_CALL_COMPLETE] = {"call.complete", "Count total amount of calls which got terminated by disconnect req or ind after reaching active state."},
|
||||
[MSC_CTR_CALL_INCOMPLETE] = {"call.incomplete", "Count total amount of call which got terminated by any other reason after reaching active state."},
|
||||
};
|
||||
|
||||
|
||||
@@ -279,6 +268,8 @@ enum gsm_auth_policy {
|
||||
GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized in DB */
|
||||
GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke authorization */
|
||||
GSM_AUTH_POLICY_REGEXP, /* accept IMSIs matching given regexp */
|
||||
GSM_AUTH_POLICY_REMOTE,
|
||||
GSM_AUTH_POLICY_REMOTE_CLOSED
|
||||
};
|
||||
|
||||
#define GSM_T3101_DEFAULT 10
|
||||
@@ -294,12 +285,6 @@ struct gsm_tz {
|
||||
};
|
||||
|
||||
struct gsm_network {
|
||||
/* TODO MSCSPLIT the gsm_network struct is basically a kitchen sink for
|
||||
* global settings and variables, "madly" mixing BSC and MSC stuff. Split
|
||||
* this in e.g. struct osmo_bsc and struct osmo_msc, with the things
|
||||
* these have in common, like country and network code, put in yet
|
||||
* separate structs and placed as members in osmo_bsc and osmo_msc. */
|
||||
|
||||
/* global parameters */
|
||||
uint16_t country_code;
|
||||
uint16_t network_code;
|
||||
@@ -331,7 +316,7 @@ struct gsm_network {
|
||||
|
||||
struct rate_ctr_group *bsc_ctrs;
|
||||
struct rate_ctr_group *msc_ctrs;
|
||||
|
||||
struct osmo_counter *active_calls;
|
||||
|
||||
/* layer 4 */
|
||||
struct mncc_sock_state *mncc_state;
|
||||
@@ -339,6 +324,9 @@ struct gsm_network {
|
||||
struct llist_head upqueue;
|
||||
struct llist_head trans_list;
|
||||
struct bsc_api *bsc_api;
|
||||
struct gsup_client *hlr_sup_client;
|
||||
struct gsup_client *ussd_sup_client;
|
||||
struct gsup_client *sms_client;
|
||||
|
||||
unsigned int num_bts;
|
||||
struct llist_head bts_list;
|
||||
@@ -400,14 +388,6 @@ struct gsm_network {
|
||||
* BTS|RNC specific timezone overrides for multi-tz networks in
|
||||
* OsmoCSCN, this should be tied to the location area code (LAC). */
|
||||
struct gsm_tz tz;
|
||||
|
||||
/* Periodic location update default value */
|
||||
uint8_t t3212;
|
||||
|
||||
struct {
|
||||
struct mgcpgw_client_conf conf;
|
||||
struct mgcpgw_client *client;
|
||||
} mgcpgw;
|
||||
};
|
||||
|
||||
struct osmo_esme;
|
||||
@@ -458,6 +438,10 @@ extern void talloc_ctx_init(void *ctx_root);
|
||||
|
||||
int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
|
||||
|
||||
/* Get reference to a neighbor cell on a given BCCH ARFCN */
|
||||
struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts,
|
||||
uint16_t arfcn, uint8_t bsic);
|
||||
|
||||
enum gsm_bts_type parse_btstype(const char *arg);
|
||||
const char *btstype2str(enum gsm_bts_type type);
|
||||
struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
|
||||
@@ -540,6 +524,7 @@ int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode);
|
||||
|
||||
int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts);
|
||||
void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
|
||||
struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
|
||||
|
||||
int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
|
||||
int gsm_bts_model_register(struct gsm_bts_model *model);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <osmocom/gsm/lapdm.h>
|
||||
#endif
|
||||
|
||||
#include <openbsc/xsc.h>
|
||||
#include <openbsc/common_cs.h>
|
||||
|
||||
struct osmo_bsc_data;
|
||||
|
||||
@@ -48,6 +48,10 @@ enum gsm_chreq_reason_t {
|
||||
GSM_CHREQ_REASON_OTHER,
|
||||
};
|
||||
|
||||
/* lchans 0..3 are SDCCH in combined channel configuration,
|
||||
use 4 as magic number for BCCH hack - see osmo-bts-../oml.c:opstart_compl() */
|
||||
#define CCCH_LCHAN 4
|
||||
|
||||
#define TRX_NR_TS 8
|
||||
#define TS_MAX_LCHAN 8
|
||||
|
||||
@@ -102,6 +106,19 @@ struct gsm_abis_mo {
|
||||
struct gsm_bts *bts;
|
||||
};
|
||||
|
||||
/* Ericsson OM2000 Managed Object */
|
||||
struct abis_om2k_mo {
|
||||
uint8_t class;
|
||||
uint8_t bts;
|
||||
uint8_t assoc_so;
|
||||
uint8_t inst;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct om2k_mo {
|
||||
struct abis_om2k_mo addr;
|
||||
struct osmo_fsm_inst *fsm;
|
||||
};
|
||||
|
||||
#define A38_XOR_MIN_KEY_LEN 12
|
||||
#define A38_XOR_MAX_KEY_LEN 16
|
||||
#define A38_COMP128_KEY_LEN 16
|
||||
@@ -292,18 +309,23 @@ struct gsm_lchan {
|
||||
struct {
|
||||
struct amr_multirate_conf amr_mr;
|
||||
struct {
|
||||
uint8_t buf[16];
|
||||
struct osmo_fsm_inst *dl_amr_fsm;
|
||||
/* TCH cache */
|
||||
uint8_t cache[20];
|
||||
/* FACCH cache */
|
||||
uint8_t facch[GSM_MACBLOCK_LEN];
|
||||
uint8_t len;
|
||||
uint32_t fn;
|
||||
bool is_update;
|
||||
} last_sid;
|
||||
/* set for each SID frame to detect talkspurt for codecs without
|
||||
explicit ONSET event */
|
||||
bool ul_sid;
|
||||
/* set for each SID frame to detect talkspurt for codecs
|
||||
without explicit ONSET event */
|
||||
bool ul_sid;
|
||||
/* indicates if DTXd was active during DL measurement
|
||||
period */
|
||||
bool dl_active;
|
||||
} dtx;
|
||||
uint8_t last_cmr;
|
||||
uint32_t last_fn;
|
||||
/* indicates if DTXd was active during DL measurement period */
|
||||
bool dtxd_active;
|
||||
} tch;
|
||||
/* BTS-side ciphering state (rx only, bi-directional, ...) */
|
||||
uint8_t ciph_state;
|
||||
@@ -328,6 +350,8 @@ struct gsm_lchan {
|
||||
uint8_t current;
|
||||
uint8_t fixed;
|
||||
} ms_power_ctrl;
|
||||
|
||||
struct msgb *pending_rel_ind_msg;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -375,6 +399,12 @@ struct gsm_bts_trx_ts {
|
||||
/* To which E1 subslot are we connected */
|
||||
struct gsm_e1_subslot e1_link;
|
||||
|
||||
union {
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
} rbs2000;
|
||||
};
|
||||
|
||||
struct gsm_lchan lchan[TS_MAX_LCHAN];
|
||||
};
|
||||
|
||||
@@ -429,6 +459,17 @@ struct gsm_bts_trx {
|
||||
uint8_t test_nr;
|
||||
struct rxlev_stats rxlev_stat;
|
||||
} ipaccess;
|
||||
struct {
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
} trxc;
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
} rx;
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
} tx;
|
||||
} rbs2000;
|
||||
};
|
||||
struct gsm_bts_trx_ts ts[TRX_NR_TS];
|
||||
};
|
||||
@@ -659,17 +700,26 @@ struct gsm_bts {
|
||||
} bs11;
|
||||
struct {
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
struct gsm_abis_mo mo;
|
||||
struct llist_head conn_groups;
|
||||
} cf;
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
struct gsm_abis_mo mo;
|
||||
struct llist_head conn_groups;
|
||||
} is;
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
struct gsm_abis_mo mo;
|
||||
struct llist_head conn_groups;
|
||||
} con;
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
struct gsm_abis_mo mo;
|
||||
} dp;
|
||||
struct {
|
||||
struct om2k_mo om2k_mo;
|
||||
struct gsm_abis_mo mo;
|
||||
} tf;
|
||||
} rbs2000;
|
||||
@@ -755,6 +805,7 @@ struct gsm_bts {
|
||||
uint16_t scramble_list[MAX_EARFCN_LIST];
|
||||
} data;
|
||||
} si_common;
|
||||
bool early_classmark_allowed;
|
||||
|
||||
/* do we use static (user-defined) system information messages? (bitmask) */
|
||||
uint32_t si_mode_static;
|
||||
@@ -843,6 +894,7 @@ static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts)
|
||||
struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
|
||||
int *rc);
|
||||
|
||||
enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts);
|
||||
uint8_t ts_subslots(struct gsm_bts_trx_ts *ts);
|
||||
bool ts_is_tch(struct gsm_bts_trx_ts *ts);
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ struct gsm_subscriber {
|
||||
|
||||
/* pending requests */
|
||||
int is_paging;
|
||||
struct osmo_timer_list paging_timeout;
|
||||
struct llist_head requests;
|
||||
|
||||
/* GPRS/SGSN related fields */
|
||||
@@ -91,20 +90,6 @@ enum gsm_subscriber_update_reason {
|
||||
GSM_SUBSCRIBER_UPDATE_EQUIPMENT,
|
||||
};
|
||||
|
||||
/*
|
||||
* Struct for pending channel requests. This is managed in the
|
||||
* llist_head requests of each subscriber. The reference counting
|
||||
* should work in such a way that a subscriber with a pending request
|
||||
* remains in memory.
|
||||
*/
|
||||
struct subscr_request {
|
||||
struct llist_head entry;
|
||||
|
||||
/* the callback data */
|
||||
gsm_cbfn *cbfn;
|
||||
void *param;
|
||||
};
|
||||
|
||||
struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr);
|
||||
struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr);
|
||||
struct gsm_subscriber *subscr_create_subscriber(struct gsm_subscriber_group *sgrp,
|
||||
@@ -119,7 +104,7 @@ struct gsm_subscriber *subscr_get_by_id(struct gsm_subscriber_group *sgrp,
|
||||
unsigned long long id);
|
||||
struct gsm_subscriber *subscr_get_or_create(struct gsm_subscriber_group *sgrp,
|
||||
const char *imsi);
|
||||
int subscr_update(struct gsm_subscriber *s, uint16_t lac, int reason);
|
||||
int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason);
|
||||
struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_subscriber_group *sgrp,
|
||||
uint32_t tmsi);
|
||||
struct gsm_subscriber *subscr_active_by_imsi(struct gsm_subscriber_group *sgrp,
|
||||
@@ -130,19 +115,14 @@ char *subscr_name(struct gsm_subscriber *subscr);
|
||||
int subscr_purge_inactive(struct gsm_subscriber_group *sgrp);
|
||||
void subscr_update_from_db(struct gsm_subscriber *subscr);
|
||||
void subscr_expire(struct gsm_subscriber_group *sgrp);
|
||||
int subscr_update_expire_lu(struct gsm_subscriber *subscr);
|
||||
|
||||
bool subscr_authorized_imsi(const struct gsm_network *net, const char *imsi);
|
||||
bool subscr_authorized(struct gsm_subscriber *subsc);
|
||||
int subscr_update_expire_lu(struct gsm_subscriber *subscr, struct gsm_bts *bts);
|
||||
|
||||
/*
|
||||
* Paging handling with authentication
|
||||
*/
|
||||
struct subscr_request *subscr_request_conn(struct gsm_subscriber *subscr,
|
||||
gsm_cbfn *cbfn, void *param);
|
||||
struct subscr_request *subscr_request_channel(struct gsm_subscriber *subscr,
|
||||
int type, gsm_cbfn *cbfn, void *param);
|
||||
void subscr_remove_request(struct subscr_request *req);
|
||||
int subscr_rx_paging_response(struct msgb *msg,
|
||||
struct gsm_subscriber_connection *conn);
|
||||
|
||||
/* internal */
|
||||
struct gsm_subscriber *subscr_alloc(void);
|
||||
|
||||
26
openbsc/include/openbsc/gsm_sup.h
Normal file
26
openbsc/include/openbsc/gsm_sup.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef _GSM_SUP_H
|
||||
#define _GSM_SUP_H
|
||||
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <osmocom/gsm/gsm0480.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_11.h>
|
||||
|
||||
#define LOGGSUBSCRP(level, subscr, fmt, args...) \
|
||||
LOGP(DSUP, level, "SUBSCR(%s) " fmt, \
|
||||
(subscr) ? (subscr)->imsi : "---", \
|
||||
## args)
|
||||
|
||||
/* Callback for both HLR/auth and USSD SUP sockets */
|
||||
int sup_read_cb(struct gsup_client *sup_client, struct msgb *msg);
|
||||
|
||||
/*
|
||||
int subscr_query_auth_info(struct gsm_subscriber *subscr);
|
||||
*/
|
||||
int subscr_location_update(struct gsm_subscriber *subscr);
|
||||
int subscr_purge_ms(struct gsm_subscriber *subscr);
|
||||
|
||||
int subscr_tx_sms_message(struct gsm_subscriber *subscr,
|
||||
struct gsm411_rp_hdr *rph);
|
||||
|
||||
#endif /* _GSM_SUP_H */
|
||||
14
openbsc/include/openbsc/gsm_ussd_map.h
Normal file
14
openbsc/include/openbsc/gsm_ussd_map.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _GSM_USSD_MAP_H
|
||||
#define _GSM_USSD_MAP_H
|
||||
|
||||
#include <openbsc/gsup_client.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <openbsc/gsm_ussd_map_proto.h>
|
||||
|
||||
int ussd_map_read_cb(struct gsup_client *sup_client,
|
||||
struct msgb *msg);
|
||||
|
||||
int ussd_map_tx_message(struct gsm_network *net, struct ss_header *req,
|
||||
const char *extension, uint32_t ref, const uint8_t *component_data);
|
||||
|
||||
#endif /* _GSM_USSD_MAP_H */
|
||||
25
openbsc/include/openbsc/gsm_ussd_map_proto.h
Normal file
25
openbsc/include/openbsc/gsm_ussd_map_proto.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _GSM_USSD_MAP_PROTO_H
|
||||
#define _GSM_USSD_MAP_PROTO_H
|
||||
|
||||
#include <osmocom/gsm/gsm0480.h>
|
||||
|
||||
|
||||
enum {
|
||||
FMAP_MSISDN = 0x80
|
||||
};
|
||||
|
||||
int subscr_uss_message(struct msgb *msg,
|
||||
struct ss_header *req,
|
||||
const char* extension,
|
||||
uint32_t ref,
|
||||
const uint8_t *component_data);
|
||||
|
||||
int rx_uss_message_parse(const uint8_t* data,
|
||||
size_t len,
|
||||
struct ss_header *ss,
|
||||
uint32_t *ref,
|
||||
char* extention,
|
||||
size_t extention_len);
|
||||
|
||||
|
||||
#endif /* _GSM_USSD_MAP_PROTO_H */
|
||||
@@ -23,37 +23,39 @@
|
||||
|
||||
#include <osmocom/core/timer.h>
|
||||
|
||||
#include <openbsc/oap.h>
|
||||
#include <openbsc/oap_client.h>
|
||||
|
||||
#define GPRS_GSUP_RECONNECT_INTERVAL 10
|
||||
#define GPRS_GSUP_PING_INTERVAL 20
|
||||
#define GSUP_CLIENT_RECONNECT_INTERVAL 10
|
||||
#define GSUP_CLIENT_PING_INTERVAL 20
|
||||
|
||||
struct msgb;
|
||||
struct ipa_client_conn;
|
||||
struct gprs_gsup_client;
|
||||
struct gsup_client;
|
||||
|
||||
/* Expects message in msg->l2h */
|
||||
typedef int (*gprs_gsup_read_cb_t)(struct gprs_gsup_client *gsupc, struct msgb *msg);
|
||||
typedef int (*gsup_client_read_cb_t)(struct gsup_client *gsupc,
|
||||
struct msgb *msg);
|
||||
|
||||
struct gprs_gsup_client {
|
||||
struct ipa_client_conn *link;
|
||||
gprs_gsup_read_cb_t read_cb;
|
||||
void *data;
|
||||
struct gsup_client {
|
||||
struct ipa_client_conn *link;
|
||||
gsup_client_read_cb_t read_cb;
|
||||
void *data;
|
||||
|
||||
struct oap_state oap_state;
|
||||
struct oap_client_state oap_state;
|
||||
|
||||
struct osmo_timer_list ping_timer;
|
||||
struct osmo_timer_list connect_timer;
|
||||
int is_connected;
|
||||
int got_ipa_pong;
|
||||
struct osmo_timer_list ping_timer;
|
||||
struct osmo_timer_list connect_timer;
|
||||
int is_connected;
|
||||
int got_ipa_pong;
|
||||
struct gsm_network *net;
|
||||
};
|
||||
|
||||
struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr,
|
||||
unsigned int tcp_port,
|
||||
gprs_gsup_read_cb_t read_cb,
|
||||
struct oap_config *oap_config);
|
||||
struct gsup_client *gsup_client_create(const char *ip_addr,
|
||||
unsigned int tcp_port,
|
||||
gsup_client_read_cb_t read_cb,
|
||||
struct oap_client_config *oap_config);
|
||||
|
||||
void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc);
|
||||
int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg);
|
||||
struct msgb *gprs_gsup_msgb_alloc(void);
|
||||
void gsup_client_destroy(struct gsup_client *gsupc);
|
||||
int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg);
|
||||
struct msgb *gsup_client_msgb_alloc(void);
|
||||
|
||||
@@ -58,6 +58,5 @@ int iu_rab_act(struct ue_conn_ctx *ue_ctx, struct msgb *msg);
|
||||
int iu_rab_deact(struct ue_conn_ctx *ue_ctx, uint8_t rab_id);
|
||||
int iu_tx_sec_mode_cmd(struct ue_conn_ctx *uectx, struct gsm_auth_tuple *tp,
|
||||
int send_ck, int new_key);
|
||||
int iu_tx_common_id(struct ue_conn_ctx *ue_ctx, const char *imsi);
|
||||
|
||||
void iu_vty_init(int *asn_debug_p);
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg,
|
||||
uint16_t *lac);
|
||||
|
||||
struct gsm_subscriber_connection *subscr_conn_lookup_iu(struct gsm_network *network,
|
||||
struct ue_conn_ctx *ue);
|
||||
@@ -170,21 +170,6 @@ enum mgcp_role {
|
||||
MGCP_BSC_NAT,
|
||||
};
|
||||
|
||||
enum mgcp_connection_mode {
|
||||
MGCP_CONN_NONE = 0,
|
||||
MGCP_CONN_RECV_ONLY = 1,
|
||||
MGCP_CONN_SEND_ONLY = 2,
|
||||
MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY,
|
||||
MGCP_CONN_LOOPBACK = 4 | MGCP_CONN_RECV_SEND,
|
||||
};
|
||||
|
||||
extern const struct value_string mgcp_connection_mode_strs[];
|
||||
|
||||
static inline const char *mgcp_cmode_name(enum mgcp_connection_mode mode)
|
||||
{
|
||||
return get_value_string(mgcp_connection_mode_strs, mode);
|
||||
}
|
||||
|
||||
struct mgcp_config {
|
||||
int source_port;
|
||||
char *local_ip;
|
||||
|
||||
@@ -28,6 +28,14 @@
|
||||
|
||||
#define CI_UNUSED 0
|
||||
|
||||
enum mgcp_connection_mode {
|
||||
MGCP_CONN_NONE = 0,
|
||||
MGCP_CONN_RECV_ONLY = 1,
|
||||
MGCP_CONN_SEND_ONLY = 2,
|
||||
MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY,
|
||||
MGCP_CONN_LOOPBACK = 4 | MGCP_CONN_RECV_SEND,
|
||||
};
|
||||
|
||||
enum mgcp_trunk_type {
|
||||
MGCP_TRUNK_VIRTUAL,
|
||||
MGCP_TRUNK_E1,
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
enum mgcp_connection_mode;
|
||||
|
||||
struct msgb;
|
||||
struct mgcpgw_client;
|
||||
|
||||
#define MGCPGW_CLIENT_LOCAL_ADDR_DEFAULT "0.0.0.0"
|
||||
#define MGCPGW_CLIENT_LOCAL_PORT_DEFAULT 0
|
||||
#define MGCPGW_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1"
|
||||
#define MGCPGW_CLIENT_REMOTE_PORT_DEFAULT 2427
|
||||
|
||||
typedef void (* mgcp_rx_cb_t )(struct msgb *msg, void *priv);
|
||||
|
||||
struct mgcpgw_client_conf {
|
||||
const char *local_addr;
|
||||
int local_port;
|
||||
const char *remote_addr;
|
||||
int remote_port;
|
||||
};
|
||||
|
||||
void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf);
|
||||
|
||||
struct mgcpgw_client *mgcpgw_client_init(void *ctx,
|
||||
struct mgcpgw_client_conf *conf,
|
||||
mgcp_rx_cb_t rx_cb, void *rx_cb_priv);
|
||||
|
||||
const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp);
|
||||
uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp);
|
||||
uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp);
|
||||
|
||||
unsigned int mgcpgw_client_next_endpoint(struct mgcpgw_client *client);
|
||||
|
||||
int mgcpgw_client_tx_crcx(struct mgcpgw_client *client,
|
||||
uint16_t rtp_endpoint, unsigned int call_id,
|
||||
enum mgcp_connection_mode mode);
|
||||
int mgcpgw_client_tx_mdcx(struct mgcpgw_client *client, uint16_t rtp_endpoint,
|
||||
const char *rtp_conn_addr, uint16_t rtp_port,
|
||||
enum mgcp_connection_mode mode);
|
||||
|
||||
int mgcpgw_client_tx_str(struct mgcpgw_client *mgcp, const char *fmt, ...);
|
||||
int mgcpgw_client_tx_buf(struct mgcpgw_client *mgcp, const char *buf, int len);
|
||||
int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg);
|
||||
|
||||
void mgcpgw_client_vty_init(int node, struct mgcpgw_client_conf *conf);
|
||||
int mgcpgw_client_config_write(struct vty *vty, const char *indent);
|
||||
@@ -1,51 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <openbsc/gsm_data.h>
|
||||
|
||||
/* These are the interfaces of the MSC layer towards (from?) the BSC and RNC,
|
||||
* i.e. in the direction towards the mobile device (MS aka UE).
|
||||
*
|
||||
* 2G will use the A-interface,
|
||||
* 3G aka UMTS will use the Iu-interface (for the MSC, it's IuCS).
|
||||
*
|
||||
* To allow linking parts of the MSC code without having to include entire
|
||||
* infrastructures of external libraries, the core transmitting and receiving
|
||||
* functions are left unimplemented. For example, a unit test does not need to
|
||||
* link against external ASN1 libraries if it is never going to encode actual
|
||||
* outgoing messages. It is up to each building scope to implement real world
|
||||
* functions or to plug mere dummy implementations.
|
||||
*
|
||||
* For example, msc_tx_dtap(conn, msg), depending on conn->via_iface, will call
|
||||
* either iu_tx() or a_tx() [note: at time of writing, the A-interface is not
|
||||
* yet implemented]. When you try to link against libmsc, you will find that
|
||||
* the compiler complains about an undefined reference to iu_tx(). If you,
|
||||
* however, link against libiu as well as the osmo-iuh libs (etc.), iu_tx() is
|
||||
* available. A unit test may instead simply implement a dummy iu_tx() function
|
||||
* and not link against osmo-iuh.
|
||||
*/
|
||||
|
||||
/* Each main linkage must implement this function (see comment above). */
|
||||
extern int iu_tx(struct msgb *msg, uint8_t sapi);
|
||||
|
||||
/* So far this is a dummy implemented in libmsc/a_iface.c. When A-interface
|
||||
* gets implemented, it should be in a separate lib (like libiu), this function
|
||||
* should move there, and the following comment should remain here: "
|
||||
* Each main linkage must implement this function (see comment above).
|
||||
* " */
|
||||
extern int a_tx(struct msgb *msg);
|
||||
|
||||
int msc_tx_dtap(struct gsm_subscriber_connection *conn,
|
||||
struct msgb *msg);
|
||||
|
||||
int msc_gsm48_tx_mm_serv_ack(struct gsm_subscriber_connection *conn);
|
||||
int msc_gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
|
||||
enum gsm48_reject_value value);
|
||||
|
||||
/* TODO: specific to A interface, move this away */
|
||||
int msc_gsm0808_tx_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
|
||||
const uint8_t *key, int len, int include_imeisv);
|
||||
|
||||
int msc_tx_common_id(struct gsm_subscriber_connection *conn);
|
||||
int msc_call_assignment(struct gsm_trans *trans);
|
||||
int msc_call_bridge(struct gsm_trans *trans1, struct gsm_trans *trans2);
|
||||
@@ -27,9 +27,10 @@
|
||||
struct msgb;
|
||||
struct osmo_oap_message;
|
||||
|
||||
/* This is the config part for vty. It is essentially copied in oap_state,
|
||||
* where values are copied over once the config is considered valid. */
|
||||
struct oap_config {
|
||||
/* This is the config part for vty. It is essentially copied in
|
||||
* oap_client_state, where values are copied over once the config is
|
||||
* considered valid. */
|
||||
struct oap_client_config {
|
||||
uint16_t client_id;
|
||||
int secret_k_present;
|
||||
uint8_t secret_k[16];
|
||||
@@ -38,9 +39,10 @@ struct oap_config {
|
||||
};
|
||||
|
||||
/* The runtime state of the OAP client. client_id and the secrets are in fact
|
||||
* duplicated from oap_config, so that a separate validation of the config data
|
||||
* is possible, and so that only a struct oap_state* is passed around. */
|
||||
struct oap_state {
|
||||
* duplicated from oap_client_config, so that a separate validation of the
|
||||
* config data is possible, and so that only a struct oap_client_state* is
|
||||
* passed around. */
|
||||
struct oap_client_state {
|
||||
enum {
|
||||
OAP_UNINITIALIZED = 0, /* just allocated. */
|
||||
OAP_DISABLED, /* disabled by config. */
|
||||
@@ -56,23 +58,25 @@ struct oap_state {
|
||||
};
|
||||
|
||||
/* From config, initialize state. Return 0 on success. */
|
||||
int oap_init(struct oap_config *config, struct oap_state *state);
|
||||
int oap_client_init(struct oap_client_config *config,
|
||||
struct oap_client_state *state);
|
||||
|
||||
/* Construct an OAP registration message and return in *msg_tx. Use
|
||||
* state->client_id and update state->state.
|
||||
* Return 0 on success, or a negative value on error.
|
||||
* If an error is returned, *msg_tx is guaranteed to be NULL. */
|
||||
int oap_register(struct oap_state *state, struct msgb **msg_tx);
|
||||
int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx);
|
||||
|
||||
/* Decode and act on a received OAP message msg_rx. Update state->state. If a
|
||||
* non-NULL pointer is returned in *msg_tx, that msgb should be sent to the OAP
|
||||
* server (and freed) by the caller. The received msg_rx is not freed.
|
||||
* Return 0 on success, or a negative value on error.
|
||||
* If an error is returned, *msg_tx is guaranteed to be NULL. */
|
||||
int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb **msg_tx);
|
||||
|
||||
/* Allocate a msgb and in it, return the encoded oap_msg. Return NULL on
|
||||
* error. (Like oap_encode(), but also allocates a msgb.)
|
||||
* About the name: the idea is do_something(oap_encoded(my_struct)) */
|
||||
struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg);
|
||||
int oap_client_handle(struct oap_client_state *state,
|
||||
const struct msgb *msg_rx, struct msgb **msg_tx);
|
||||
|
||||
/* Allocate a msgb and in it, return the encoded oap_client_msg. Return
|
||||
* NULL on error. (Like oap_client_encode(), but also allocates a msgb.)
|
||||
* About the name: the idea is do_something(oap_client_encoded(my_struct))
|
||||
*/
|
||||
struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_client_msg);
|
||||
@@ -1,70 +0,0 @@
|
||||
/* Osmocom Authentication Protocol message encoder/decoder */
|
||||
|
||||
/* (C) 2015 by Sysmocom s.f.m.c. GmbH
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Author: Neels Hofmeyr
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||
|
||||
/* Some numbers are out of sequence because (so far) they match gprs_gsup_iei.
|
||||
*/
|
||||
enum oap_iei {
|
||||
OAP_CAUSE_IE = 0x02,
|
||||
OAP_RAND_IE = 0x20,
|
||||
OAP_AUTN_IE = 0x23,
|
||||
OAP_XRES_IE = 0x24,
|
||||
OAP_AUTS_IE = 0x25,
|
||||
OAP_CLIENT_ID_IE = 0x30,
|
||||
};
|
||||
|
||||
enum osmo_oap_message_type {
|
||||
OAP_MSGT_REGISTER_REQUEST = 0b00000100,
|
||||
OAP_MSGT_REGISTER_ERROR = 0b00000101,
|
||||
OAP_MSGT_REGISTER_RESULT = 0b00000110,
|
||||
|
||||
OAP_MSGT_CHALLENGE_REQUEST = 0b00001000,
|
||||
OAP_MSGT_CHALLENGE_ERROR = 0b00001001,
|
||||
OAP_MSGT_CHALLENGE_RESULT = 0b00001010,
|
||||
|
||||
OAP_MSGT_SYNC_REQUEST = 0b00001100,
|
||||
OAP_MSGT_SYNC_ERROR = 0b00001101,
|
||||
OAP_MSGT_SYNC_RESULT = 0b00001110,
|
||||
};
|
||||
|
||||
struct osmo_oap_message {
|
||||
enum osmo_oap_message_type message_type;
|
||||
enum gsm48_gmm_cause cause;
|
||||
uint16_t client_id;
|
||||
int rand_present;
|
||||
uint8_t rand[16];
|
||||
int autn_present;
|
||||
uint8_t autn[16];
|
||||
int xres_present;
|
||||
uint8_t xres[8];
|
||||
int auts_present;
|
||||
uint8_t auts[16];
|
||||
};
|
||||
|
||||
int osmo_oap_decode(struct osmo_oap_message *oap_msg,
|
||||
const uint8_t *data, size_t data_len);
|
||||
void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg);
|
||||
|
||||
@@ -46,11 +46,6 @@ struct osmo_bsc_sccp_con {
|
||||
struct bsc_filter_state filter_state;
|
||||
};
|
||||
|
||||
struct gsm_network *bsc_network_init(void *ctx,
|
||||
uint16_t country_code,
|
||||
uint16_t network_code,
|
||||
mncc_recv_cb_t mncc_recv);
|
||||
|
||||
struct bsc_api *osmo_bsc_api();
|
||||
|
||||
int bsc_queue_for_msc(struct osmo_bsc_sccp_con *conn, struct msgb *msg);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef OSMO_BSC_GRACE_H
|
||||
#define OSMO_BSC_GRACE_H
|
||||
|
||||
#include "gsm_data.h"
|
||||
#include <openbsc/gsm_data.h>
|
||||
|
||||
struct osmo_msc_data;
|
||||
|
||||
|
||||
@@ -5,15 +5,7 @@
|
||||
|
||||
#include "bsc_api.h"
|
||||
|
||||
enum {
|
||||
MSC_CONN_ACCEPT = 0,
|
||||
MSC_CONN_REJECT = 1,
|
||||
};
|
||||
|
||||
struct bsc_api *msc_bsc_api();
|
||||
|
||||
int msc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg,
|
||||
uint16_t chosen_channel);
|
||||
void msc_release_connection(struct gsm_subscriber_connection *conn);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,10 +24,11 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include "gsm_data.h"
|
||||
#include "gsm_subscriber.h"
|
||||
#include <osmocom/core/timer.h>
|
||||
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
|
||||
/**
|
||||
* A pending paging request
|
||||
*/
|
||||
|
||||
15
openbsc/include/openbsc/reg_proxy.h
Normal file
15
openbsc/include/openbsc/reg_proxy.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef _REG_PROXY_H
|
||||
#define _REG_PROXY_H
|
||||
|
||||
#include <openbsc/sup_server.h>
|
||||
#include <openbsc/sip_client.h>
|
||||
#include <osip2/osip.h>
|
||||
void *tall_reg_ctx;
|
||||
|
||||
struct reg_proxy {
|
||||
struct gsm_sup_server *sup_server;
|
||||
struct sip_client *sip_client;
|
||||
osip_t *osip;
|
||||
};
|
||||
|
||||
#endif /* _REG_PROXY_H */
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <osmocom/crypt/gprs_cipher.h>
|
||||
#include <osmocom/gprs/gprs_ns.h>
|
||||
#include <openbsc/gprs_sgsn.h>
|
||||
#include <openbsc/oap.h>
|
||||
#include <openbsc/oap_client.h>
|
||||
|
||||
#include <ares.h>
|
||||
|
||||
@@ -92,7 +92,7 @@ struct sgsn_config {
|
||||
|
||||
int dynamic_lookup;
|
||||
|
||||
struct oap_config oap;
|
||||
struct oap_client_config oap;
|
||||
|
||||
/* RFC1144 TCP/IP header compression */
|
||||
struct {
|
||||
@@ -123,7 +123,7 @@ struct sgsn_instance {
|
||||
/* GSN instance for libgtp */
|
||||
struct gsn_t *gsn;
|
||||
/* Subscriber */
|
||||
struct gprs_gsup_client *gsup_client;
|
||||
struct gsup_client *gsup_client;
|
||||
/* LLME inactivity timer */
|
||||
struct osmo_timer_list llme_timer;
|
||||
|
||||
|
||||
16
openbsc/include/openbsc/sip.h
Normal file
16
openbsc/include/openbsc/sip.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef _SIP_H
|
||||
#define _SIP_H
|
||||
|
||||
#include <openbsc/sip_client.h>
|
||||
#include <openbsc/reg_proxy.h>
|
||||
#include <osip2/osip.h>
|
||||
#include <osmocom/gsm/gsm0480.h>
|
||||
|
||||
int tx_ss_handle(struct sip_client *sip_client, osip_t *osip, struct ss_request *ss,
|
||||
const char *extention);
|
||||
|
||||
int tx_sip_register(struct sip_client *sip_client, osip_t *osip, char *imsi, int expires_time);
|
||||
|
||||
int sip_client_init(struct reg_proxy *reg, const char *src_ip, u_int16_t src_port,
|
||||
const char *dst_ip, u_int16_t dst_port, int expires_time);
|
||||
#endif /* _SIP_H */
|
||||
36
openbsc/include/openbsc/sip_client.h
Normal file
36
openbsc/include/openbsc/sip_client.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <osmocom/core/timer.h>
|
||||
|
||||
#define SIP_RECONNECT_INTERVAL 10
|
||||
|
||||
struct msgb;
|
||||
struct ipa_client_conn;
|
||||
struct sip_client;
|
||||
|
||||
/* Expects message in msg->l2h */
|
||||
typedef int (*sip_read_cb_t)(struct sip_client *sip_client, struct msgb *msg);
|
||||
|
||||
struct sip_client {
|
||||
struct tcp_client_conn *link;
|
||||
sip_read_cb_t read_cb;
|
||||
void *data;
|
||||
|
||||
struct osmo_timer_list connect_timer;
|
||||
int is_connected;
|
||||
|
||||
char *src_ip;
|
||||
char *dst_ip;
|
||||
u_int16_t src_port;
|
||||
u_int16_t dst_port;
|
||||
int expires_time;
|
||||
};
|
||||
|
||||
struct sip_client *sip_client_create(const char *src_ip, u_int16_t src_port,
|
||||
const char *dst_ip, u_int16_t dst_port,
|
||||
int expires_time, sip_read_cb_t read_cb,
|
||||
void *data);
|
||||
|
||||
void sip_client_destroy(struct sip_client *sip_client);
|
||||
int sip_client_send(struct sip_client *sip_client, struct msgb *msg);
|
||||
struct msgb *sip_msgb_alloc(void);
|
||||
19
openbsc/include/openbsc/sup.h
Normal file
19
openbsc/include/openbsc/sup.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _SUP_H
|
||||
#define _SUP_H
|
||||
|
||||
#include <openbsc/reg_proxy.h>
|
||||
|
||||
#define LOGGSUPP(level, sup, fmt, args...) \
|
||||
LOGP(DGPRS, level, "SUP(%s) " fmt, \
|
||||
(sup)->imsi, \
|
||||
## args)
|
||||
|
||||
int sup_server_init(struct reg_proxy *reg);
|
||||
|
||||
int handle_location_update_result(struct gsm_sup_server *sup_server,
|
||||
char *imsi, char *msisdn);
|
||||
|
||||
int handle_purge_ms_result(struct gsm_sup_server *sup_server,
|
||||
char *imsi);
|
||||
|
||||
#endif /* _SUP_H */
|
||||
29
openbsc/include/openbsc/sup_server.h
Normal file
29
openbsc/include/openbsc/sup_server.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef _SUP_SERVER_H
|
||||
#define _SUP_SERVER_H
|
||||
|
||||
#include <osmocom/abis/ipa.h>
|
||||
|
||||
//struct msgb;
|
||||
struct ipa_server_conn;
|
||||
struct gsm_sup_server;
|
||||
|
||||
/* Expects message in msg->l2h */
|
||||
typedef int (*sup_read_cb_t)(struct gsm_sup_server *sup_server, struct msgb *msg);
|
||||
|
||||
struct gsm_sup_server {
|
||||
struct ipa_server_link *link;
|
||||
sup_read_cb_t read_cb;
|
||||
void *data;
|
||||
struct osmo_fd fd;
|
||||
struct ipa_server_conn *server_conn;
|
||||
void *app;
|
||||
};
|
||||
|
||||
struct gsm_sup_server *sup_server_create(const char *ip_addr,
|
||||
unsigned int tcp_port,
|
||||
sup_read_cb_t read_cb,
|
||||
void *app);
|
||||
|
||||
int sup_server_send(struct gsm_sup_server *sup_server, struct msgb *msg);
|
||||
|
||||
#endif /* _SUP_SERVER_H */
|
||||
@@ -3,14 +3,17 @@
|
||||
|
||||
#include <osmocom/gsm/sysinfo.h>
|
||||
|
||||
#include <openbsc/arfcn_range_encode.h>
|
||||
|
||||
struct gsm_bts;
|
||||
|
||||
int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type);
|
||||
uint16_t encode_fdd(uint16_t scramble, bool diversity);
|
||||
unsigned uarfcn_size(const uint16_t *u, const uint16_t *sc, size_t u_len);
|
||||
unsigned earfcn_size(const struct osmo_earfcn_si2q *e);
|
||||
unsigned range1024_p(unsigned n);
|
||||
unsigned range512_q(unsigned m);
|
||||
int range_encode(enum gsm48_range r, int *arfcns, int arfcns_used, int *w,
|
||||
int f0, uint8_t *chan_list);
|
||||
bool si2q_size_check(const struct gsm_bts *bts);
|
||||
int bts_uarfcn_del(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble);
|
||||
int bts_uarfcn_add(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble,
|
||||
|
||||
51
openbsc/include/openbsc/tcp_client.h
Normal file
51
openbsc/include/openbsc/tcp_client.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef _TCP_CLIENT_H_
|
||||
#define _TCP_CLIENT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
#include <osmocom/core/select.h>
|
||||
|
||||
|
||||
struct msgb;
|
||||
|
||||
enum tcp_client_conn_state {
|
||||
TCP_CLIENT_LINK_STATE_NONE = 0,
|
||||
TCP_CLIENT_LINK_STATE_CONNECTING = 1,
|
||||
TCP_CLIENT_LINK_STATE_CONNECTED = 2,
|
||||
TCP_CLIENT_LINK_STATE_MAX
|
||||
};
|
||||
|
||||
struct tcp_client_conn {
|
||||
struct osmo_fd *ofd;
|
||||
struct llist_head tx_queue;
|
||||
struct osmo_timer_list timer;
|
||||
enum tcp_client_conn_state state;
|
||||
const char *src_addr;
|
||||
uint16_t src_port;
|
||||
const char *dst_addr;
|
||||
uint16_t dst_port;
|
||||
void (*updown_cb)(struct tcp_client_conn *link, int up);
|
||||
int (*read_cb)(struct tcp_client_conn *link, struct msgb *msg);
|
||||
int (*write_cb)(struct tcp_client_conn *link);
|
||||
void *data;
|
||||
struct msgb *pending_msg;
|
||||
};
|
||||
|
||||
struct tcp_client_conn *
|
||||
tcp_client_conn_create(void *ctx, int priv_nr,
|
||||
const char *dst_addr, uint16_t dst_port,
|
||||
const char *src_addr, uint16_t src_port,
|
||||
void (*updown)(struct tcp_client_conn *link, int),
|
||||
int (*read_cb)(struct tcp_client_conn *link, struct msgb *msgb),
|
||||
int (*write_cb)(struct tcp_client_conn *link),
|
||||
void *data);
|
||||
void tcp_client_conn_destroy(struct tcp_client_conn *link);
|
||||
|
||||
int tcp_client_conn_open(struct tcp_client_conn *link);
|
||||
void tcp_client_conn_close(struct tcp_client_conn *link);
|
||||
|
||||
void tcp_client_conn_send(struct tcp_client_conn *link, struct msgb *msg);
|
||||
size_t tcp_client_conn_clear_queue(struct tcp_client_conn *link);
|
||||
|
||||
#endif
|
||||
@@ -32,6 +32,11 @@ struct gsm_trans {
|
||||
/* reference from MNCC or other application */
|
||||
uint32_t callref;
|
||||
|
||||
/* SMS RP message reference */
|
||||
uint8_t msg_ref;
|
||||
/* handle SMS local */
|
||||
uint8_t sms_local;
|
||||
|
||||
/* if traffic channel receive was requested */
|
||||
int tch_recv;
|
||||
|
||||
@@ -56,6 +61,11 @@ struct gsm_trans {
|
||||
|
||||
struct gsm_sms *sms;
|
||||
} sms;
|
||||
struct {
|
||||
uint8_t invoke_id;
|
||||
uint8_t mo;
|
||||
uint8_t dirty;
|
||||
} ss;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -65,6 +75,8 @@ struct gsm_trans *trans_find_by_id(struct gsm_subscriber_connection *conn,
|
||||
uint8_t proto, uint8_t trans_id);
|
||||
struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
|
||||
uint32_t callref);
|
||||
struct gsm_trans *trans_find_by_msgref(struct gsm_subscriber_connection *conn,
|
||||
uint8_t msg_ref);
|
||||
|
||||
struct gsm_trans *trans_alloc(struct gsm_network *net,
|
||||
struct gsm_subscriber *subscr,
|
||||
|
||||
@@ -5,6 +5,19 @@
|
||||
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
#define USSD_MO 1
|
||||
#define USSD_MT 0
|
||||
|
||||
int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg);
|
||||
|
||||
|
||||
int on_ussd_response(struct gsm_network *net,
|
||||
uint32_t ref,
|
||||
struct ss_header *reqhdr,
|
||||
const uint8_t *component,
|
||||
const char* extention);
|
||||
|
||||
|
||||
void _ussd_trans_free(struct gsm_trans *trans);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,6 +29,7 @@ enum bsc_vty_node {
|
||||
NAT_BSC_NODE,
|
||||
MSC_NODE,
|
||||
OM2K_NODE,
|
||||
OM2K_CON_GROUP_NODE,
|
||||
TRUNK_NODE,
|
||||
PGROUP_NODE,
|
||||
MNCC_INT_NODE,
|
||||
@@ -37,7 +38,6 @@ enum bsc_vty_node {
|
||||
SMPP_NODE,
|
||||
SMPP_ESME_NODE,
|
||||
GTPHUB_NODE,
|
||||
CSCN_NODE,
|
||||
};
|
||||
|
||||
extern int bsc_vty_is_config_node(struct vty *vty, int node);
|
||||
@@ -47,8 +47,6 @@ struct log_info;
|
||||
int bsc_vty_init(const struct log_info *cat, struct gsm_network *network);
|
||||
int bsc_vty_init_extra(void);
|
||||
|
||||
void cscn_vty_init(struct gsm_network *cscn_network);
|
||||
|
||||
struct gsm_network *gsmnet_from_vty(struct vty *vty);
|
||||
|
||||
#endif
|
||||
|
||||
3
openbsc/m4/README
Normal file
3
openbsc/m4/README
Normal file
@@ -0,0 +1,3 @@
|
||||
We want to avoid creating too many external build-time dependencies
|
||||
like this one to autoconf-archive. This directory provides a local
|
||||
copy of required m4 rules.
|
||||
74
openbsc/m4/ax_check_compile_flag.m4
Normal file
74
openbsc/m4/ax_check_compile_flag.m4
Normal file
@@ -0,0 +1,74 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 4
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
||||
@@ -27,7 +27,7 @@ SUBDIRS = \
|
||||
libmsc \
|
||||
libtrau \
|
||||
libfilter \
|
||||
libxsc \
|
||||
libcommon-cs \
|
||||
$(NULL)
|
||||
|
||||
# Conditional Libraries
|
||||
@@ -39,11 +39,13 @@ endif
|
||||
|
||||
# Programs
|
||||
SUBDIRS += \
|
||||
osmo-cscn \
|
||||
osmo-nitb \
|
||||
osmo-bsc_mgcp \
|
||||
utils \
|
||||
ipaccess \
|
||||
gprs \
|
||||
reg-proxy \
|
||||
ussd-proxy \
|
||||
$(NULL)
|
||||
|
||||
# Conditional Programs
|
||||
|
||||
@@ -87,12 +87,9 @@ osmo_sgsn_SOURCES = \
|
||||
sgsn_auth.c \
|
||||
gprs_subscriber.c \
|
||||
gprs_utils.c \
|
||||
gprs_gsup_client.c \
|
||||
sgsn_cdr.c \
|
||||
sgsn_ares.c \
|
||||
slhc.c \
|
||||
oap.c \
|
||||
oap_messages.c \
|
||||
gprs_llc_xid.c \
|
||||
v42bis.c \
|
||||
$(NULL)
|
||||
|
||||
@@ -318,7 +318,7 @@ static void gbproxy_reset_imsi_acquisition(struct gbproxy_link_info* link_info)
|
||||
link_info->vu_gen_tx_bss = GBPROXY_INIT_VU_GEN_TX;
|
||||
}
|
||||
|
||||
static void gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
|
||||
static int gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
|
||||
struct msgb *msg,
|
||||
time_t now,
|
||||
struct gbproxy_link_info* link_info,
|
||||
@@ -349,8 +349,13 @@ static void gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
|
||||
peer, link_info, &len_change,
|
||||
&tmp_parse_ctx);
|
||||
|
||||
gbproxy_update_link_state_after(peer, link_info, now,
|
||||
&tmp_parse_ctx);
|
||||
rc = gbproxy_update_link_state_after(peer, link_info, now,
|
||||
&tmp_parse_ctx);
|
||||
if (rc == 1) {
|
||||
LOGP(DLLC, LOGL_NOTICE, "link_info deleted while flushing stored messages\n");
|
||||
msgb_free(stored_msg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = gbprox_relay2sgsn(peer->cfg, stored_msg,
|
||||
msgb_bvci(msg), link_info->sgsn_nsei);
|
||||
@@ -364,6 +369,8 @@ static void gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
|
||||
parse_ctx->llc_msg_name : "BSSGP");
|
||||
msgb_free(stored_msg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gbproxy_gsm48_to_peer(struct gbproxy_peer *peer,
|
||||
@@ -465,9 +472,12 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
|
||||
gsm48_hdr_pdisc(parse_ctx->g48_hdr) == GSM48_PDISC_MM_GPRS &&
|
||||
gsm48_hdr_msg_type(parse_ctx->g48_hdr) == GSM48_MT_GMM_ID_RESP;
|
||||
|
||||
/* The IMSI is now available */
|
||||
gbproxy_flush_stored_messages(peer, msg, now, link_info,
|
||||
parse_ctx);
|
||||
/* The IMSI is now available. If flushing the messages fails,
|
||||
* then link_info has been deleted and we should return
|
||||
* immediately. */
|
||||
if (gbproxy_flush_stored_messages(peer, msg, now, link_info,
|
||||
parse_ctx) < 0)
|
||||
return 0;
|
||||
|
||||
gbproxy_reset_imsi_acquisition(link_info);
|
||||
|
||||
|
||||
@@ -189,8 +189,6 @@ static void handle_options(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
extern void *tall_msgb_ctx;
|
||||
|
||||
extern int bsc_vty_go_parent(struct vty *vty);
|
||||
|
||||
static struct vty_app_info vty_info = {
|
||||
@@ -231,7 +229,7 @@ int main(int argc, char **argv)
|
||||
int rc;
|
||||
|
||||
tall_bsc_ctx = talloc_named_const(NULL, 0, "nsip_proxy");
|
||||
tall_msgb_ctx = talloc_named_const(tall_bsc_ctx, 0, "msgb");
|
||||
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
|
||||
|
||||
signal(SIGINT, &signal_handler);
|
||||
signal(SIGABRT, &signal_handler);
|
||||
|
||||
@@ -348,18 +348,18 @@ static void gbproxy_touch_link_info(struct gbproxy_peer *peer,
|
||||
gbproxy_attach_link_info(peer, now, link_info);
|
||||
}
|
||||
|
||||
static void gbproxy_unregister_link_info(struct gbproxy_peer *peer,
|
||||
static int gbproxy_unregister_link_info(struct gbproxy_peer *peer,
|
||||
struct gbproxy_link_info *link_info)
|
||||
{
|
||||
if (!link_info)
|
||||
return;
|
||||
return 1;
|
||||
|
||||
if (link_info->tlli.ptmsi == GSM_RESERVED_TMSI && !link_info->imsi_len) {
|
||||
LOGP(DGPRS, LOGL_INFO,
|
||||
"Removing TLLI %08x from list (P-TMSI or IMSI are not set)\n",
|
||||
link_info->tlli.current);
|
||||
gbproxy_delete_link_info(peer, link_info);
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
link_info->tlli.current = 0;
|
||||
@@ -371,7 +371,7 @@ static void gbproxy_unregister_link_info(struct gbproxy_peer *peer,
|
||||
|
||||
gbproxy_reset_link(link_info);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gbproxy_imsi_matches(struct gbproxy_config *cfg,
|
||||
@@ -668,12 +668,13 @@ struct gbproxy_link_info *gbproxy_update_link_state_dl(
|
||||
return link_info;
|
||||
}
|
||||
|
||||
void gbproxy_update_link_state_after(
|
||||
int gbproxy_update_link_state_after(
|
||||
struct gbproxy_peer *peer,
|
||||
struct gbproxy_link_info *link_info,
|
||||
time_t now,
|
||||
struct gprs_gb_parse_context *parse_ctx)
|
||||
{
|
||||
int rc = 0;
|
||||
if (parse_ctx->invalidate_tlli && link_info) {
|
||||
int keep_info =
|
||||
peer->cfg->keep_link_infos == GBPROX_KEEP_ALWAYS ||
|
||||
@@ -684,11 +685,12 @@ void gbproxy_update_link_state_after(
|
||||
if (keep_info) {
|
||||
LOGP(DGPRS, LOGL_INFO, "Unregistering TLLI %08x\n",
|
||||
link_info->tlli.current);
|
||||
gbproxy_unregister_link_info(peer, link_info);
|
||||
rc = gbproxy_unregister_link_info(peer, link_info);
|
||||
} else {
|
||||
LOGP(DGPRS, LOGL_INFO, "Removing TLLI %08x from list\n",
|
||||
link_info->tlli.current);
|
||||
gbproxy_delete_link_info(peer, link_info);
|
||||
rc = 1;
|
||||
}
|
||||
} else if (parse_ctx->to_bss && parse_ctx->tlli_enc &&
|
||||
parse_ctx->new_ptmsi_enc && link_info) {
|
||||
@@ -714,6 +716,8 @@ void gbproxy_update_link_state_after(
|
||||
}
|
||||
|
||||
gbproxy_remove_stale_link_infos(peer, now);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -398,7 +398,7 @@ int gprs_gb_parse_llc(uint8_t *llc, size_t llc_len,
|
||||
|
||||
/* parse LLC */
|
||||
rc = gprs_llc_hdr_parse(ghp, llc, llc_len);
|
||||
gprs_llc_hdr_dump(ghp);
|
||||
gprs_llc_hdr_dump(ghp, NULL);
|
||||
if (rc != 0) {
|
||||
LOGP(DLLC, LOGL_NOTICE, "Error during LLC header parsing\n");
|
||||
return 0;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <osmocom/core/signal.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <osmocom/crypt/auth.h>
|
||||
#include <osmocom/gsm/apn.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||
@@ -65,10 +66,7 @@
|
||||
#include <openbsc/gprs_utils.h>
|
||||
#include <openbsc/sgsn.h>
|
||||
#include <openbsc/signal.h>
|
||||
|
||||
#ifdef BUILD_IU
|
||||
#include <openbsc/iu.h>
|
||||
#endif
|
||||
|
||||
#include <pdp.h>
|
||||
|
||||
@@ -107,6 +105,15 @@ static const struct tlv_definition gsm48_sm_att_tlvdef = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct value_string gprs_pmm_state_names[] = {
|
||||
{ PMM_DETACHED, "PMM DETACH" },
|
||||
{ PMM_CONNECTED, "PMM CONNECTED" },
|
||||
{ PMM_IDLE, "PMM IDLE" },
|
||||
{ MM_IDLE, "MM IDLE" },
|
||||
{ MM_READY, "MM READY" },
|
||||
{ MM_STANDBY, "MM STANDBY" },
|
||||
};
|
||||
|
||||
static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx);
|
||||
|
||||
static void mmctx_change_gtpu_endpoints_to_sgsn(struct sgsn_mm_ctx *mm_ctx)
|
||||
@@ -121,28 +128,45 @@ static void mmctx_change_gtpu_endpoints_to_sgsn(struct sgsn_mm_ctx *mm_ctx)
|
||||
|
||||
void mmctx_set_pmm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state state)
|
||||
{
|
||||
if (ctx->ran_type != MM_CTX_T_UTRAN_Iu)
|
||||
return;
|
||||
|
||||
if (ctx->pmm_state == state)
|
||||
return;
|
||||
|
||||
LOGMMCTXP(LOGL_INFO, ctx, "Changing PMM state from %i to %i\n", ctx->pmm_state, state);
|
||||
LOGMMCTXP(LOGL_INFO, ctx, "Changing PMM state from %s to %s\n",
|
||||
get_value_string(gprs_pmm_state_names, ctx->pmm_state),
|
||||
get_value_string(gprs_pmm_state_names, state));
|
||||
|
||||
if (ctx->ran_type == MM_CTX_T_UTRAN_Iu)
|
||||
{
|
||||
switch (state) {
|
||||
case PMM_IDLE:
|
||||
/* TODO: start RA Upd timer */
|
||||
mmctx_change_gtpu_endpoints_to_sgsn(ctx);
|
||||
break;
|
||||
case PMM_CONNECTED:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (state) {
|
||||
case PMM_IDLE:
|
||||
/* TODO: start RA Upd timer */
|
||||
mmctx_change_gtpu_endpoints_to_sgsn(ctx);
|
||||
break;
|
||||
case PMM_CONNECTED:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ctx->pmm_state = state;
|
||||
}
|
||||
|
||||
void mmctx_set_mm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state state)
|
||||
{
|
||||
if (ctx->ran_type != MM_CTX_T_GERAN_Gb)
|
||||
return;
|
||||
|
||||
if (ctx->pmm_state == state)
|
||||
return;
|
||||
|
||||
LOGMMCTXP(LOGL_INFO, ctx, "Changing MM state from %s to %s\n",
|
||||
get_value_string(gprs_pmm_state_names, ctx->pmm_state),
|
||||
get_value_string(gprs_pmm_state_names, state));
|
||||
|
||||
ctx->pmm_state = state;
|
||||
}
|
||||
|
||||
#ifdef BUILD_IU
|
||||
int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies);
|
||||
int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void *data)
|
||||
@@ -151,33 +175,25 @@ int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void *
|
||||
int rc = -1;
|
||||
|
||||
mm = sgsn_mm_ctx_by_ue_ctx(ctx);
|
||||
|
||||
#define REQUIRE_MM \
|
||||
if (!mm) { \
|
||||
LOGP(DRANAP, LOGL_NOTICE, "Cannot find mm ctx for IU event %i!\n", type); \
|
||||
return rc; \
|
||||
if (!mm) {
|
||||
LOGP(DRANAP, LOGL_NOTICE, "Cannot find mm ctx for IU event %i!\n", type);
|
||||
return rc;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case IU_EVENT_RAB_ASSIGN:
|
||||
REQUIRE_MM
|
||||
rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data);
|
||||
break;
|
||||
case IU_EVENT_IU_RELEASE:
|
||||
/* fall thru */
|
||||
case IU_EVENT_LINK_INVALIDATED:
|
||||
/* Clean up ue_conn_ctx here */
|
||||
if (mm)
|
||||
LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi);
|
||||
else
|
||||
LOGMMCTXP(LOGL_INFO, mm, "IU release for UE conn 0x%x\n",
|
||||
ctx->conn_id);
|
||||
if (mm && mm->pmm_state == PMM_CONNECTED)
|
||||
LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi);
|
||||
if (mm->pmm_state == PMM_CONNECTED)
|
||||
mmctx_set_pmm_state(mm, PMM_IDLE);
|
||||
rc = 0;
|
||||
break;
|
||||
case IU_EVENT_SECURITY_MODE_COMPLETE:
|
||||
REQUIRE_MM
|
||||
/* Continue authentication here */
|
||||
mm->iu.ue_ctx->integrity_active = 1;
|
||||
rc = gsm48_gmm_authorize(mm);
|
||||
@@ -284,9 +300,9 @@ static void mm_ctx_cleanup_free(struct sgsn_mm_ctx *ctx, const char *log_text)
|
||||
LOGMMCTXP(LOGL_INFO, ctx, "Cleaning MM context due to %s\n", log_text);
|
||||
|
||||
/* Mark MM state as deregistered */
|
||||
ctx->mm_state = GMM_DEREGISTERED;
|
||||
|
||||
ctx->gmm_state = GMM_DEREGISTERED;
|
||||
mmctx_set_pmm_state(ctx, PMM_DETACHED);
|
||||
mmctx_set_pmm_state(ctx, MM_IDLE);
|
||||
|
||||
sgsn_mm_ctx_cleanup_free(ctx);
|
||||
}
|
||||
@@ -651,7 +667,9 @@ static int gsm48_rx_gmm_auth_ciph_resp(struct sgsn_mm_ctx *ctx,
|
||||
memcmp(TLVP_VAL(&tp, GSM48_IE_GMM_AUTH_SRES), at->vec.sres,
|
||||
sizeof(at->vec.sres)) != 0) {
|
||||
|
||||
LOGMMCTXP(LOGL_NOTICE, ctx, "Received SRES doesn't match\n");
|
||||
LOGMMCTXP(LOGL_NOTICE, ctx, "Received SRES doesn't match "
|
||||
"expected RES %s\n", osmo_hexdump(at->vec.sres,
|
||||
sizeof(at->vec.sres)));
|
||||
rc = gsm48_tx_gmm_auth_ciph_rej(ctx);
|
||||
mm_ctx_cleanup_free(ctx, "GPRS AUTH AND CIPH REJECT");
|
||||
return rc;
|
||||
@@ -692,11 +710,10 @@ static void extract_subscr_msisdn(struct sgsn_mm_ctx *ctx)
|
||||
/* Prepend a '+' for international numbers */
|
||||
if (called.plan == 1 && called.type == 1) {
|
||||
ctx->msisdn[0] = '+';
|
||||
strncpy(&ctx->msisdn[1], called.number,
|
||||
sizeof(ctx->msisdn) - 1);
|
||||
osmo_strlcpy(&ctx->msisdn[1], called.number,
|
||||
sizeof(ctx->msisdn));
|
||||
} else {
|
||||
strncpy(&ctx->msisdn[0], called.number,
|
||||
sizeof(ctx->msisdn) - 1);
|
||||
osmo_strlcpy(ctx->msisdn, called.number, sizeof(ctx->msisdn));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,7 +751,7 @@ static void extract_subscr_hlr(struct sgsn_mm_ctx *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
strncpy(&ctx->hlr[0], called.number, sizeof(ctx->hlr) - 1);
|
||||
osmo_strlcpy(ctx->hlr, called.number, sizeof(ctx->hlr));
|
||||
}
|
||||
|
||||
#ifdef BUILD_IU
|
||||
@@ -891,7 +908,7 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx)
|
||||
memset(&sig_data, 0, sizeof(sig_data));
|
||||
sig_data.mm = mmctx;
|
||||
osmo_signal_dispatch(SS_SGSN, S_SGSN_ATTACH, &sig_data);
|
||||
ctx->mm_state = GMM_REGISTERED_NORMAL;
|
||||
ctx->gmm_state = GMM_REGISTERED_NORMAL;
|
||||
#endif
|
||||
|
||||
return gsm48_tx_gmm_att_ack(ctx);
|
||||
@@ -930,7 +947,7 @@ void gsm0408_gprs_authenticate(struct sgsn_mm_ctx *ctx)
|
||||
|
||||
void gsm0408_gprs_access_granted(struct sgsn_mm_ctx *ctx)
|
||||
{
|
||||
switch (ctx->mm_state) {
|
||||
switch (ctx->gmm_state) {
|
||||
case GMM_COMMON_PROC_INIT:
|
||||
LOGMMCTXP(LOGL_NOTICE, ctx,
|
||||
"Authorized, continuing procedure, IMSI=%s\n",
|
||||
@@ -950,7 +967,7 @@ void gsm0408_gprs_access_denied(struct sgsn_mm_ctx *ctx, int gmm_cause)
|
||||
if (gmm_cause == SGSN_ERROR_CAUSE_NONE)
|
||||
gmm_cause = GMM_CAUSE_GPRS_NOTALLOWED;
|
||||
|
||||
switch (ctx->mm_state) {
|
||||
switch (ctx->gmm_state) {
|
||||
case GMM_COMMON_PROC_INIT:
|
||||
LOGMMCTXP(LOGL_NOTICE, ctx,
|
||||
"Not authorized, rejecting ATTACH REQUEST "
|
||||
@@ -1043,10 +1060,10 @@ static int gsm48_rx_gmm_id_resp(struct sgsn_mm_ctx *ctx, struct msgb *msg)
|
||||
mm_ctx_cleanup_free(ictx, "GPRS IMSI re-use");
|
||||
}
|
||||
}
|
||||
strncpy(ctx->imsi, mi_string, sizeof(ctx->imsi) - 1);
|
||||
osmo_strlcpy(ctx->imsi, mi_string, sizeof(ctx->imsi));
|
||||
break;
|
||||
case GSM_MI_TYPE_IMEI:
|
||||
strncpy(ctx->imei, mi_string, sizeof(ctx->imei) - 1);
|
||||
osmo_strlcpy(ctx->imei, mi_string, sizeof(ctx->imei));
|
||||
break;
|
||||
case GSM_MI_TYPE_IMEISV:
|
||||
break;
|
||||
@@ -1084,7 +1101,8 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||
if (!msg->dst) {
|
||||
/* Gb mode */
|
||||
cid = bssgp_parse_cell_id(&ra_id, msgb_bcid(msg));
|
||||
}
|
||||
} else
|
||||
ra_id = ((struct ue_conn_ctx*)msg->dst)->ra_id;
|
||||
|
||||
/* MS network capability 10.5.5.12 */
|
||||
msnc_len = *cur++;
|
||||
@@ -1141,12 +1159,12 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||
if (msg->dst)
|
||||
ctx = sgsn_mm_ctx_alloc_iu(msg->dst);
|
||||
else
|
||||
ctx = sgsn_mm_ctx_alloc(0, &ra_id);
|
||||
ctx = sgsn_mm_ctx_alloc_gb(0, &ra_id);
|
||||
if (!ctx) {
|
||||
reject_cause = GMM_CAUSE_NET_FAIL;
|
||||
goto rejected;
|
||||
}
|
||||
strncpy(ctx->imsi, mi_string, sizeof(ctx->imsi) - 1);
|
||||
osmo_strlcpy(ctx->imsi, mi_string, sizeof(ctx->imsi));
|
||||
#endif
|
||||
}
|
||||
if (ctx->ran_type == MM_CTX_T_GERAN_Gb) {
|
||||
@@ -1167,7 +1185,7 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||
if (msg->dst)
|
||||
ctx = sgsn_mm_ctx_alloc_iu(msg->dst);
|
||||
else
|
||||
ctx = sgsn_mm_ctx_alloc(msgb_tlli(msg), &ra_id);
|
||||
ctx = sgsn_mm_ctx_alloc_gb(msgb_tlli(msg), &ra_id);
|
||||
ctx->p_tmsi = tmsi;
|
||||
}
|
||||
if (ctx->ran_type == MM_CTX_T_GERAN_Gb) {
|
||||
@@ -1233,11 +1251,11 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||
#ifdef PTMSI_ALLOC
|
||||
/* Allocate a new P-TMSI (+ P-TMSI signature) and update TLLI */
|
||||
/* Don't change the P-TMSI if a P-TMSI re-assignment is under way */
|
||||
if (ctx->mm_state != GMM_COMMON_PROC_INIT) {
|
||||
if (ctx->gmm_state != GMM_COMMON_PROC_INIT) {
|
||||
ctx->p_tmsi_old = ctx->p_tmsi;
|
||||
ctx->p_tmsi = sgsn_alloc_ptmsi();
|
||||
}
|
||||
ctx->mm_state = GMM_COMMON_PROC_INIT;
|
||||
ctx->gmm_state = GMM_COMMON_PROC_INIT;
|
||||
#endif
|
||||
|
||||
if (ctx->ran_type == MM_CTX_T_GERAN_Gb) {
|
||||
@@ -1423,7 +1441,7 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
struct gprs_ra_id old_ra_id;
|
||||
struct tlv_parsed tp;
|
||||
uint8_t upd_type;
|
||||
enum gsm48_gmm_cause reject_cause;
|
||||
enum gsm48_gmm_cause reject_cause = GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
int rc;
|
||||
|
||||
/* TODO: In iu mode - handle follow-on request */
|
||||
@@ -1508,10 +1526,10 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
mmctx->ra.mcc, mmctx->ra.mnc,
|
||||
mmctx->ra.lac, mmctx->ra.rac);
|
||||
|
||||
mmctx->mm_state = GMM_COMMON_PROC_INIT;
|
||||
mmctx->gmm_state = GMM_COMMON_PROC_INIT;
|
||||
}
|
||||
} else if (!gprs_ra_id_equals(&mmctx->ra, &old_ra_id) ||
|
||||
mmctx->mm_state == GMM_DEREGISTERED)
|
||||
mmctx->gmm_state == GMM_DEREGISTERED)
|
||||
{
|
||||
/* We cannot use the mmctx */
|
||||
LOGMMCTXP(LOGL_INFO, mmctx,
|
||||
@@ -1553,7 +1571,7 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
|
||||
#ifdef PTMSI_ALLOC
|
||||
/* Don't change the P-TMSI if a P-TMSI re-assignment is under way */
|
||||
if (mmctx->mm_state != GMM_COMMON_PROC_INIT) {
|
||||
if (mmctx->gmm_state != GMM_COMMON_PROC_INIT) {
|
||||
mmctx->p_tmsi_old = mmctx->p_tmsi;
|
||||
mmctx->p_tmsi = sgsn_alloc_ptmsi();
|
||||
}
|
||||
@@ -1561,10 +1579,10 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
mmctx->t3350_mode = GMM_T3350_MODE_RAU;
|
||||
mmctx_timer_start(mmctx, 3350, sgsn->cfg.timers.T3350);
|
||||
|
||||
mmctx->mm_state = GMM_COMMON_PROC_INIT;
|
||||
mmctx->gmm_state = GMM_COMMON_PROC_INIT;
|
||||
#else
|
||||
/* Make sure we are NORMAL (i.e. not SUSPENDED anymore) */
|
||||
mmctx->mm_state = GMM_REGISTERED_NORMAL;
|
||||
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
|
||||
|
||||
memset(&sig_data, 0, sizeof(sig_data));
|
||||
sig_data.mm = mmctx;
|
||||
@@ -1687,7 +1705,7 @@ static int gsm48_rx_gmm_service_req(struct sgsn_mm_ctx *ctx, struct msgb *msg)
|
||||
goto rejected;
|
||||
}
|
||||
|
||||
ctx->mm_state = GMM_COMMON_PROC_INIT;
|
||||
ctx->gmm_state = GMM_COMMON_PROC_INIT;
|
||||
|
||||
ctx->iu.service.type = service_type;
|
||||
|
||||
@@ -1839,8 +1857,9 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
gprs_llgmm_assign(mmctx->gb.llme, 0xffffffff,
|
||||
mmctx->gb.tlli_new);
|
||||
}
|
||||
mmctx->mm_state = GMM_REGISTERED_NORMAL;
|
||||
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
|
||||
mmctx_set_pmm_state(mmctx, PMM_CONNECTED);
|
||||
mmctx_set_mm_state(mmctx, MM_READY);
|
||||
rc = 0;
|
||||
|
||||
memset(&sig_data, 0, sizeof(sig_data));
|
||||
@@ -1862,8 +1881,9 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
gprs_llgmm_assign(mmctx->gb.llme, 0xffffffff,
|
||||
mmctx->gb.tlli_new);
|
||||
}
|
||||
mmctx->mm_state = GMM_REGISTERED_NORMAL;
|
||||
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
|
||||
mmctx_set_pmm_state(mmctx, PMM_CONNECTED);
|
||||
mmctx_set_mm_state(mmctx, MM_READY);
|
||||
rc = 0;
|
||||
|
||||
memset(&sig_data, 0, sizeof(sig_data));
|
||||
@@ -1986,7 +2006,7 @@ static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T,
|
||||
unsigned int seconds)
|
||||
{
|
||||
if (osmo_timer_pending(&pdp->timer))
|
||||
LOGMMCTXP(LOGL_ERROR, pdp->mm, "Starting MM timer %u while old "
|
||||
LOGPDPCTXP(LOGL_ERROR, pdp, "Starting PDP timer %u while old "
|
||||
"timer %u pending\n", T, pdp->T);
|
||||
pdp->T = T;
|
||||
pdp->num_T_exp = 0;
|
||||
@@ -1998,6 +2018,14 @@ static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T,
|
||||
osmo_timer_schedule(&pdp->timer, seconds, 0);
|
||||
}
|
||||
|
||||
static void pdpctx_timer_stop(struct sgsn_pdp_ctx *pdp, unsigned int T)
|
||||
{
|
||||
if (pdp->T != T)
|
||||
LOGPDPCTXP(LOGL_ERROR, pdp, "Stopping PDP timer %u but "
|
||||
"%u is running\n", T, pdp->T);
|
||||
osmo_timer_del(&pdp->timer);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void msgb_put_pdp_addr_ipv4(struct msgb *msg, uint32_t ipaddr)
|
||||
{
|
||||
@@ -2169,6 +2197,7 @@ static void ggsn_lookup_cb(void *arg, int status, int timeouts, struct hostent *
|
||||
|
||||
/* The context is gone while we made a request */
|
||||
if (!lookup->mmctx) {
|
||||
talloc_free(lookup->orig_msg);
|
||||
talloc_free(lookup);
|
||||
return;
|
||||
}
|
||||
@@ -2230,6 +2259,7 @@ static void ggsn_lookup_cb(void *arg, int status, int timeouts, struct hostent *
|
||||
lookup->sapi, &lookup->tp, 1);
|
||||
|
||||
/* Now free it */
|
||||
talloc_free(lookup->orig_msg);
|
||||
talloc_free(lookup);
|
||||
return;
|
||||
|
||||
@@ -2237,10 +2267,11 @@ reject_due_failure:
|
||||
gsm48_tx_gsm_act_pdp_rej(lookup->mmctx, lookup->ti,
|
||||
GMM_CAUSE_NET_FAIL, 0, NULL);
|
||||
lookup->mmctx->ggsn_lookup = NULL;
|
||||
talloc_free(lookup->orig_msg);
|
||||
talloc_free(lookup);
|
||||
}
|
||||
|
||||
static int do_act_pdp_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg)
|
||||
static int do_act_pdp_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg, bool *delete)
|
||||
{
|
||||
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
|
||||
struct gsm48_act_pdp_ctx_req *act_req = (struct gsm48_act_pdp_ctx_req *) gh->data;
|
||||
@@ -2389,6 +2420,7 @@ static int do_act_pdp_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg)
|
||||
LOGMMCTXP(LOGL_ERROR, mmctx, "Failed to start ares query.\n");
|
||||
goto no_context;
|
||||
}
|
||||
*delete = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -2402,6 +2434,7 @@ no_context:
|
||||
static int gsm48_rx_gsm_act_pdp_req(struct sgsn_mm_ctx *mmctx,
|
||||
struct msgb *_msg)
|
||||
{
|
||||
bool delete = 1;
|
||||
struct msgb *msg;
|
||||
int rc;
|
||||
|
||||
@@ -2428,8 +2461,9 @@ static int gsm48_rx_gsm_act_pdp_req(struct sgsn_mm_ctx *mmctx,
|
||||
0, NULL);
|
||||
}
|
||||
|
||||
rc = do_act_pdp_req(mmctx, _msg);
|
||||
msgb_free(msg);
|
||||
rc = do_act_pdp_req(mmctx, msg, &delete);
|
||||
if (delete)
|
||||
msgb_free(msg);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2472,7 +2506,8 @@ static int gsm48_rx_gsm_deact_pdp_ack(struct sgsn_mm_ctx *mm, struct msgb *msg)
|
||||
mm->imsi, transaction_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* stop timer 3395 */
|
||||
pdpctx_timer_stop(pdp, 3395);
|
||||
return sgsn_delete_pdp_ctx(pdp);
|
||||
}
|
||||
|
||||
@@ -2675,15 +2710,15 @@ int gprs_gmm_rx_suspend(struct gprs_ra_id *raid, uint32_t tlli)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (mmctx->mm_state != GMM_REGISTERED_NORMAL &&
|
||||
mmctx->mm_state != GMM_REGISTERED_SUSPENDED) {
|
||||
if (mmctx->gmm_state != GMM_REGISTERED_NORMAL &&
|
||||
mmctx->gmm_state != GMM_REGISTERED_SUSPENDED) {
|
||||
LOGMMCTXP(LOGL_NOTICE, mmctx, "SUSPEND request while state "
|
||||
"!= REGISTERED (TLLI=%08x)\n", tlli);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Transition from REGISTERED_NORMAL to REGISTERED_SUSPENDED */
|
||||
mmctx->mm_state = GMM_REGISTERED_SUSPENDED;
|
||||
mmctx->gmm_state = GMM_REGISTERED_SUSPENDED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2701,8 +2736,8 @@ int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (mmctx->mm_state != GMM_REGISTERED_NORMAL &&
|
||||
mmctx->mm_state != GMM_REGISTERED_SUSPENDED) {
|
||||
if (mmctx->gmm_state != GMM_REGISTERED_NORMAL &&
|
||||
mmctx->gmm_state != GMM_REGISTERED_SUSPENDED) {
|
||||
LOGMMCTXP(LOGL_NOTICE, mmctx, "RESUME request while state "
|
||||
"!= SUSPENDED (TLLI=%08x)\n", tlli);
|
||||
/* FIXME: should we not simply ignore it? */
|
||||
@@ -2710,7 +2745,7 @@ int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli,
|
||||
}
|
||||
|
||||
/* Transition from SUSPENDED to NORMAL */
|
||||
mmctx->mm_state = GMM_REGISTERED_NORMAL;
|
||||
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <openbsc/gprs_llc.h>
|
||||
#include <openbsc/crc24.h>
|
||||
#include <openbsc/sgsn.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <openbsc/gprs_llc_xid.h>
|
||||
#include <openbsc/gprs_sndcp_comp.h>
|
||||
#include <openbsc/gprs_sndcp.h>
|
||||
@@ -77,9 +78,9 @@ static int gprs_llc_generate_xid(uint8_t *bytes, int bytes_len,
|
||||
xid_n201i.data_len = 2;
|
||||
|
||||
/* Add locally managed XID Fields */
|
||||
llist_add(&xid_n201i.list, &xid_fields);
|
||||
llist_add(&xid_n201u.list, &xid_fields);
|
||||
llist_add(&xid_version.list, &xid_fields);
|
||||
llist_add(&xid_n201u.list, &xid_fields);
|
||||
llist_add(&xid_n201i.list, &xid_fields);
|
||||
|
||||
/* Append layer 3 XID field (if present) */
|
||||
if (l3_xid_field) {
|
||||
@@ -136,7 +137,7 @@ static int gprs_llc_process_xid_conf(uint8_t *bytes, int bytes_len,
|
||||
struct gprs_llc_lle *lle)
|
||||
{
|
||||
/* Note: This function handles the response of a network originated
|
||||
* XID-Request. There XID messages reflected by the phone are analyzed
|
||||
* XID-Request. There XID messages reflected by the MS are analyzed
|
||||
* and processed here. The caller is called by rx_llc_xid(). */
|
||||
|
||||
struct llist_head *xid_fields;
|
||||
@@ -178,8 +179,10 @@ static int gprs_llc_process_xid_conf(uint8_t *bytes, int bytes_len,
|
||||
* inquiry. There is a remainig risk of
|
||||
* malfunction! */
|
||||
LOGP(DLLC, LOGL_NOTICE,
|
||||
"Ignoring XID-Field: XID: type=%d, data_len=%d, data=%s\n",
|
||||
xid_field->type, xid_field->data_len,
|
||||
"Ignoring XID-Field: XID: type %s, data_len=%d, data=%s\n",
|
||||
get_value_string(gprs_llc_xid_type_names,
|
||||
xid_field->type),
|
||||
xid_field->data_len,
|
||||
osmo_hexdump_nospc(xid_field->data,
|
||||
xid_field->data_len));
|
||||
}
|
||||
@@ -202,7 +205,7 @@ static int gprs_llc_process_xid_ind(uint8_t *bytes_request,
|
||||
struct gprs_llc_lle *lle)
|
||||
{
|
||||
/* Note: This function computes the response that is sent back to the
|
||||
* phone when a phone originated XID is received. The function is
|
||||
* MS when a mobile originated XID is received. The function is
|
||||
* called by rx_llc_xid() */
|
||||
|
||||
int rc = -EINVAL;
|
||||
@@ -229,11 +232,13 @@ static int gprs_llc_process_xid_ind(uint8_t *bytes_request,
|
||||
* for validity. Currently we just blindly
|
||||
* accept all XID fields by just echoing them.
|
||||
* There is a remaining risk of malfunction
|
||||
* when a phone submits values which defer from
|
||||
* when a MS submits values which defer from
|
||||
* the default! */
|
||||
LOGP(DLLC, LOGL_NOTICE,
|
||||
"Echoing XID-Field: XID: type=%d, data_len=%d, data=%s\n",
|
||||
xid_field->type, xid_field->data_len,
|
||||
"Echoing XID-Field: XID: type %s, data_len=%d, data=%s\n",
|
||||
get_value_string(gprs_llc_xid_type_names,
|
||||
xid_field->type),
|
||||
xid_field->data_len,
|
||||
osmo_hexdump_nospc(xid_field->data,
|
||||
xid_field->data_len));
|
||||
xid_field_response =
|
||||
@@ -271,7 +276,7 @@ static int gprs_llc_process_xid_ind(uint8_t *bytes_request,
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Dispatch XID indications and responses comming from the Phone */
|
||||
/* Dispatch XID indications and responses comming from the MS */
|
||||
static void rx_llc_xid(struct gprs_llc_lle *lle,
|
||||
struct gprs_llc_hdr_parsed *gph)
|
||||
{
|
||||
@@ -281,7 +286,7 @@ static void rx_llc_xid(struct gprs_llc_lle *lle,
|
||||
/* FIXME: 8.5.3.3: check if XID is invalid */
|
||||
if (gph->is_cmd) {
|
||||
LOGP(DLLC, LOGL_NOTICE,
|
||||
"Received XID indication from phone.\n");
|
||||
"Received XID indication from MS.\n");
|
||||
|
||||
struct msgb *resp;
|
||||
uint8_t *xid;
|
||||
@@ -301,14 +306,13 @@ static void rx_llc_xid(struct gprs_llc_lle *lle,
|
||||
gprs_llc_tx_xid(lle, resp, 0);
|
||||
} else {
|
||||
LOGP(DLLC, LOGL_NOTICE,
|
||||
"Received XID confirmation from phone.\n");
|
||||
"Received XID confirmation from MS.\n");
|
||||
gprs_llc_process_xid_conf(gph->data, gph->data_len, lle);
|
||||
/* FIXME: if we had sent a XID reset, send
|
||||
* LLGMM-RESET.conf to GMM */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set of LL-XID negotiation (See also: TS 101 351, Section 7.2.2.4) */
|
||||
int gprs_ll_xid_req(struct gprs_llc_lle *lle,
|
||||
struct gprs_llc_xid_field *l3_xid_field)
|
||||
@@ -319,6 +323,7 @@ int gprs_ll_xid_req(struct gprs_llc_lle *lle,
|
||||
int xid_bytes_len;
|
||||
uint8_t *xid;
|
||||
struct msgb *msg;
|
||||
const char *ftype;
|
||||
|
||||
/* Generate XID */
|
||||
xid_bytes_len =
|
||||
@@ -331,7 +336,13 @@ int gprs_ll_xid_req(struct gprs_llc_lle *lle,
|
||||
msg = msgb_alloc_headroom(4096, 1024, "LLC_XID");
|
||||
xid = msgb_put(msg, xid_bytes_len);
|
||||
memcpy(xid, xid_bytes, xid_bytes_len);
|
||||
LOGP(DLLC, LOGL_NOTICE, "Sending XID request to phone...\n");
|
||||
if (l3_xid_field)
|
||||
ftype = get_value_string(gprs_llc_xid_type_names,
|
||||
l3_xid_field->type);
|
||||
else
|
||||
ftype = "NULL";
|
||||
LOGP(DLLC, LOGL_NOTICE, "Sending XID type %s (%d bytes) request"
|
||||
" to MS...\n", ftype, xid_bytes_len);
|
||||
gprs_llc_tx_xid(lle, msg, 1);
|
||||
} else {
|
||||
LOGP(DLLC, LOGL_ERROR,
|
||||
@@ -774,6 +785,9 @@ int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command,
|
||||
}
|
||||
}
|
||||
|
||||
rate_ctr_inc(&sgsn->rate_ctrs->ctr[CTR_LLC_DL_PACKETS]);
|
||||
rate_ctr_add(&sgsn->rate_ctrs->ctr[CTR_LLC_DL_BYTES], msg->len);
|
||||
|
||||
/* Identifiers passed down: (BVCI, NSEI) */
|
||||
|
||||
/* Send BSSGP-DL-UNITDATA.req */
|
||||
@@ -855,7 +869,7 @@ int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv)
|
||||
{
|
||||
struct gprs_llc_hdr *lh = (struct gprs_llc_hdr *) msgb_llch(msg);
|
||||
struct gprs_llc_hdr_parsed llhp;
|
||||
struct gprs_llc_lle *lle;
|
||||
struct gprs_llc_lle *lle = NULL;
|
||||
bool drop_cipherable = false;
|
||||
int rc = 0;
|
||||
|
||||
@@ -863,7 +877,6 @@ int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv)
|
||||
|
||||
memset(&llhp, 0, sizeof(llhp));
|
||||
rc = gprs_llc_hdr_parse(&llhp, (uint8_t *) lh, TLVP_LEN(tv, BSSGP_IE_LLC_PDU));
|
||||
gprs_llc_hdr_dump(&llhp);
|
||||
if (rc < 0) {
|
||||
LOGP(DLLC, LOGL_NOTICE, "Error during LLC header parsing\n");
|
||||
return rc;
|
||||
@@ -896,7 +909,7 @@ int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
gprs_llc_hdr_dump(&llhp, lle);
|
||||
/* reset age computation */
|
||||
lle->llme->age_timestamp = GPRS_LLME_RESET_AGE;
|
||||
|
||||
|
||||
@@ -67,11 +67,19 @@ int gprs_llc_fcs(uint8_t *data, unsigned int len)
|
||||
return fcs_calc;
|
||||
}
|
||||
|
||||
void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph)
|
||||
void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph, struct gprs_llc_lle *lle)
|
||||
{
|
||||
DEBUGP(DLLC, "LLC SAPI=%u %c %c FCS=0x%06x",
|
||||
gph->sapi, gph->is_cmd ? 'C' : 'R', gph->ack_req ? 'A' : ' ',
|
||||
gph->fcs);
|
||||
const char *gea;
|
||||
uint32_t iov_ui = 0;
|
||||
if (lle) {
|
||||
gea = get_value_string(gprs_cipher_names, lle->llme->algo);
|
||||
iov_ui = lle->llme->iov_ui;
|
||||
} else
|
||||
gea = "GEA?";
|
||||
DEBUGP(DLLC, "LLC SAPI=%u %c %c %c %s IOV-UI=0x%06x FCS=0x%06x ",
|
||||
gph->sapi, gph->is_cmd ? 'C' : 'R', gph->ack_req ? 'A' : ' ',
|
||||
gph->is_encrypted ? 'E' : 'U',
|
||||
gea, iov_ui, gph->fcs);
|
||||
|
||||
if (gph->cmd)
|
||||
DEBUGPC(DLLC, "CMD=%s ", get_value_string(llc_cmd_strs, gph->cmd));
|
||||
|
||||
@@ -73,9 +73,11 @@ static void vty_dump_llme(struct vty *vty, struct gprs_llc_llme *llme)
|
||||
struct timespec now_tp = {0};
|
||||
clock_gettime(CLOCK_MONOTONIC, &now_tp);
|
||||
|
||||
vty_out(vty, "TLLI %08x (Old TLLI %08x) BVCI=%u NSEI=%u Age=%d: State %s%s",
|
||||
llme->tlli, llme->old_tlli, llme->bvci, llme->nsei,
|
||||
llme->age_timestamp == GPRS_LLME_RESET_AGE ? 0 :
|
||||
vty_out(vty, "TLLI %08x (Old TLLI %08x) BVCI=%u NSEI=%u %s: "
|
||||
"IOV-UI=0x%06x CKSN=%d Age=%d: State %s%s", llme->tlli,
|
||||
llme->old_tlli, llme->bvci, llme->nsei,
|
||||
get_value_string(gprs_cipher_names, llme->algo), llme->iov_ui,
|
||||
llme->cksn, llme->age_timestamp == GPRS_LLME_RESET_AGE ? 0 :
|
||||
(int)(now_tp.tv_sec - (time_t)llme->age_timestamp),
|
||||
get_value_string(gprs_llc_state_strs, llme->state), VTY_NEWLINE);
|
||||
|
||||
|
||||
@@ -35,6 +35,23 @@
|
||||
#include <openbsc/sgsn.h>
|
||||
#include <openbsc/gprs_llc_xid.h>
|
||||
|
||||
const struct value_string gprs_llc_xid_type_names[] = {
|
||||
{ GPRS_LLC_XID_T_VERSION, "VERSION"},
|
||||
{ GPRS_LLC_XID_T_IOV_UI, "IOV_UI"},
|
||||
{ GPRS_LLC_XID_T_IOV_I, "IOV_I"},
|
||||
{ GPRS_LLC_XID_T_T200, "T200"},
|
||||
{ GPRS_LLC_XID_T_N200, "N200"},
|
||||
{ GPRS_LLC_XID_T_N201_U, "N201_"},
|
||||
{ GPRS_LLC_XID_T_N201_I, "N201_I"},
|
||||
{ GPRS_LLC_XID_T_mD, "mD"},
|
||||
{ GPRS_LLC_XID_T_mU, "mU"},
|
||||
{ GPRS_LLC_XID_T_kD, "kD"},
|
||||
{ GPRS_LLC_XID_T_kU, "kU"},
|
||||
{ GPRS_LLC_XID_T_L3_PAR, "L3_PAR"},
|
||||
{ GPRS_LLC_XID_T_RESET, "RESET"},
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
/* Parse XID parameter field */
|
||||
static int decode_xid_field(struct gprs_llc_xid_field *xid_field,
|
||||
const uint8_t *src, uint8_t src_len)
|
||||
@@ -249,8 +266,10 @@ void gprs_llc_dump_xid_fields(const struct llist_head *xid_fields,
|
||||
if (xid_field->data_len) {
|
||||
OSMO_ASSERT(xid_field->data);
|
||||
LOGP(DLLC, logl,
|
||||
"XID: type=%d, data_len=%d, data=%s\n",
|
||||
xid_field->type, xid_field->data_len,
|
||||
"XID: type %s, data_len=%d, data=%s\n",
|
||||
get_value_string(gprs_llc_xid_type_names,
|
||||
xid_field->type),
|
||||
xid_field->data_len,
|
||||
osmo_hexdump_nospc(xid_field->data,
|
||||
xid_field->data_len));
|
||||
} else {
|
||||
|
||||
@@ -209,8 +209,8 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi)
|
||||
|
||||
}
|
||||
|
||||
/* Allocate a new SGSN MM context */
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli,
|
||||
/* Allocate a new SGSN MM context for GERAN_Gb */
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_gb(uint32_t tlli,
|
||||
const struct gprs_ra_id *raid)
|
||||
{
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
@@ -222,9 +222,12 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli,
|
||||
memcpy(&ctx->ra, raid, sizeof(ctx->ra));
|
||||
ctx->ran_type = MM_CTX_T_GERAN_Gb;
|
||||
ctx->gb.tlli = tlli;
|
||||
ctx->mm_state = GMM_DEREGISTERED;
|
||||
ctx->gmm_state = GMM_DEREGISTERED;
|
||||
ctx->pmm_state = MM_IDLE;
|
||||
ctx->auth_triplet.key_seq = GSM_KEY_SEQ_INVAL;
|
||||
ctx->ciph_algo = sgsn->cfg.cipher;
|
||||
LOGMMCTXP(LOGL_DEBUG, ctx, "Allocated with %s cipher.\n",
|
||||
get_value_string(gprs_cipher_names, ctx->ciph_algo));
|
||||
ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, tlli);
|
||||
INIT_LLIST_HEAD(&ctx->pdp_list);
|
||||
|
||||
@@ -245,7 +248,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx)
|
||||
ctx->ran_type = MM_CTX_T_UTRAN_Iu;
|
||||
ctx->iu.ue_ctx = uectx;
|
||||
ctx->iu.new_key = 1;
|
||||
ctx->mm_state = GMM_DEREGISTERED;
|
||||
ctx->gmm_state = GMM_DEREGISTERED;
|
||||
ctx->pmm_state = PMM_DETACHED;
|
||||
ctx->auth_triplet.key_seq = GSM_KEY_SEQ_INVAL;
|
||||
ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, 0);
|
||||
@@ -656,7 +659,7 @@ failed:
|
||||
|
||||
static void drop_one_pdp(struct sgsn_pdp_ctx *pdp)
|
||||
{
|
||||
if (pdp->mm->mm_state == GMM_REGISTERED_NORMAL)
|
||||
if (pdp->mm->gmm_state == GMM_REGISTERED_NORMAL)
|
||||
gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_NET_FAIL);
|
||||
else {
|
||||
/* FIXME: GPRS paging in case MS is SUSPENDED */
|
||||
|
||||
@@ -911,6 +911,7 @@ static int sndcp_rx_llc_prim()
|
||||
case LL_DATA_CONF:
|
||||
case LL_UNITDATA_IND:
|
||||
case LL_STATUS_IND:
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -960,8 +961,13 @@ static int gprs_llc_gen_sndcp_xid(uint8_t *bytes, int bytes_len, uint8_t nsapi)
|
||||
llist_add(&v42bis_comp_field.list, &comp_fields);
|
||||
}
|
||||
|
||||
/* Do not attempt to compile anything if there is no data in the list */
|
||||
if (llist_empty(&comp_fields))
|
||||
return 0;
|
||||
|
||||
/* Compile bytestream */
|
||||
return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields);
|
||||
return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields,
|
||||
DEFAULT_SNDCP_VERSION);
|
||||
}
|
||||
|
||||
/* Set of SNDCP-XID bnegotiation (See also: TS 144 065,
|
||||
@@ -1106,6 +1112,7 @@ int sndcp_sn_xid_ind(struct gprs_llc_xid_field *xid_field_indication,
|
||||
|
||||
int rc;
|
||||
int compclass;
|
||||
int version;
|
||||
|
||||
struct llist_head *comp_fields;
|
||||
struct gprs_sndcp_comp_field *comp_field;
|
||||
@@ -1115,22 +1122,13 @@ int sndcp_sn_xid_ind(struct gprs_llc_xid_field *xid_field_indication,
|
||||
OSMO_ASSERT(lle);
|
||||
|
||||
/* Parse SNDCP-CID XID-Field */
|
||||
comp_fields = gprs_sndcp_parse_xid(lle->llme,
|
||||
comp_fields = gprs_sndcp_parse_xid(&version, lle->llme,
|
||||
xid_field_indication->data,
|
||||
xid_field_indication->data_len,
|
||||
NULL);
|
||||
if (!comp_fields)
|
||||
return -EINVAL;
|
||||
|
||||
/* Don't bother with empty indications */
|
||||
if (llist_empty(comp_fields)) {
|
||||
xid_field_response->data = NULL;
|
||||
xid_field_response->data_len = 0;
|
||||
DEBUGP(DSNDCP,
|
||||
"SNDCP-XID indication did not contain any parameters!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Handle compression entites */
|
||||
DEBUGP(DSNDCP, "SNDCP-XID-IND (ms):\n");
|
||||
gprs_sndcp_dump_comp_fields(comp_fields, LOGL_DEBUG);
|
||||
@@ -1168,7 +1166,7 @@ int sndcp_sn_xid_ind(struct gprs_llc_xid_field *xid_field_indication,
|
||||
/* Compile modified SNDCP-XID bytes */
|
||||
rc = gprs_sndcp_compile_xid(xid_field_response->data,
|
||||
xid_field_indication->data_len,
|
||||
comp_fields);
|
||||
comp_fields, 0);
|
||||
|
||||
if (rc > 0)
|
||||
xid_field_response->data_len = rc;
|
||||
@@ -1210,7 +1208,7 @@ int sndcp_sn_xid_conf(struct gprs_llc_xid_field *xid_field_conf,
|
||||
OSMO_ASSERT(xid_field_request);
|
||||
|
||||
/* Parse SNDCP-CID XID-Field */
|
||||
comp_fields_req = gprs_sndcp_parse_xid(lle->llme,
|
||||
comp_fields_req = gprs_sndcp_parse_xid(NULL, lle->llme,
|
||||
xid_field_request->data,
|
||||
xid_field_request->data_len,
|
||||
NULL);
|
||||
@@ -1221,7 +1219,7 @@ int sndcp_sn_xid_conf(struct gprs_llc_xid_field *xid_field_conf,
|
||||
gprs_sndcp_dump_comp_fields(comp_fields_req, LOGL_DEBUG);
|
||||
|
||||
/* Parse SNDCP-CID XID-Field */
|
||||
comp_fields_conf = gprs_sndcp_parse_xid(lle->llme,
|
||||
comp_fields_conf = gprs_sndcp_parse_xid(NULL, lle->llme,
|
||||
xid_field_conf->data,
|
||||
xid_field_conf->data_len,
|
||||
comp_fields_req);
|
||||
|
||||
@@ -70,9 +70,9 @@ static struct gprs_sndcp_comp *gprs_sndcp_comp_create(const void *ctx,
|
||||
comp_field->v42bis_params->nsapi,
|
||||
sizeof(comp_entity->nsapi));
|
||||
} else if (comp_field->v44_params) {
|
||||
comp_entity->nsapi_len = comp_field->v42bis_params->nsapi_len;
|
||||
comp_entity->nsapi_len = comp_field->v44_params->nsapi_len;
|
||||
memcpy(comp_entity->nsapi,
|
||||
comp_field->v42bis_params->nsapi,
|
||||
comp_field->v44_params->nsapi,
|
||||
sizeof(comp_entity->nsapi));
|
||||
} else {
|
||||
/* The caller is expected to check carefully if the all
|
||||
@@ -107,13 +107,14 @@ static struct gprs_sndcp_comp *gprs_sndcp_comp_create(const void *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
/* Display info message */
|
||||
/* Bail on failure */
|
||||
if (comp_entity == NULL) {
|
||||
LOGP(DSNDCP, LOGL_ERROR,
|
||||
"Compression entity (%d) creation failed!\n",
|
||||
comp_entity->entity);
|
||||
"Compression entity creation failed!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Display info message */
|
||||
if (comp_entity->compclass == SNDCP_XID_PROTOCOL_COMPRESSION) {
|
||||
LOGP(DSNDCP, LOGL_INFO,
|
||||
"New header compression entity (%d) created.\n",
|
||||
|
||||
@@ -84,6 +84,7 @@ int gprs_sndcp_dcomp_init(const void *ctx, struct gprs_sndcp_comp *comp_entity,
|
||||
|
||||
if (comp_entity->compclass == SNDCP_XID_DATA_COMPRESSION
|
||||
&& comp_entity->algo == V42BIS) {
|
||||
OSMO_ASSERT(comp_field->v42bis_params);
|
||||
comp_entity->state =
|
||||
v42bis_init(ctx, NULL, comp_field->v42bis_params->p0,
|
||||
comp_field->v42bis_params->p1,
|
||||
|
||||
@@ -54,6 +54,7 @@ int gprs_sndcp_pcomp_init(const void *ctx, struct gprs_sndcp_comp *comp_entity,
|
||||
|
||||
if (comp_entity->compclass == SNDCP_XID_PROTOCOL_COMPRESSION
|
||||
&& comp_entity->algo == RFC_1144) {
|
||||
OSMO_ASSERT(comp_field->rfc1144_params);
|
||||
comp_entity->state =
|
||||
slhc_init(ctx, comp_field->rfc1144_params->s01 + 1,
|
||||
comp_field->rfc1144_params->s01 + 1);
|
||||
@@ -141,6 +142,7 @@ static int rfc1144_expand(uint8_t *data, unsigned int len, uint8_t pcomp_index,
|
||||
switch (pcomp_index) {
|
||||
case 0:
|
||||
type = SL_TYPE_IP;
|
||||
break;
|
||||
case 1:
|
||||
type = SL_TYPE_UNCOMPRESSED_TCP;
|
||||
break;
|
||||
|
||||
@@ -206,7 +206,6 @@ static int encode_pcomp_rohc_params(uint8_t *dst, unsigned int dst_maxlen,
|
||||
|
||||
/* Bail if number of ROHC profiles exceeds limit
|
||||
* (ROHC supports only a maximum of 16 different profiles) */
|
||||
OSMO_ASSERT(params->profile_len >= 0);
|
||||
OSMO_ASSERT(params->profile_len <= 16);
|
||||
|
||||
/* Zero out buffer */
|
||||
@@ -475,8 +474,7 @@ static int encode_comp_field(uint8_t *dst, unsigned int dst_maxlen,
|
||||
for (i = 0; i < comp_field->comp_len; i++) {
|
||||
/* Check if submitted PCOMP/DCOMP
|
||||
values are within bounds */
|
||||
if ((comp_field->comp[i] < 0)
|
||||
|| (comp_field->comp[i] > 0x0F))
|
||||
if (comp_field->comp[i] > 0x0F)
|
||||
return -EINVAL;
|
||||
|
||||
if (i & 1) {
|
||||
@@ -551,26 +549,29 @@ static int gprs_sndcp_pack_fields(const struct llist_head *comp_fields,
|
||||
|
||||
/* Transform a list with compression fields into an SNDCP-XID message (dst) */
|
||||
int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen,
|
||||
const struct llist_head *comp_fields)
|
||||
const struct llist_head *comp_fields, int version)
|
||||
{
|
||||
int rc;
|
||||
int byte_counter = 0;
|
||||
uint8_t comp_bytes[512];
|
||||
uint8_t xid_version_number[1] = { CURRENT_SNDCP_VERSION };
|
||||
uint8_t xid_version_number[1];
|
||||
|
||||
OSMO_ASSERT(comp_fields);
|
||||
OSMO_ASSERT(dst);
|
||||
OSMO_ASSERT(dst_maxlen >= 2 + sizeof(xid_version_number));
|
||||
|
||||
/* Bail if there is no input */
|
||||
if (llist_empty(comp_fields))
|
||||
return -EINVAL;
|
||||
/* Prepend header with version number */
|
||||
if (version >= 0) {
|
||||
xid_version_number[0] = (uint8_t) (version & 0xff);
|
||||
dst =
|
||||
tlv_put(dst, SNDCP_XID_VERSION_NUMBER,
|
||||
sizeof(xid_version_number), xid_version_number);
|
||||
byte_counter += (sizeof(xid_version_number) + 2);
|
||||
}
|
||||
|
||||
/* Prepend header */
|
||||
dst =
|
||||
tlv_put(dst, SNDCP_XID_VERSION_NUMBER,
|
||||
sizeof(xid_version_number), xid_version_number);
|
||||
byte_counter += (sizeof(xid_version_number) + 2);
|
||||
/* Stop if there is no compression fields supplied */
|
||||
if (llist_empty(comp_fields))
|
||||
return byte_counter;
|
||||
|
||||
/* Add data compression fields */
|
||||
rc = gprs_sndcp_pack_fields(comp_fields, comp_bytes,
|
||||
@@ -1285,11 +1286,10 @@ static int decode_xid_block(struct llist_head *comp_fields, uint8_t tag,
|
||||
}
|
||||
|
||||
/* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */
|
||||
static int gprs_sndcp_decode_xid(struct llist_head *comp_fields,
|
||||
static int gprs_sndcp_decode_xid(int *version, struct llist_head *comp_fields,
|
||||
const uint8_t *src, unsigned int src_len,
|
||||
const struct
|
||||
entity_algo_table
|
||||
*lt, unsigned int lt_len)
|
||||
const struct entity_algo_table *lt,
|
||||
unsigned int lt_len)
|
||||
{
|
||||
int src_pos = 0;
|
||||
uint8_t tag;
|
||||
@@ -1299,6 +1299,10 @@ static int gprs_sndcp_decode_xid(struct llist_head *comp_fields,
|
||||
int rc;
|
||||
int tlv_count = 0;
|
||||
|
||||
/* Preset version value as invalid */
|
||||
if (version)
|
||||
*version = -1;
|
||||
|
||||
/* Valid TLV-Tag and types */
|
||||
static const struct tlv_definition sndcp_xid_def = {
|
||||
.def = {
|
||||
@@ -1329,6 +1333,10 @@ static int gprs_sndcp_decode_xid(struct llist_head *comp_fields,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Decode sndcp xid version number */
|
||||
if (version && tag == SNDCP_XID_VERSION_NUMBER)
|
||||
*version = val[0];
|
||||
|
||||
/* Decode compression parameters */
|
||||
if ((tag == SNDCP_XID_PROTOCOL_COMPRESSION)
|
||||
|| (tag == SNDCP_XID_DATA_COMPRESSION)) {
|
||||
@@ -1360,26 +1368,29 @@ static int gprs_sndcp_fill_table(struct
|
||||
{
|
||||
struct gprs_sndcp_comp_field *comp_field;
|
||||
int i = 0;
|
||||
int rc;
|
||||
|
||||
if (!comp_fields)
|
||||
return -EINVAL;
|
||||
if (!lt)
|
||||
return -EINVAL;
|
||||
|
||||
memset(lt, 0, lt_len * sizeof(lt));
|
||||
memset(lt, 0, sizeof(*lt));
|
||||
|
||||
llist_for_each_entry(comp_field, comp_fields, list) {
|
||||
if (comp_field->algo >= 0) {
|
||||
lt[i].entity = comp_field->entity;
|
||||
lt[i].algo = comp_field->algo;
|
||||
rc = gprs_sndcp_get_compression_class(comp_field);
|
||||
|
||||
lt[i].entity = comp_field->entity;
|
||||
lt[i].algo = comp_field->algo;
|
||||
lt[i].compclass = gprs_sndcp_get_compression_class(comp_field);
|
||||
if (rc < 0) {
|
||||
memset(lt, 0, sizeof(*lt));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (lt[i].compclass < 0) {
|
||||
memset(lt, 0, lt_len * sizeof(lt));
|
||||
return -EINVAL;
|
||||
lt[i].compclass = rc;
|
||||
i++;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return i;
|
||||
@@ -1547,7 +1558,8 @@ static int gprs_sndcp_complete_comp_fields(struct llist_head
|
||||
}
|
||||
|
||||
/* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */
|
||||
struct llist_head *gprs_sndcp_parse_xid(const void *ctx,
|
||||
struct llist_head *gprs_sndcp_parse_xid(int *version,
|
||||
const void *ctx,
|
||||
const uint8_t *src,
|
||||
unsigned int src_len,
|
||||
const struct llist_head
|
||||
@@ -1558,6 +1570,12 @@ struct llist_head *gprs_sndcp_parse_xid(const void *ctx,
|
||||
struct llist_head *comp_fields;
|
||||
struct entity_algo_table lt[MAX_ENTITIES * 2];
|
||||
|
||||
/* In case of a zero length field, just exit */
|
||||
if (src_len == 0)
|
||||
return NULL;
|
||||
|
||||
/* We should go any further if we have a field length greater
|
||||
* zero and a null pointer as buffer! */
|
||||
OSMO_ASSERT(src);
|
||||
|
||||
comp_fields = talloc_zero(ctx, struct llist_head);
|
||||
@@ -1574,8 +1592,8 @@ struct llist_head *gprs_sndcp_parse_xid(const void *ctx,
|
||||
}
|
||||
|
||||
/* Parse SNDCP-CID XID-Field */
|
||||
rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, lt,
|
||||
lt_len);
|
||||
rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len,
|
||||
lt, lt_len);
|
||||
if (rc < 0) {
|
||||
talloc_free(comp_fields);
|
||||
return NULL;
|
||||
@@ -1590,7 +1608,8 @@ struct llist_head *gprs_sndcp_parse_xid(const void *ctx,
|
||||
|
||||
} else {
|
||||
/* Parse SNDCP-CID XID-Field */
|
||||
rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, NULL, 0);
|
||||
rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len,
|
||||
NULL, 0);
|
||||
if (rc < 0) {
|
||||
talloc_free(comp_fields);
|
||||
return NULL;
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
|
||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||
#include <osmocom/gsm/gsup.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <openbsc/gprs_gsup_client.h>
|
||||
#include <openbsc/gsup_client.h>
|
||||
|
||||
#include <openbsc/sgsn.h>
|
||||
#include <openbsc/gprs_sgsn.h>
|
||||
@@ -45,7 +46,7 @@
|
||||
|
||||
extern void *tall_bsc_ctx;
|
||||
|
||||
static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg);
|
||||
static int gsup_read_cb(struct gsup_client *gsupc, struct msgb *msg);
|
||||
|
||||
/* TODO: Some functions are specific to the SGSN, but this file is more general
|
||||
* (it has gprs_* name). Either move these functions elsewhere, split them and
|
||||
@@ -62,7 +63,7 @@ int gprs_subscr_init(struct sgsn_instance *sgi)
|
||||
|
||||
addr_str = inet_ntoa(sgi->cfg.gsup_server_addr.sin_addr);
|
||||
|
||||
sgi->gsup_client = gprs_gsup_client_create(
|
||||
sgi->gsup_client = gsup_client_create(
|
||||
addr_str, sgi->cfg.gsup_server_port,
|
||||
&gsup_read_cb,
|
||||
&sgi->cfg.oap);
|
||||
@@ -73,7 +74,7 @@ int gprs_subscr_init(struct sgsn_instance *sgi)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg)
|
||||
static int gsup_read_cb(struct gsup_client *gsupc, struct msgb *msg)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -161,10 +162,11 @@ void gprs_subscr_cancel(struct gsm_subscriber *subscr)
|
||||
static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr,
|
||||
struct osmo_gsup_message *gsup_msg)
|
||||
{
|
||||
struct msgb *msg = gprs_gsup_msgb_alloc();
|
||||
struct msgb *msg = gsup_client_msgb_alloc();
|
||||
|
||||
if (strlen(gsup_msg->imsi) == 0 && subscr)
|
||||
strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1);
|
||||
osmo_strlcpy(gsup_msg->imsi, subscr->imsi,
|
||||
sizeof(gsup_msg->imsi));
|
||||
gsup_msg->cn_domain = OSMO_GSUP_CN_DOMAIN_PS;
|
||||
osmo_gsup_encode(msg, gsup_msg);
|
||||
|
||||
@@ -176,7 +178,7 @@ static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr,
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
return gprs_gsup_client_send(sgsn->gsup_client, msg);
|
||||
return gsup_client_send(sgsn->gsup_client, msg);
|
||||
}
|
||||
|
||||
static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr,
|
||||
@@ -185,7 +187,8 @@ static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr,
|
||||
{
|
||||
struct osmo_gsup_message gsup_reply = {0};
|
||||
|
||||
strncpy(gsup_reply.imsi, gsup_orig->imsi, sizeof(gsup_reply.imsi) - 1);
|
||||
osmo_strlcpy(gsup_reply.imsi, gsup_orig->imsi,
|
||||
sizeof(gsup_reply.imsi));
|
||||
gsup_reply.cause = cause;
|
||||
gsup_reply.message_type =
|
||||
OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type);
|
||||
@@ -778,11 +781,8 @@ struct gsm_subscriber *gprs_subscr_get_or_create_by_mmctx(struct sgsn_mm_ctx *mm
|
||||
subscr->flags &= ~GPRS_SUBSCRIBER_ENABLE_PURGE;
|
||||
}
|
||||
|
||||
if (strcpy(subscr->equipment.imei, mmctx->imei) != 0) {
|
||||
strncpy(subscr->equipment.imei, mmctx->imei,
|
||||
sizeof(subscr->equipment.imei)-1);
|
||||
subscr->equipment.imei[sizeof(subscr->equipment.imei)-1] = 0;
|
||||
}
|
||||
osmo_strlcpy(subscr->equipment.imei, mmctx->imei,
|
||||
sizeof(subscr->equipment.imei));
|
||||
|
||||
if (subscr->lac != mmctx->ra.lac)
|
||||
subscr->lac = mmctx->ra.lac;
|
||||
|
||||
@@ -553,7 +553,7 @@ static void gtp_decode(const uint8_t *data, int data_len,
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* TODO if (<loglevel is debug>) { ...
|
||||
/* TODO if (<loglevel is debug>)
|
||||
(waiting for a commit from jerlbeck) */
|
||||
int i;
|
||||
|
||||
@@ -1039,6 +1039,9 @@ const char *gtphub_tunnel_str(struct gtphub_tunnel *tun)
|
||||
int left = sizeof(buf);
|
||||
int l;
|
||||
|
||||
if (!tun)
|
||||
return "null-tunnel";
|
||||
|
||||
APPEND("TEI=%x: ", tun->tei_repl);
|
||||
APPEND("%s", gtphub_tunnel_side_str(tun, GTPH_SIDE_SGSN));
|
||||
APPEND(" <-> %s", gtphub_tunnel_side_str(tun, GTPH_SIDE_GGSN));
|
||||
@@ -2357,8 +2360,7 @@ void gtphub_resolved_ggsn(struct gtphub *hub, const char *apn_oi_str,
|
||||
ggsn->peer = pp;
|
||||
gtphub_port_ref_count_inc(pp);
|
||||
|
||||
strncpy(ggsn->apn_oi_str, apn_oi_str, sizeof(ggsn->apn_oi_str));
|
||||
ggsn->apn_oi_str[sizeof(ggsn->apn_oi_str) - 1] = '\0';
|
||||
osmo_strlcpy(ggsn->apn_oi_str, apn_oi_str, sizeof(ggsn->apn_oi_str));
|
||||
|
||||
ggsn->expiry_entry.del_cb = resolved_gssn_del_cb;
|
||||
expiry_add(&hub->expire_slowly, &ggsn->expiry_entry, now);
|
||||
|
||||
@@ -121,8 +121,8 @@ static void make_addr_str(struct ggsn_lookup *lookup)
|
||||
apn_oi_str = osmo_apn_qualify_from_imsi(lookup->imsi_str,
|
||||
lookup->apn_ni_str,
|
||||
lookup->have_3dig_mnc);
|
||||
strncpy(lookup->apn_oi_str, apn_oi_str, sizeof(lookup->apn_oi_str));
|
||||
lookup->apn_oi_str[sizeof(lookup->apn_oi_str)-1] = '\0';
|
||||
osmo_strlcpy(lookup->apn_oi_str, apn_oi_str,
|
||||
sizeof(lookup->apn_oi_str));
|
||||
}
|
||||
|
||||
static int start_ares_query(struct ggsn_lookup *lookup)
|
||||
@@ -170,11 +170,9 @@ struct gtphub_peer_port *gtphub_resolve_ggsn_addr(struct gtphub *hub,
|
||||
expiring_item_init(&lookup->expiry_entry);
|
||||
lookup->hub = hub;
|
||||
|
||||
strncpy(lookup->imsi_str, imsi_str, sizeof(lookup->imsi_str));
|
||||
lookup->imsi_str[sizeof(lookup->imsi_str)-1] = '\0';
|
||||
|
||||
strncpy(lookup->apn_ni_str, apn_ni_str, sizeof(lookup->apn_ni_str));
|
||||
lookup->apn_ni_str[sizeof(lookup->apn_ni_str)-1] = '\0';
|
||||
osmo_strlcpy(lookup->imsi_str, imsi_str, sizeof(lookup->imsi_str));
|
||||
osmo_strlcpy(lookup->apn_ni_str, apn_ni_str,
|
||||
sizeof(lookup->apn_ni_str));
|
||||
|
||||
make_addr_str(lookup);
|
||||
|
||||
|
||||
@@ -299,6 +299,7 @@ int main(int argc, char **argv)
|
||||
struct gtphub *hub = &_hub;
|
||||
|
||||
osmo_gtphub_ctx = talloc_named_const(NULL, 0, "osmo_gtphub");
|
||||
msgb_talloc_ctx_init(osmo_gtphub_ctx, 0);
|
||||
|
||||
signal(SIGINT, &signal_handler);
|
||||
signal(SIGABRT, &signal_handler);
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
/* Osmocom Authentication Protocol message encoder/decoder */
|
||||
|
||||
/* (C) 2015 by Sysmocom s.f.m.c. GmbH
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Author: Neels Hofmeyr
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <openbsc/oap_messages.h>
|
||||
|
||||
#include <openbsc/debug.h>
|
||||
|
||||
#include <osmocom/gsm/tlv.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
int osmo_oap_decode(struct osmo_oap_message *oap_msg,
|
||||
const uint8_t *const_data, size_t data_len)
|
||||
{
|
||||
int rc;
|
||||
uint8_t tag;
|
||||
/* the shift/match functions expect non-const pointers, but we'll
|
||||
* either copy the data or cast pointers back to const before returning
|
||||
* them
|
||||
*/
|
||||
uint8_t *data = (uint8_t *)const_data;
|
||||
uint8_t *value;
|
||||
size_t value_len;
|
||||
|
||||
memset(oap_msg, 0, sizeof(*oap_msg));
|
||||
|
||||
/* message type */
|
||||
rc = osmo_shift_v_fixed(&data, &data_len, 1, &value);
|
||||
if (rc < 0)
|
||||
return -GMM_CAUSE_INV_MAND_INFO;
|
||||
oap_msg->message_type = osmo_decode_big_endian(value, 1);
|
||||
|
||||
/* specific parts */
|
||||
while (data_len > 0) {
|
||||
enum oap_iei iei;
|
||||
|
||||
rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len);
|
||||
if (rc < 0)
|
||||
return -GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
|
||||
iei = tag;
|
||||
|
||||
switch (iei) {
|
||||
case OAP_CLIENT_ID_IE:
|
||||
if (value_len != 2) {
|
||||
LOGP(DGPRS, LOGL_NOTICE,
|
||||
"OAP IE type client ID (%d) should be 2 octets, but has %d\n",
|
||||
(int)iei, (int)value_len);
|
||||
return -GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
}
|
||||
|
||||
oap_msg->client_id = osmo_decode_big_endian(value, value_len);
|
||||
|
||||
if (oap_msg->client_id == 0) {
|
||||
LOGP(DGPRS, LOGL_NOTICE,
|
||||
"OAP IE type client ID (%d): client ID must be nonzero.\n",
|
||||
(int)iei);
|
||||
return -GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
}
|
||||
break;
|
||||
|
||||
case OAP_AUTN_IE:
|
||||
if (value_len != sizeof(oap_msg->autn)) {
|
||||
LOGP(DGPRS, LOGL_NOTICE,
|
||||
"OAP IE type AUTN (%d) should be %d octets, but has %d\n",
|
||||
(int)iei, (int)sizeof(oap_msg->autn), (int)value_len);
|
||||
return -GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
}
|
||||
memcpy(oap_msg->autn, value, value_len);
|
||||
oap_msg->autn_present = value_len;
|
||||
break;
|
||||
|
||||
case OAP_RAND_IE:
|
||||
if (value_len != sizeof(oap_msg->rand)) {
|
||||
LOGP(DGPRS, LOGL_NOTICE,
|
||||
"OAP IE type RAND (%d) should be %d octets, but has %d\n",
|
||||
(int)iei, (int)sizeof(oap_msg->rand), (int)value_len);
|
||||
return -GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
}
|
||||
memcpy(oap_msg->rand, value, value_len);
|
||||
oap_msg->rand_present = value_len;
|
||||
break;
|
||||
|
||||
case OAP_XRES_IE:
|
||||
if (value_len != sizeof(oap_msg->xres)) {
|
||||
LOGP(DGPRS, LOGL_NOTICE,
|
||||
"OAP IE type XRES (%d) should be %d octets, but has %d\n",
|
||||
(int)iei, (int)sizeof(oap_msg->xres), (int)value_len);
|
||||
return -GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
}
|
||||
memcpy(oap_msg->xres, value, value_len);
|
||||
oap_msg->xres_present = value_len;
|
||||
break;
|
||||
|
||||
case OAP_AUTS_IE:
|
||||
if (value_len != sizeof(oap_msg->auts)) {
|
||||
LOGP(DGPRS, LOGL_NOTICE,
|
||||
"OAP IE type AUTS (%d) should be %d octets, but has %d\n",
|
||||
(int)iei, (int)sizeof(oap_msg->auts), (int)value_len);
|
||||
return -GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
}
|
||||
memcpy(oap_msg->auts, value, value_len);
|
||||
oap_msg->auts_present = value_len;
|
||||
break;
|
||||
|
||||
case OAP_CAUSE_IE:
|
||||
if (value_len > 1) {
|
||||
LOGP(DGPRS, LOGL_ERROR,
|
||||
"OAP cause may not exceed one octet, is %d", (int)value_len);
|
||||
return -GMM_CAUSE_PROTO_ERR_UNSPEC;
|
||||
}
|
||||
oap_msg->cause = *value;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGP(DGPRS, LOGL_NOTICE,
|
||||
"OAP IE type %d unknown\n", iei);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg)
|
||||
{
|
||||
uint8_t u8;
|
||||
|
||||
/* generic part */
|
||||
OSMO_ASSERT(oap_msg->message_type);
|
||||
msgb_v_put(msg, (uint8_t)oap_msg->message_type);
|
||||
|
||||
/* specific parts */
|
||||
if ((u8 = oap_msg->cause))
|
||||
msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8);
|
||||
|
||||
if (oap_msg->client_id > 0)
|
||||
msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id),
|
||||
osmo_encode_big_endian(oap_msg->client_id,
|
||||
sizeof(oap_msg->client_id)));
|
||||
|
||||
if (oap_msg->rand_present)
|
||||
msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand);
|
||||
|
||||
if (oap_msg->autn_present)
|
||||
msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn);
|
||||
|
||||
if (oap_msg->auts_present)
|
||||
msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts);
|
||||
|
||||
if (oap_msg->xres_present)
|
||||
msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres);
|
||||
|
||||
msg->l2h = msg->data;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <openbsc/sgsn.h>
|
||||
#include <openbsc/gprs_sgsn.h>
|
||||
#include <openbsc/gprs_gmm.h>
|
||||
@@ -62,7 +63,7 @@ int sgsn_acl_add(const char *imsi, struct sgsn_config *cfg)
|
||||
acl = talloc_zero(NULL, struct imsi_acl_entry);
|
||||
if (!acl)
|
||||
return -ENOMEM;
|
||||
strncpy(acl->imsi, imsi, sizeof(acl->imsi) - 1);
|
||||
osmo_strlcpy(acl->imsi, imsi, sizeof(acl->imsi));
|
||||
|
||||
llist_add(&acl->list, &cfg->imsi_acl);
|
||||
|
||||
|
||||
@@ -59,6 +59,15 @@
|
||||
#include <gtp.h>
|
||||
#include <pdp.h>
|
||||
|
||||
/* TS 23.003: The MSISDN shall take the dummy MSISDN value composed of
|
||||
* 15 digits set to 0 (encoded as an E.164 international number) when
|
||||
* the MSISDN is not available in messages in which the presence of the
|
||||
* MSISDN parameter */
|
||||
static const uint8_t dummy_msisdn[] =
|
||||
{ 0x91, /* No extension, international, E.164 */
|
||||
0, 0, 0, 0, 0, 0, 0, /* 14 digits of zeroes */
|
||||
0xF0 /* 15th digit of zero + padding */ };
|
||||
|
||||
const struct value_string gtp_cause_strs[] = {
|
||||
{ GTPCAUSE_REQ_IMSI, "Request IMSI" },
|
||||
{ GTPCAUSE_REQ_IMEI, "Request IMEI" },
|
||||
@@ -167,12 +176,16 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
|
||||
/* IMSI, TEID/TEIC, FLLU/FLLC, TID, NSAPI set in pdp_newpdp */
|
||||
|
||||
/* Put the MSISDN in case we have it */
|
||||
if (mmctx->subscr) {
|
||||
if (mmctx->subscr && mmctx->subscr->sgsn_data->msisdn_len) {
|
||||
pdp->msisdn.l = mmctx->subscr->sgsn_data->msisdn_len;
|
||||
if (pdp->msisdn.l > sizeof(pdp->msisdn.v))
|
||||
pdp->msisdn.l = sizeof(pdp->msisdn.v);
|
||||
memcpy(pdp->msisdn.v, mmctx->subscr->sgsn_data->msisdn,
|
||||
pdp->msisdn.l);
|
||||
} else {
|
||||
/* use the dummy 15-digits-zero MSISDN value */
|
||||
pdp->msisdn.l = sizeof(dummy_msisdn);
|
||||
memcpy(pdp->msisdn.v, dummy_msisdn, pdp->msisdn.l);
|
||||
}
|
||||
|
||||
/* End User Address from GMM requested PDP address */
|
||||
@@ -234,8 +247,12 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
|
||||
memcpy(pdp->gsnlu.v, &sgsn->cfg.gtp_listenaddr.sin_addr,
|
||||
sizeof(sgsn->cfg.gtp_listenaddr.sin_addr));
|
||||
|
||||
/* Routing Area Identifier with LAC and RAC fixed values, as
|
||||
* requested in 29.006 7.3.1 */
|
||||
/* Assume we are a GERAN system */
|
||||
pdp->rattype.l = 1;
|
||||
pdp->rattype.v[0] = 2;
|
||||
pdp->rattype_given = 1;
|
||||
|
||||
/* Include RAI and ULI all the time */
|
||||
pdp->rai_given = 1;
|
||||
pdp->rai.l = 6;
|
||||
raid = mmctx->ra;
|
||||
@@ -243,24 +260,10 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
|
||||
raid.rac = 0xFF;
|
||||
gsm48_construct_ra(pdp->rai.v, &raid);
|
||||
|
||||
pdp->rattype.l = 1;
|
||||
pdp->rattype_given = 1;
|
||||
|
||||
switch (mmctx->ran_type) {
|
||||
case MM_CTX_T_GERAN_Gb:
|
||||
case MM_CTX_T_GERAN_Iu:
|
||||
pdp->rattype.v[0] = 2;
|
||||
/* User Location Information */
|
||||
pdp->userloc_given = 1;
|
||||
pdp->userloc.l = 8;
|
||||
pdp->userloc.v[0] = 0; /* CGI for GERAN */
|
||||
bssgp_create_cell_id(&pdp->userloc.v[1], &mmctx->ra, mmctx->gb.cell_id);
|
||||
break;
|
||||
case MM_CTX_T_UTRAN_Iu:
|
||||
pdp->rattype.v[0] = 1;
|
||||
/* FIXME: Optional User Location Information with SAI */
|
||||
break;
|
||||
}
|
||||
pdp->userloc_given = 1;
|
||||
pdp->userloc.l = 8;
|
||||
pdp->userloc.v[0] = 0; /* CGI for GERAN */
|
||||
bssgp_create_cell_id(&pdp->userloc.v[1], &mmctx->ra, mmctx->gb.cell_id);
|
||||
|
||||
/* include the IMEI(SV) */
|
||||
pdp->imeisv_given = 1;
|
||||
@@ -673,7 +676,7 @@ static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len)
|
||||
msgb_bvci(msg) = mm->gb.bvci;
|
||||
msgb_nsei(msg) = mm->gb.nsei;
|
||||
|
||||
switch (mm->mm_state) {
|
||||
switch (mm->gmm_state) {
|
||||
case GMM_REGISTERED_SUSPENDED:
|
||||
/* initiate PS PAGING procedure */
|
||||
memset(&pinfo, 0, sizeof(pinfo));
|
||||
@@ -692,7 +695,7 @@ static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len)
|
||||
break;
|
||||
default:
|
||||
LOGP(DGPRS, LOGL_ERROR, "GTP DATA IND for TLLI %08X in state "
|
||||
"%u\n", mm->gb.tlli, mm->mm_state);
|
||||
"%u\n", mm->gb.tlli, mm->gmm_state);
|
||||
msgb_free(msg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,6 @@ static void signal_handler(int signal)
|
||||
|
||||
/* NSI that BSSGP uses when transmitting on NS */
|
||||
extern struct gprs_ns_inst *bssgp_nsi;
|
||||
extern void *tall_msgb_ctx;
|
||||
|
||||
extern int bsc_vty_go_parent(struct vty *vty);
|
||||
|
||||
@@ -328,7 +327,7 @@ int main(int argc, char **argv)
|
||||
|
||||
srand(time(NULL));
|
||||
tall_bsc_ctx = talloc_named_const(NULL, 0, "osmo_sgsn");
|
||||
tall_msgb_ctx = talloc_named_const(tall_bsc_ctx, 0, "msgb");
|
||||
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
|
||||
|
||||
signal(SIGINT, &signal_handler);
|
||||
signal(SIGABRT, &signal_handler);
|
||||
@@ -389,8 +388,6 @@ int main(int argc, char **argv)
|
||||
|
||||
/* start control interface after reading config for
|
||||
* ctrl_vty_get_bind_addr() */
|
||||
LOGP(DGPRS, LOGL_NOTICE, "CTRL at %s %d\n",
|
||||
ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_SGSN);
|
||||
ctrl = sgsn_controlif_setup(NULL, ctrl_vty_get_bind_addr(),
|
||||
OSMO_CTRL_PORT_SGSN);
|
||||
if (!ctrl) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) 2010-2013 by Harald Welte <laforge@gnumonks.org>
|
||||
* (C) 2010-2016 by Harald Welte <laforge@gnumonks.org>
|
||||
* (C) 2010 by On-Waves
|
||||
* (C) 2015 by Holger Hans Peter Freyther
|
||||
* All Rights Reserved
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <osmocom/gprs/gprs_ns.h>
|
||||
#include <openbsc/gprs_sgsn.h>
|
||||
#include <openbsc/vty.h>
|
||||
#include <openbsc/gprs_gsup_client.h>
|
||||
#include <openbsc/gsup_client.h>
|
||||
|
||||
#include <osmocom/vty/command.h>
|
||||
#include <osmocom/vty/vty.h>
|
||||
@@ -63,7 +63,7 @@ const struct value_string sgsn_auth_pol_strs[] = {
|
||||
#define GSM0408_T3360_SECS 6 /* waiting for AUTH/CIPH RESP */
|
||||
#define GSM0408_T3370_SECS 6 /* waiting for ID RESP */
|
||||
|
||||
/* Section 11.2.2 / Table 11.4a MM timers netwokr side */
|
||||
/* Section 11.2.2 / Table 11.4a MM timers network side */
|
||||
#define GSM0408_T3313_SECS 30 /* waiting for paging response */
|
||||
#define GSM0408_T3314_SECS 44 /* force to STBY on expiry, Ready timer */
|
||||
#define GSM0408_T3316_SECS 44
|
||||
@@ -442,18 +442,37 @@ const struct value_string gprs_mm_st_strs[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static char *gtp_ntoa(struct ul16_t *ul)
|
||||
{
|
||||
if (ul->l == 4) {
|
||||
struct in_addr *ia = (struct in_addr *) ul;
|
||||
return inet_ntoa(*ia);
|
||||
} else {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
static void vty_dump_pdp(struct vty *vty, const char *pfx,
|
||||
struct sgsn_pdp_ctx *pdp)
|
||||
{
|
||||
const char *imsi = pdp->mm ? pdp->mm->imsi : "(detaching)";
|
||||
vty_out(vty, "%sPDP Context IMSI: %s, SAPI: %u, NSAPI: %u%s",
|
||||
pfx, imsi, pdp->sapi, pdp->nsapi, VTY_NEWLINE);
|
||||
vty_out(vty, "%sPDP Context IMSI: %s, SAPI: %u, NSAPI: %u, TI: %u%s",
|
||||
pfx, imsi, pdp->sapi, pdp->nsapi, pdp->ti, VTY_NEWLINE);
|
||||
vty_out(vty, "%s APN: %s%s", pfx,
|
||||
gprs_apn2str(pdp->lib->apn_use.v, pdp->lib->apn_use.l),
|
||||
VTY_NEWLINE);
|
||||
vty_out(vty, "%s PDP Address: %s%s", pfx,
|
||||
gprs_pdpaddr2str(pdp->lib->eua.v, pdp->lib->eua.l),
|
||||
VTY_NEWLINE);
|
||||
vty_out(vty, "%s GTP Local Control(%s / TEIC: 0x%08x) ", pfx,
|
||||
gtp_ntoa(&pdp->lib->gsnlc), pdp->lib->teic_own);
|
||||
vty_out(vty, "Data(%s / TEID: 0x%08x)%s",
|
||||
gtp_ntoa(&pdp->lib->gsnlu), pdp->lib->teid_own, VTY_NEWLINE);
|
||||
vty_out(vty, "%s GTP Remote Control(%s / TEIC: 0x%08x) ", pfx,
|
||||
gtp_ntoa(&pdp->lib->gsnrc), pdp->lib->teic_gn);
|
||||
vty_out(vty, "Data(%s / TEID: 0x%08x)%s",
|
||||
gtp_ntoa(&pdp->lib->gsnru), pdp->lib->teid_gn, VTY_NEWLINE);
|
||||
|
||||
vty_out_rate_ctr_group(vty, " ", pdp->ctrg);
|
||||
}
|
||||
|
||||
@@ -466,7 +485,7 @@ static void vty_dump_mmctx(struct vty *vty, const char *pfx,
|
||||
pfx, mm->msisdn, mm->gb.tlli, mm->hlr, VTY_NEWLINE);
|
||||
vty_out(vty, "%s MM State: %s, Routeing Area: %u-%u-%u-%u, "
|
||||
"Cell ID: %u%s", pfx,
|
||||
get_value_string(gprs_mm_st_strs, mm->mm_state),
|
||||
get_value_string(gprs_mm_st_strs, mm->gmm_state),
|
||||
mm->ra.mcc, mm->ra.mnc, mm->ra.lac, mm->ra.rac,
|
||||
mm->gb.cell_id, VTY_NEWLINE);
|
||||
|
||||
@@ -677,15 +696,30 @@ static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr,
|
||||
|
||||
vty_out(vty, " A3A8 tuple (used %d times): ",
|
||||
at->use_count);
|
||||
vty_out(vty, " seq # : %d, ",
|
||||
vty_out(vty, " CKSN: %d, ",
|
||||
at->key_seq);
|
||||
vty_out(vty, " RAND : %s, ",
|
||||
osmo_hexdump(at->vec.rand, sizeof(at->vec.rand)));
|
||||
vty_out(vty, " SRES : %s, ",
|
||||
osmo_hexdump(at->vec.sres, sizeof(at->vec.sres)));
|
||||
vty_out(vty, " Kc : %s%s",
|
||||
osmo_hexdump(at->vec.kc, sizeof(at->vec.kc)),
|
||||
VTY_NEWLINE);
|
||||
if (at->vec.auth_types & OSMO_AUTH_TYPE_GSM) {
|
||||
vty_out(vty, "RAND: %s, ",
|
||||
osmo_hexdump(at->vec.rand,
|
||||
sizeof(at->vec.rand)));
|
||||
vty_out(vty, "SRES: %s, ",
|
||||
osmo_hexdump(at->vec.sres,
|
||||
sizeof(at->vec.sres)));
|
||||
vty_out(vty, "Kc: %s%s",
|
||||
osmo_hexdump(at->vec.kc,
|
||||
sizeof(at->vec.kc)), VTY_NEWLINE);
|
||||
}
|
||||
if (at->vec.auth_types & OSMO_AUTH_TYPE_UMTS) {
|
||||
vty_out(vty, " AUTN: %s, ",
|
||||
osmo_hexdump(at->vec.autn,
|
||||
sizeof(at->vec.autn)));
|
||||
vty_out(vty, "RES: %s, ",
|
||||
osmo_hexdump(at->vec.res, at->vec.res_len));
|
||||
vty_out(vty, "IK: %s, ",
|
||||
osmo_hexdump(at->vec.ik, sizeof(at->vec.ik)));
|
||||
vty_out(vty, "CK: %s, ",
|
||||
osmo_hexdump(at->vec.ck, sizeof(at->vec.ck)));
|
||||
}
|
||||
}
|
||||
|
||||
llist_for_each_entry(pdp, &subscr->sgsn_data->pdp_list, list) {
|
||||
|
||||
@@ -48,10 +48,9 @@ ipaccess_config_SOURCES = \
|
||||
# FIXME: resolve the bogus dependencies patched around here:
|
||||
ipaccess_config_LDADD = \
|
||||
$(top_builddir)/src/libbsc/libbsc.a \
|
||||
$(top_builddir)/src/libxsc/libxsc.a \
|
||||
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
|
||||
$(top_builddir)/src/libtrau/libtrau.a \
|
||||
$(top_builddir)/src/libcommon/libcommon.a \
|
||||
$(LIBCRYPT) \
|
||||
$(OSMO_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@@ -138,8 +138,8 @@ static int read_response(int fd)
|
||||
if (len < 0)
|
||||
return len;
|
||||
|
||||
/* 2 bytes length, 1 byte protocol (0xfe) */
|
||||
if (buf[2] != 0xfe)
|
||||
/* 2 bytes length, 1 byte protocol */
|
||||
if (buf[2] != IPAC_PROTO_IPACCESS)
|
||||
return 0;
|
||||
|
||||
if (buf[4] != IPAC_MSGT_ID_RESP)
|
||||
@@ -194,7 +194,11 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
osmo_fd_register(&bfd);
|
||||
rc = osmo_fd_register(&bfd);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "Cannot register FD\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
timer.cb = timer_cb;
|
||||
timer.data = &bfd;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user