Commit Graph

806 Commits

Author SHA1 Message Date
Harald Welte 6efc176722 [GPRS] Make SGSN more verbose when startup fails 2010-05-19 15:46:31 +02:00
Harald Welte e4860d7c48 [GPRS] NS: Make sure we allocate NS packet with headroom for FR/GRE 2010-05-19 15:38:10 +02:00
Harald Welte 3c2a88dfe4 [GPRS] NS: FR/GRE: Use AF_INET, correctly encode FR DLCI and GRE payload type 2010-05-19 15:37:34 +02:00
Harald Welte ff3bde8b49 [GPRS] NS: VTY: Move all local ip/port bind values into 'ns' node
This removes the requirement for gb_proxy and sgsn to have duplicate
vty parsing code
2010-05-19 15:09:09 +02:00
Harald Welte 5540c4cbd3 [GPRS] Add Frame Relay in GRE encapsulation for NS 2010-05-19 14:38:50 +02:00
Harald Welte 7af4962e07 [SGSN] Gb Proxy: Simplify configuration
Almost all parameters about the SGSNs NS-VC can be specified in the NS
protocol node.  All that needs to remain in the gbproxy config node
is "nsip sgsn nsei XXX".
2010-05-19 14:04:23 +02:00
Harald Welte ab1d5626ac [GPRS] SGSN: use GGSN IP address from config file, disable TMSI allocation 2010-05-18 19:58:38 +02:00
Harald Welte 119c2baaa6 [GPRS] SGSN: actually isert a ggsn context when we allocate it 2010-05-18 18:39:00 +02:00
Harald Welte 51537eef50 [GPRS] SGSN: Make sure libgtp timer doesn't segfault 2010-05-18 18:28:13 +02:00
Harald Welte b4a3129993 [GPRS] SGSN: No need to calculate difference for libgtp timer
The libgtp return value is already a timespan value, not a
wallclock time.
2010-05-18 18:24:53 +02:00
Harald Welte cd4dd4d7ff [GPRS] fix numerous compiler warnings 2010-05-18 17:20:49 +02:00
Harald Welte 6463c0799c [GPRS] SGSN: TMSI allocation 2010-05-18 17:04:55 +02:00
Harald Welte 4e38ac7a8a [GPRS] SGSN: Correctly set upper 4 bits of PDP address to 0
It's really strange.  In GTP those 4 bits are 1, in 04.08 they are
zero.  Otherwise the IE is exactly the same :/
2010-05-18 14:51:18 +02:00
Harald Welte 269ae75321 [GPRS] SGSN: exit() if we cannot bind to the GTP address 2010-05-18 14:44:31 +02:00
Harald Welte 3c0b9b9c2a [GPRS] SGSN: Make sure the PCO from GGSN are passed to the MS 2010-05-18 14:36:11 +02:00
Harald Welte 77289c202f [GPRS] SGSN: properly delete a PDP context after receiving PDP CTX DEACT REQ 2010-05-18 14:32:29 +02:00
Harald Welte 55e0df7c43 [GPRS] SGSN: Don't use GGSN-provided QoS as the MS doesn't like it 2010-05-18 13:20:08 +02:00
Harald Welte 322a5ee954 [GPRS] SGSN: ensure we mark libgtp filedescriptors as READ 2010-05-18 13:13:11 +02:00
Harald Welte d764c064bb [GPRS] LLC: Fix logic to detect unknown TLLI/SAPI 2010-05-18 12:45:08 +02:00
Harald Welte 6ffbaab90d [GPRS] SGSN: properly initialzie pdp_list head of mm ctx 2010-05-18 12:44:45 +02:00
Harald Welte b61f403dd3 [GPRS] LLC: print human-readable LLC command type 2010-05-18 12:31:50 +02:00
Harald Welte 2e918a87eb [GPRS] LLC: Add VTY interface for LLC 2010-05-18 12:22:12 +02:00
Harald Welte 68b99a4a08 [GPRS] fix null pointer dereference in GMM 2010-05-18 12:05:42 +02:00
Harald Welte 803bd5ceb2 [GPRS] BSSG: Fix Vty printing of BVC 2010-05-18 12:00:55 +02:00
Harald Welte b3911a071b [GPRS] BSSGP: Use correct values for SIGNALLING and PTM BVCI 2010-05-18 11:57:08 +02:00
Harald Welte a7c262ad96 [GPRS] Make sure libsgsn.a is only built when libgtp is available 2010-05-18 11:00:52 +02:00
Harald Welte 8acd88f369 [GPRS] SGSN: Include rate counters in MM Context 2010-05-18 10:57:45 +02:00
Harald Welte 6abf94e420 [GPRS] Properly connect GPRS SM with LIBGTP for PDP context activation
* store LLC SAPI as part of PDP ctx
* store NSEI + BVCI as part of MM ctx
* export gsm48_tx_gsm_act_pdp_acc() and call it from sgsn_libgtp.c
* create and use gsm48_tx_gsm_act_pdp_rej for error cases
* print SAPI as part of VTY show pdp
2010-05-18 10:35:06 +02:00
Harald Welte d2a9ed2285 [GPRS] SGSN: Activate BSSGP VTY functions 2010-05-18 08:02:36 +02:00
Harald Welte 03800ba868 [GPRS] Build osmo-sgsn only if libgtp is available 2010-05-18 00:20:21 +02:00
Harald Welte d9a55f67ac [GPRS] BSSGP: Add VTY for configuration and inpection
This also includes log filtering based on NSEI/BVCI tuple
2010-05-17 23:41:43 +02:00
Harald Welte b1b290862a [GPRS] BSSGP: Introduce packet/byte counters 2010-05-17 23:30:01 +02:00
Harald Welte 5c90e5cfc6 [GPRS] BSSGP: expose more internal structures / API 2010-05-17 23:02:42 +02:00
Harald Welte ada466f2a7 [GPRS] BSSGP: Rename bssgp_bts_ctx to bssgp_bvc_ctx
The Context really is about a BVC (BSSGP Virtual Connection).  In
the case we operate BSSGP on the SGSN side, this corresponds to
a link to a BTS.
2010-05-17 22:59:29 +02:00
Harald Welte d193cb327a [GPRS] More work on a real SGSN 2010-05-17 22:58:03 +02:00
Harald Welte 8fc1a46f28 [SGSN] remove the mmctx->sgsn pointer
We never want to support multiple sgsn's within one process, so
there is no point in passing them around all the time.
2010-05-17 00:53:10 +02:00
Harald Welte 2720e7310d [GPRS] Initial untested support for libgtp
libgtp of the OpenGGSN project will allow us to speak the GTPv0/v1
protocol of the interface between SGSN and GGSN.

This commit includes code for the main libgtp integration (file
descriptor, select loop, timer) as well as code to encode/send
a CREATE PDP CONTEXT request.
2010-05-17 00:44:57 +02:00
Harald Welte 7363e92cd3 [GPRS] NS: Receiving a STATUS message is a NOTICEable event 2010-05-16 23:17:16 +02:00
Harald Welte 5bc61dc384 VTY: separate VTY logging commands and OpenBSC node exit code 2010-05-16 22:02:16 +02:00
Harald Welte dcccb1818d VTY: decouple telnet_interface from 'struct gsmnet'
We want the VTY and telnet code to be independent from the BSC
application(s).  As a side note, we also like to eliminate static
global variables for 'struct gsm_network' all over the code.

As such, telnet_init() is now passed along a "private" pointer,
which getst stored in telnet_connection.priv.  This telnet_connection
is then stored in vty->priv, which in turn gets dereferenced if
anyone needs a reference to 'struct gsm_network' from the BSC vty
code.

Also:
 * vty_init() now calls cmd_init()
 * the ugliness that telnet_init() calls back into the application by means of
   bsc_vty_init() function has been removed.
 * telnet_init() now returns any errors, so the main program can exit
   e.g. if the port is already in use.
2010-05-16 20:52:23 +02:00
Harald Welte 1353f961ef VTY: pass program name, version and copyright to vty_init()
This enables us to make the VTY completely independent of any
compile-time program-specific information, i.e. one step closer
to using VTY as a shared library from multiple programs.
2010-05-16 19:20:24 +02:00
Harald Welte 9564715c24 VTY: Context-sensitive help for logging related commands 2010-05-16 00:00:04 +02:00
Harald Welte 8be8c8fec9 [GPRS] NS: Allow filtering of log messages by NSVC / NSEI 2010-05-15 23:52:02 +02:00
Harald Welte 52613a114a [GPRS] NS: VTY: Don't nsvc_delete() on 'no nse...'
Rather than deleting the NSE from memory, we simply mark it as non-persistent.
This makes sure that there are no invalid references (e.g. from gbprox_peer)
to the gprs_nsvc structure, but at the same time ensures it will no longer
be stored as part of writing the config file.
2010-05-15 23:06:26 +02:00
Harald Welte 55c91e411e [GPRS] NS: Introduce command to display a single NSE 2010-05-15 23:04:03 +02:00
Harald Welte ff56d61dc9 [GPRS] NS: Always start NS-ALIVE procedure after RESET
So far, we only started the ALIVE procedure on RESET-ACK if the
remote end was the SGSN.  This resulted in the BSS->Proxy connections
only being tested for alive-status from the BSS side, but not from
our side.

Also: export nsvc_by_nsvci() function as a public API function.
2010-05-15 23:02:24 +02:00
Harald Welte 9ef9108025 [GPRS] NS: Add 'nsvc nsei ... (block|unblock|reset)' command to VTY 2010-05-14 19:36:59 +02:00
Harald Welte 54f7424b78 [VTY] Introduce "end" command that works from any level in config
Using "end" you can always return to the "enable" level, and from
there the "show" commands are available.  So no more need for
exit/exit/exit/exit/disable.
2010-05-14 19:11:04 +02:00
Harald Welte 62ab20c5dd [VTY] Remove OpenBSC specific node-exit handling from src/vty
The idea is to move the VTY code into libosmocore at some point,
and for that we need to eliminate OpenBSC specifics from it
2010-05-14 18:59:17 +02:00
Harald Welte 1ccbf44d79 [GPRS] gb_proxy: Initiate RESET procedure on persistent NS-VC at startup
Some BSS that connect to the proxy do not continue to perform the
RESET procedure after a timeout.  In order to resurrect them, we
simply start a RESET procedure.
2010-05-14 11:53:08 +00:00
Harald Welte 768f2871a5 [GPRS] Gb_proxy: Support common command line arguments
This allows us to use a user-specified configuration file
2010-05-14 11:22:33 +00:00
Harald Welte 2b36ae1a3d [GPRS] BSSGP: Refuse blocking of signalling BVC; Ignore traffic on blocked BVC 2010-05-13 21:45:23 +02:00
Harald Welte 3a1bece69c [GPRS] BSSGP: Make implementation more robust
We now actually are much more in line with what the specification
says.  We track the blocked/unblocked state, we don't accept
signalling messages on PTP functional entities (and vice versa),
and we don't simply create a BVC context with messages other than
BVC-RESET.
2010-05-13 21:29:11 +02:00
Harald Welte 1b170d1145 [GPRS] LLC: Start using different log levels 2010-05-13 21:29:11 +02:00
Harald Welte c6ecafe60c [GPRS] LLC: Use DLLC instead of DGPRS 2010-05-13 21:29:11 +02:00
Harald Welte f47dc0b58c [GPRS] BSSGP: Elaborate more on FIXMEs
And fix mistake regarding FLUSH-LL / FLUSH-LL-ACK direction
2010-05-13 21:29:11 +02:00
Harald Welte 24c9fc1700 [GPRS] Rename gsm_04_08_gprs.c to gprs_gmm.c
GMM refers to GPRS Mobility Management.
2010-05-13 21:29:11 +02:00
Harald Welte 1ae09c7bd6 [GPRS] LLC: Improve implementation compliance to spec
Don't allocate a LLC Entity just because BSSGP passes any random
SAPI/TLLI up to us.  We can only do this for XID and UI frames
of the GMM SAPI.

Furthermore, add more comments and debug messages.
2010-05-13 21:29:11 +02:00
Harald Welte 3863e04918 [GPRS] NS: Remove 'unknown_nsvc' from list of NS-VCs 2010-05-13 14:20:56 +02:00
Harald Welte 4cf12e9350 [GPRS] Gb Proxy: More verbose logging 2010-05-13 14:14:56 +02:00
Harald Welte 9aa97fc137 [GPRS] NS: Fix segfault when receiving message from unknown NS-VC
In the previous code we used a static fake_nsvc structure in
case we needed to send a message to an unknown NSVC for which
we don't have a real 'struct nsvc'. However, since we now have
a rate_ctr_group hanging off the nsvc, the fake structure didn't
have that.

So now we keep a nsi->unknown_nsvc around to be used whenever
we need a nsvc but don't have a real one.  The gprs_ns_vty.c
code explicitly does not list that NSVC in 'show ns'
2010-05-13 14:00:59 +02:00
Harald Welte a6fd8f2339 [GPRS] NS: remove debug statement about l2len 2010-05-13 13:09:01 +02:00
Harald Welte c191986691 [GPRS] NS: more rate counters for BLOCK / DEAD count 2010-05-13 12:55:20 +02:00
Harald Welte 73b2359fb0 [GPRS] NS: Show statistics on VTY only if requested 2010-05-13 12:32:30 +02:00
Harald Welte e183345748 [GPRS] NS: properly assign msgb->l2h to count outgoing bytes correctly 2010-05-13 12:18:49 +02:00
Harald Welte 8e605b045e [GPRS] NS: Fix wrong counter use and remove debug statement 2010-05-13 11:57:44 +02:00
Harald Welte 66f793a770 [GPRS] SGSN: Add Signal handler and NS VTY support 2010-05-13 11:50:04 +02:00
Harald Welte f2b4cd7b86 [GPRS] NS: Start to use rate_ctr_group code from libosmocore
Every NS-VC now has a set of counters for incoming and outgoing
number of packets and bytes.

We also split the VTY part of the gprs_ns.c implementation into gprs_ns_vty.c
to make sure the protocol can actually be used without the VTY code being
present.
2010-05-13 11:45:07 +02:00
Harald Welte 0ab535bfc3 [GPRS] Gb Proxy: Cosmetic fix of log message 2010-05-13 10:34:56 +02:00
Harald Welte 6df0c5187b GPRS: Gb proxy memory leak debugging with SIGUSR 2010-05-12 20:53:42 +02:00
Harald Welte 8272c77231 GPRS: We have to do the msgb_free() in NS not Gb Proxy
As only NS-UNITDATA messages are ever passed into the Gb Proxy,
we need to do the msgb_free() at a much higher point in the calling
stack, i.e. inside the NS protocol layer.  This means it is now
the same logic as in OpenBSC itself.
2010-05-12 20:53:42 +02:00
Harald Welte 39d0bb5f7c Gb Proxy: Proper msgb memory management
The old idea was to take a msgb from gbprox_rcvmsg() and then
modify it and finally send it all the way down to nsip_sendmsg()
to the remote peer.

However, this introduces memory management difficulties, as we then
have to distinguish three cases:
 * msgb was sent to a remote peer
 * we sent some error message and need to free the msgb
 * we need to make n-1 copies in case of a BSSVC-RESET from the SGSN

So instead we now simply always copy the message if we pass it on.

All messages received by gbprox_rcvmsg() are msgb_free()d in the very
same routine

All messages allocated by tx2peer() or tx2sgsn() are freed after
nsip_sendmsg()
2010-05-12 20:22:55 +02:00
Harald Welte ea4647d264 NS: Make all timers configurable from VTY 2010-05-12 20:22:55 +02:00
Harald Welte 995a2d36da use new install_element_ve() 2010-05-12 20:22:55 +02:00
Harald Welte 50a6dfee37 Make sure all commands of SHOW_NODE to ENABLE_NODE 2010-05-12 18:28:00 +02:00
Harald Welte d9c69cc7fe Gb Proxy: Cosmetic fix of VTY file writing 2010-05-12 18:28:00 +02:00
Harald Welte 1194b584be NS: Add support for persistent NS-VC configuration
With persistent NS-VC configuration (configured through VTY),
we can respond properly to BSS with a somewhat strange NS
implementation Such as the BSplus.  It enables us to respond
with a proper NS-RESET (including NSVCI/NSEI) when receiving
a NS-ALIVE or other PDU for a BLOCKED/DEAD NS-VC after our
end of the connection is rebooted.
2010-05-12 18:28:00 +02:00
Harald Welte f6d67c04ee NS: Send UNBLOCK signal when we get UNBLOCK_ACK from peer 2010-05-12 18:28:00 +02:00
Harald Welte d4eaf80acc Display NSEI instead of NSVCI for all debug msgs 2010-05-12 18:28:00 +02:00
Harald Welte 8c2440e182 NS: Send STATUS or RESET when receiving NS_ALIVE on unknown NSVC 2010-05-12 18:28:00 +02:00
Harald Welte b778d2cf16 NS / GB Proxy: Add Signal in case Tns-Alive expires too often
The Gb Proxy can then restart the RESET procedure.
2010-05-12 18:28:00 +02:00
Harald Welte 811c4979e6 NS: Debug NS timer expiry 2010-05-12 18:28:00 +02:00
Harald Welte bca900dab2 NS: Add more LOG_DEBGU messages and retransmit NS-ALIVE 2010-05-12 18:28:00 +02:00
Harald Welte 34caeb36ab NS: More INFO messages about what we actually transmit 2010-05-12 18:28:00 +02:00
Harald Welte cad8301dbe NS: don't memcmp sockaddr_in but compare ip and port individually
this seems to work more portably (ppc/32bit big endian)
2010-05-12 18:28:00 +02:00
Harald Welte 9bdb3ba322 [gprs] NS: more state transitions, error reporting via Tx STATUS PDU 2010-05-12 11:50:11 +02:00
Harald Welte 72953b884d [gprs] Gb proxy: log level consolidation 2010-05-12 00:20:41 +02:00
Harald Welte fcc4cc9f65 [gprs] NS: elevate events from LOGL_DEBUG to LOGL_INFO 2010-05-12 00:16:57 +02:00
Harald Welte 1174c08068 [gprs] gb_proxy: Snoop Cell ID from BSSGP RESET
If a PTP BVC is BVC-RESET by the BSS, the PDU contains the
Cell Identifier.  We can snoop this into our gbprox_peer structure
for better visualization of each peer in they vty.
2010-05-12 00:07:29 +02:00
Harald Welte e9ea26935e [gprs] gb_proxy: more verbose debugging 2010-05-11 20:20:13 +02:00
Harald Welte 7c209ebb86 [gprs] NS: update the remote peer IP addr/port on NS RESET 2010-05-11 18:40:45 +02:00
Harald Welte ef1226e827 [gprs] NS: include port number in log statement 2010-05-11 18:38:36 +02:00
Harald Welte e69b2814e2 [gprs] use TCP port 4246 for the gb_proxy vty telnet 2010-05-11 18:32:37 +02:00
Harald Welte e5117da715 [gprs] gb-proxy: We might receive a NS-RESET for a NS-VC that we already know
In this case, don't blindly allocate a new NS-VC but rather use the NSEI
to lookup the 'struct gprs_nsvc' for it.
2010-05-11 18:30:37 +02:00
Harald Welte f69c059a0e [gprs] gb_proxy: Fix detecting the SGSN-facing ns-vc by its NSEI
make sure we mark the NS connection as 'SGSN-facing' if the NSEI matches
2010-05-11 18:29:44 +02:00
Harald Welte d7c02ad9df [gprs] NS: Make sure we include "Rx" in the log statement for NS RESET 2010-05-11 18:18:31 +02:00
Harald Welte 7fc9822a74 [gprs] Gb proxy: cosmetic cleanup 2010-05-11 10:15:42 +02:00
Harald Welte 1389ac7d2a [gprs] NS: cleanup / fix compiler warnings 2010-05-11 10:15:26 +02:00
Harald Welte a7a3194da8 [gprs] BSSGP: cosmetic cleanup 2010-05-11 10:12:44 +02:00
Harald Welte 0a4050c63b [gprs] gb_proxy: Send proper BSSGP STATUS msg in error case
In order to reuse the existing bssgp_tx_* functions without pulling
in the dependencies of gprs_bssgp.c, we have to move those functions
to gprs_bssgp_util.c

Furthermore, we can remove gbprox_nsi and replace it with bssgp_nsi,
and we can do proper processing of BVC-RESET messages coming from
the SGSN on the signalling BVC.  In that case we need to send RESET
messages to all the BSS.
2010-05-11 10:03:34 +02:00
Harald Welte c1c1dd260a [gprs] gb_proxy: Forward NS-RESET/NS-BLOCK/NS-UNBLOCK from SGSN to BTSs 2010-05-11 06:34:24 +02:00
Harald Welte 99e3248192 [gprs] NS: Add signals in the event of BLOCK/UNBLOCK/RESET
The signals will be sent upon reception of NS-BLOCK/UNBLOCK/RESET PDUs

We also export functions to generate/send BLOCK/UNBLOCK and RESET.
2010-05-11 06:33:17 +02:00
Harald Welte 6b72cdf854 [gprs] Add new 'NS' and 'BSSGP' logging categories 2010-05-11 05:54:22 +02:00
Harald Welte 85801d0294 [gprs] gb_proxy: More VTY 'show' information
The 'show gbproxy' now actually shows information about the Gb proxy
BTS peers, whereas 'show ns' shows information about existing NS links.
2010-05-11 05:49:43 +02:00
Holger Hans Peter Freyther c6ec0406c8 misc: Use $(top_srcdir) for source, $(top_builddir) for libs
We should not use ../ for adding sources or libraries as the
user might have a srcdir != builddir setup.
2010-05-04 14:36:07 +08:00
Harald Welte e236596bf4 [gprs] Move all GPRS related code to src/gprs subdirectory 2010-05-04 07:41:59 +02:00