Commit Graph

7066 Commits

Author SHA1 Message Date
Holger Freyther 4c8f114976 Fix warning 2009-01-04 20:17:07 +00:00
Holger Freyther a553d098e7 Export the gsm0411 alloc and send function 2009-01-04 20:16:25 +00:00
Holger Freyther 5e76ce61ac Some simple size check. We would not overflow but would send garbage
Check the size
2009-01-04 20:15:12 +00:00
Harald Welte ca64da984b make use of new functions to print string chreq reason and lchan type 2009-01-04 16:54:12 +00:00
Harald Welte d4fc1b29ca use get_[lp]chan_name() functions for telnet interface 2009-01-04 16:11:31 +00:00
Harald Welte a72c98eb2f functions to convert lchan/pchan type into human-readable string 2009-01-04 16:10:38 +00:00
Harald Welte 47d88aecaf Add some functions to CREATE OBJECTs in the BS-11 internal database 2009-01-04 12:02:08 +00:00
Holger Freyther 868b8cdd58 Implement sending custm GSM 04.08 commands
First you would page the IMSI and then send GSM 04.08
commands to the MS. This should help when testing new
commands
2009-01-04 03:57:27 +00:00
Holger Freyther 3e2c32322e Make gsm48_sendmsg public as well 2009-01-04 03:55:31 +00:00
Holger Freyther 819dd205a9 Make gsm48_msgb_alloc public and usable for the telnet_interface 2009-01-04 03:52:50 +00:00
Holger Freyther 3ae8fd2acb Implement the call command...
Passing of an origin is missing this will need work in
gsm_04_08.
2009-01-04 03:50:40 +00:00
Holger Freyther f87573dc4e Implement put_channel/get_channel, save on which bts we currently operate
Allow to change the refcount for a given channel. Store which
bts is our primary bts. A command to switch the primary bts will
be added as well. This makes entering and parsing of commands more
easy.
2009-01-04 03:49:41 +00:00
Holger Freyther d0e38c3cad Add implementation to find a lchan by the struct gsm_subscriber
Really compare pointers to check if the one gsm_subscriber
is equal to the other... gsm_subscriber should be unique for
a given IMSI so comparing the pointers should be fine.
2009-01-04 03:48:30 +00:00
Holger Freyther a471a41680 Define the gsm_subscriber getter functions in the header 2009-01-04 03:47:05 +00:00
Holger Freyther ae61cae9b2 Add a show command to list the channel allocation
Example output

show
BTS #0 on link 0  LOC: 1 TRX: 1 CCCH0: arfcn:123,#0
  TRX: 0 ARFCN: 123
     TS: #0 pchan: 2 flags: 0
       LCHAN: #0 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #1 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #2 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #3 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #4 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #5 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #6 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #7 type: 0  subscriber: na/na/na use: 0 loc: (nil)
     TS: #1 pchan: 0 flags: 0
       LCHAN: #0 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #1 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #2 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #3 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #4 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #5 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #6 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #7 type: 0  subscriber: na/na/na use: 0 loc: (nil)
     TS: #2 pchan: 0 flags: 0
       LCHAN: #0 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #1 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #2 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #3 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #4 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #5 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #6 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #7 type: 0  subscriber: na/na/na use: 0 loc: (nil)
     TS: #3 pchan: 0 flags: 0
       LCHAN: #0 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #1 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #2 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #3 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #4 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #5 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #6 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #7 type: 0  subscriber: na/na/na use: 0 loc: (nil)
     TS: #4 pchan: 0 flags: 0
       LCHAN: #0 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #1 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #2 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #3 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #4 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #5 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #6 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #7 type: 0  subscriber: na/na/na use: 0 loc: (nil)
     TS: #5 pchan: 0 flags: 0
       LCHAN: #0 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #1 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #2 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #3 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #4 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #5 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #6 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #7 type: 0  subscriber: na/na/na use: 0 loc: (nil)
     TS: #6 pchan: 0 flags: 0
       LCHAN: #0 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #1 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #2 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #3 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #4 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #5 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #6 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #7 type: 0  subscriber: na/na/na use: 0 loc: (nil)
     TS: #7 pchan: 0 flags: 0
       LCHAN: #0 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #1 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #2 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #3 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #4 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #5 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #6 type: 0  subscriber: na/na/na use: 0 loc: (nil)
       LCHAN: #7 type: 0  subscriber: na/na/na use: 0 loc: (nil)
2009-01-04 03:46:01 +00:00
Holger Freyther 5f234e4f3a Add test case that is not registering the timer again
yesterday's crash with the llist_del instead of using del_timer
was due this kind of bug. Add a test case.
2009-01-04 03:45:13 +00:00
Harald Welte 4668fdaa26 define and use enum values for BS11 (or Siemens?) specific OML message types 2009-01-03 08:19:29 +00:00
Harald Welte 227d4073fb use NM_MT_* enum instead of hard-coded values 2009-01-03 08:16:25 +00:00
Holger Freyther 52aab5445d Make wireshark happy.
Removing the P Bit from the fake LAPD frame will make wireshark
run the data through the GSM RSL dissector with the right SAPI
and LAPD preference setting.
2009-01-03 05:49:22 +00:00
Holger Freyther 460af8b794 Clean up struct gsm_network and remove the gsm_subscriber 2009-01-03 05:48:32 +00:00
Harald Welte 1272aab1cd Go through del_timer otherwise in_list will not be reset leading to crashes... 2009-01-03 04:39:51 +00:00
Harald Welte 599639eaf9 Readd the dummy lapd header... this gives valid TEI/SAPI information
Besides that the header is spoofed, we lose the information about
the channel (we will have to add our own encap type)
2009-01-03 03:28:10 +00:00
Harald Welte 4e0d137a2c Dump something that can be read by wireshark
We need to append the Linux LAPD header for wireshark. This means
that we currently can not support B Channels or such. Maybe we will
need to add another LAPD header.
2009-01-03 03:04:07 +00:00
Harald Welte 62a923d46a Use the right network/link type, prepend the vISDN header...
Now only the LAPD header is invalid...
2009-01-03 01:32:00 +00:00
Harald Welte ca6bf7815a Write the pcap packet header first :) 2009-01-03 00:41:04 +00:00
Harald Welte b8f04ea5a9 Add new management function to struct timer_list
Make sure that del_timer succeeds and removes an entry from the list. Currently
sending the LOCATION UPDATING REJECT from within the timer will not remove the
list element as ->active gets set to 0 in the timer updating before calling the
callback. Fix the segfault and allow the timer to be removed from within its
own callback.
2009-01-02 23:57:22 +00:00
Holger Freyther 219518d064 Add simplistic telnet control interface
This might turn into a complete wire protocol with special
client software. For now it will be a simple client interface
that you can use with telnet to do certain things.

This is using flex to implement the parsing. Implementation
and more commands will follow.
2009-01-02 22:04:43 +00:00
Holger Freyther c6880a46ad Use the _safe variant as a bsc_unregister_fd might be called from within the callback 2009-01-02 21:53:34 +00:00
Holger Freyther b21b305d7c Fix make distcheck by adding some header files 2009-01-02 02:00:35 +00:00
Holger Freyther 52af7d4284 Write only actual data into the pcap file
The current LAPD control field for indication/disconnect/etc
is wrong and currently we are only interested in the actual
A-Bis data spoken between the BTS and BSC and not on the indication
of the physical line (connection, disconnect, release..)
2009-01-02 01:18:28 +00:00
Holger Freyther 2139b246a0 Attempt to put the time into the pcap packet record 2009-01-02 01:17:48 +00:00
Holger Freyther 9a3ee0ff1b Add the option to write the communication on the D Channel to a pcap file
When using ISDN as network type and using a fake LAPD encapsulation
wireshark should be able to recognize some bits if dump.

Append a dummy LAPD header. It is not clear to me if the Control field
of the LAPD frame is part of the msg or if we need to add it as well.

TODO:
    - Do the same for the B Channel
    - Write out time
    - Check if more of the LAPD frame needs to be prepended. The
      information from the mISDNhead comes into mind. Maybe it makes
      sense to start a custom wireshark mISDN dissector.
2009-01-02 00:40:15 +00:00
Holger Freyther 355701bcc0 Document where to find the how to determine the paging group
Point to the right location in the pile of spec
2009-01-01 18:02:29 +00:00
Holger Freyther 12aa50d5a2 Change the subscriber and database backend
gsm_subscriber is now refcounted, the db backend is leaking
a lot less, db_get_subscriber will allocate the subscr record
now, subscr_* will look up a subscriber in the list of currently
active subscribers and add an ref to this one.

The db test cases pass, more testing will be when next to the bts
2009-01-01 18:02:05 +00:00
Holger Freyther 67b4b9a017 Do not call rsl_chan_release directly but use the use_count of the lchan
Call use_lchan early in allocate_loc_updating_req, do not directly call
rsl_chan_release but go through channel alloc to take the use_count into
account.
2009-01-01 03:46:11 +00:00
Holger Freyther 3eaa792b21 Speculative fix for not sending LOCATION UPDATING REJECT
As reported by the operator the rejecting didn't work after the
first fix (wrong logic/missing negation). The hypothesis is that
that the lchan was released before the reject timeout was fired.

Fix it by getting a reference on the lchan when allocating a
logical operation and release the reference when the operation
is finished or timed out.
2009-01-01 02:59:03 +00:00
Harald Welte d125250ae2 add signal handlers for clean shutdown of BTS via OML on shutdown of program 2009-01-01 01:50:32 +00:00
Harald Welte e872cb1221 get rid of some more gcc warnings 2009-01-01 00:33:37 +00:00
Harald Welte f85497c857 get rid of gcc warnings about function prototype 2009-01-01 00:33:20 +00:00
Harald Welte 404d816947 add missing string.h include 2009-01-01 00:33:02 +00:00
Harald Welte 21768818f0 don't return a value in a void function 2009-01-01 00:32:49 +00:00
Harald Welte 179f064cbe * fix check for null-pointer in release_loc_updating_req()
* fix endianness of operator name
2008-12-31 23:59:18 +00:00
Holger Freyther dbede4e414 Move the db_test.c to a specific test directory 2008-12-31 23:25:05 +00:00
Holger Freyther 6dbca34bd3 Make the test compile again 2008-12-31 23:24:37 +00:00
Holger Freyther 73487a23da Introduce logical updating request operation on the gsm_lchan
We are going to have logical operations like Phone Call, SMS,
Paging, Updating Request on a logical channel and for each of
these operations we might need to store state. For now pointers
in gsm_lchan look like the best way of doing this and we start
by introducing an operation for the location updating request.

The new flow of things are:
    - We get the location updating request and update/create
      the subscriber and maybe send the identity requests to
      the mobile station
    - We start the updating timer, if it times out we will
      reject the mobile station.
    - Once we get the Identity Responses we have asked for
      and the reject timer did not fire yet we might accept
      the user.
2008-12-31 18:53:57 +00:00
Holger Freyther 41ed300aab We have freed the channel there is no subscriber associated anymore
FIXME: Introduce refcounting on the subscriber record. This looks like
a genuine memory leak to me.
2008-12-31 18:52:54 +00:00
Holger Freyther e97f7fba97 Add an option to set the global reject cause
This will need to be moved into bsc_hack.c together with the
policy to accept/reject a UPDATING LOCATION REQUEST.
2008-12-31 18:52:11 +00:00
Holger Freyther 1bc7de50be Fix the compile the timer got renamed 2008-12-31 18:50:58 +00:00
Holger Freyther c6ea9dbeba Recylce a gsm_lchan when the refcount drops to zero
When a channel is allocated, start a timeout, when a lchan_use
is used the timer will be restarted, when the timeout fires
we will try to recycle or restart the timer.
2008-12-30 19:18:21 +00:00
Holger Freyther 36cbeff164 Document where Channel release is coming from 2008-12-30 19:15:20 +00:00