Commit Graph

806 Commits

Author SHA1 Message Date
Harald Welte c5d4a0ced1 [SGSN] Print AP name and PDP address of each PDP context 2010-07-02 22:51:16 +02:00
Harald Welte 6add7c2009 [SGSN] Correctly pass IMSI of MM ctx to GTP/GGSN 2010-07-02 22:47:39 +02:00
Harald Welte 3d6815abd1 [SGSN] SNDCP: Subtract SNDCP header from fragment length
We don't want to store too many bytes as we would otherwise create
too large re-assembled packets..
2010-07-02 17:16:07 +02:00
Harald Welte 36f1217f32 [SGSN] SNDCP: SN-PDUs need a 16bit length field
The BSSGP LLC-PDU IE can have up ot 16bit length, so subtracting
the LLC header the SN-PDU can still have almost a length field
close to 0xffff
2010-07-02 16:44:24 +02:00
Harald Welte 8b705f2533 [SGSN] SNDCP: re-set total number of fragment length 2010-07-02 16:18:59 +02:00
Harald Welte 18d1452a92 [SGSN] Send poper SM and GMM STATUS in case we have no MM CTX 2010-07-02 16:18:18 +02:00
Harald Welte ab4094ca6b [SNDCP] some more defragmentation debug statements 2010-07-02 16:01:47 +02:00
Harald Welte 60da7d4f88 [SGSN] SNDCP defrag: use correct length, don't include LLC FCS
The LLC layer tells us the PDU length, and we have to use it
in SNDCP rather than to re-calculate it if we want to avoid copying
the CRC24 into the defrag elements.
2010-07-02 15:45:12 +02:00
Harald Welte 8f0c0a3a3c [SGSN] SNDCP: Actually copy the payload data in the defrag queue entry
Prior to this patch our defragmented messages always consisted of 00-bytes
2010-07-02 10:29:06 +02:00
Harald Welte 11ff3e8ec2 [SGSN] Remove old dead code 2010-07-02 10:17:24 +02:00
Harald Welte 19f9e30eb9 [SGSN] Only increment PDP CTX ACT count after check for retransmission 2010-07-02 10:15:49 +02:00
Harald Welte b37515e86b [SGSN] Account for re-transmitted PDP CTX ACT REQ
In case our PDP CTX ACT ACK gets lost on the Gb or Um link,
the MS re-transmits the PDP CTX ACT REQ.  We have to ACK it
again instead of REJecting it..
2010-07-02 10:12:58 +02:00
Harald Welte 993697c8d2 [SGSN] SNDCP: Fix off-by-one error missing last segment in defrag
When we defragment the segments from the defrage queue, we have
to iterate all the way up to (and including) the last segment number
that we have received.
2010-07-02 10:11:42 +02:00
Harald Welte b87bc86006 [SGSN] SNDCP: more verbose defragmentation debugging 2010-07-01 20:29:20 +02:00
Harald Welte 8911cef81d [SGSN] Fix segfault when passing re-assembled SN-PDU to GMM
sgsn_rx_sndcp_ud_ind() can no longer make the assumption that msgb_bcid() is
valid, as this is only true for an un-fragmented SN-PDU.  So instead,
we now store the RAID in the SNDCP Entity and pass it as an explicit
argument to sgsn_rx_sndcp_ud_ind().
2010-07-01 19:56:19 +02:00
Harald Welte 951a12cf4e [SGSN] SNDCP: fix off-by-one error during defragmentation 2010-07-01 15:09:45 +02:00
Harald Welte 362aea0f4d [SGSN] SNDCP: Initialize defrag list header 2010-07-01 12:31:10 +02:00
Harald Welte fd29a1f6cc [SGSN] GMM: Complete value_string for GMM cause values 2010-07-01 12:26:59 +02:00
Harald Welte 65d96783df [SGSN] SNDCP: use llist_for_each_entry_safe() when cleaning frag queue 2010-07-01 12:19:02 +02:00
Harald Welte 875840c603 [SGSN] Fix TLLI (re)assignments
Once The TLLI (or P-TMSI of which it is derived) change has been
confirmed by the MS, we need to unassign the old TLLI but keep
the new TLLI  _without_ re-setting the LLC entity structure such
as VUsend /VUrecv counters.
2010-07-01 11:54:31 +02:00
Harald Welte 937a9ecfcd [SGSN] Fix segfault when doing PS PAGING
The 'bssgp_paging_info' contains a pointer to the P-TMSI, and not
the P-TMSI itself.  The reason is that it is an optional BSSGP IE.
2010-07-01 11:53:25 +02:00
Harald Welte f78a3b2a22 [SGSN] Add VTY interface for SNDCP 2010-07-01 10:57:44 +02:00
Harald Welte 43ef6483db [SGSN] BSSGP: Print TLLI as hex value like everwhere else 2010-06-30 09:01:35 +02:00
Harald Welte 8fc60f0eb5 [SGSN] Deactivate SNDCP entity on PDP CTX DEACT CONFIRM
Otherwise we will end up leaking memory in the SNDCP layer...
2010-06-28 22:21:57 +02:00
Harald Welte bd5c91276b [SGSN] MM: Properly communicate TLLI changes / unassignment to LLC 2010-06-28 22:18:53 +02:00
Harald Welte f7fef48e1b [SGSN] LLC: properly free LLC entities at TLLI unassignment 2010-06-28 22:18:26 +02:00
Harald Welte c0d59504b4 [SGSN] Deactivate all PDP contexts on GPRS DETACH 2010-06-28 19:11:41 +02:00
Harald Welte 376d5e521e [SGSN] Fix segfault ar PDP CTX DEACT time
We need to call rate_ctr_group_free() on the per-PDPctx-counters
2010-06-28 18:57:21 +02:00
Holger Hans Peter Freyther 2788b96bf4 gprs: Fix LOGP misuse and specify LOGL_NOTICE as region. 2010-06-23 09:48:25 +08:00
Harald Welte 993d06065a [GPRS] Add comment on GTP being defined in 29.060 / 09.060 2010-06-14 17:00:51 +02:00
Sylvain Munaut 644a0cac0c [gprs] bssgp: Fix LLC PDU length encoding in BSSGP.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-10 15:15:42 +02:00
Sylvain Munaut eda125ca51 [gprs] sndcp: Fix call to msgb_alloc_headroom to have both head&tail room
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-10 15:15:42 +02:00
Sylvain Munaut 5914bad40b [grps] Fix GTP data_ind call back message creation
We'll need to push data both before and after, so make sure there
is both headroom & tailroom

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-10 15:15:42 +02:00
Harald Welte efbdee9a5c [GPSR] SGSN: Keep traffic counters for each PDP context 2010-06-10 15:12:38 +02:00
Harald Welte bb35c45a02 [GPRS] BSSGP/SGSN: Implement Gb-Interface Paging
We now have a function that generates BSSGP PS and CS paging request.

It is called from the libgtp code when we receive a GTP packet from
the GGSN for a MM context that is in SUSPEND state.  We then issue
a PS paging request to the Cell with the BVCI where the last RA update
was being performed.

TODO: We still don't enqueue the GTP packet (and transmit it on paging
complete), and we don't rate-limit the paging requests, i.e. every GTP packet
will trigger another paging request.

We probably also need some kind of logic that marks the phone as UNREGISTERED
if it doesn't respond to paging requests for some time.
2010-06-10 15:12:38 +02:00
Harald Welte bffeff8089 [GPRS] SGSN: fix typo 2010-06-10 15:12:38 +02:00
Harald Welte 5bfe499366 [GPRS] SGSN: Pass BSSGP SUSPEND/RESUME up to GMM and alter MMCTX state 2010-06-09 21:40:45 +08:00
Harald Welte f54e7e2102 [GPRS] GMM/SM: Improve error handling by sending STATUS messages 2010-06-09 21:40:45 +08:00
Harald Welte 588d44ee65 [GPRS] Drop all PDP contexts not present in PDP CTX STATUS IE at RA UPD 2010-06-09 21:40:45 +08:00
Harald Welte 60ebc02ba8 [GPRS] SM: Acknowledge PDP CTX DEACT for non-existing PDP CTX
Some phones (notably a Ericsson Mobile Platform based E-TEN M800)
insist on sending PDP CTX DEACT messages for contexts that have already
been deactivated.  The spec doesn't really say what we should do in
this case. But since there is no "reject", we simply acknowledge it.
2010-06-09 21:40:45 +08:00
Holger Hans Peter Freyther 62d97986a3 GPRS: Copy the content of the msgb instead of creating one that points to the other
Right now the memcpy with the data will copy data to itself as
the new_msg->data and msg->data are the same due the previous
copying of the header which included copying the list entry..

We allocate a message as big as the current one, then we have to
set all pointers by looking of how far they are away from the
msg->_data and add that to the new pointers.

Also copy the OpenBSC/GPRS specific CB data, also do the same
for calculating the offset to the data... At the end we should
end up with a copy...
2010-06-09 21:40:44 +08:00
Holger Hans Peter Freyther 62eaf54e7a GPRS: Fix crash when the peer can not be found...
Use UINT_MAX (or -1) if the peer can not be found.
2010-06-09 21:40:44 +08:00
Holger Hans Peter Freyther 57da4471d1 misc: Fix the return type of the go back vty function...
Without this we will get warnings about incompatible assignments
2010-06-09 21:40:44 +08:00
Holger Hans Peter Freyther 89476f5c8f GPRS: Fix compiler warning that will also lead to a crash at runtime. 2010-06-09 21:40:36 +08:00
Harald Welte 3a7074615f [GPRS] BSSGP: Fix formatting of BSSGP TX STATUS 2010-06-03 21:30:57 +02:00
Harald Welte ce22f92b6c [GPRS] SNDCP: Implement fragmentation of N-PDUs to SN-PDUs in downlink
Using the code of this commit, it was possible to provision GPRS
services and access a website from a G1 phone (Qualcomm MSM7k baseband chipset)
using a nanoBTS, Osmo-SGSN and OpenGGSN.

There is still no fragment re-assembly in the uplink path yet,
despite the (untested) code present in the gprs_sndcp.c file
2010-06-03 21:21:21 +02:00
Harald Welte db2c39f888 [GPRS] SNDCP: Check if SN-PDU is too large and reject it
... since we don't do fragmentation yet
2010-06-03 07:16:04 +02:00
Harald Welte 1d9d944310 [GPRS] LLC: Implement per-SAPI default values for LLC parameters 2010-06-03 07:11:04 +02:00
Harald Welte bb1c805718 [GPRS] implement GTP->SNDCP->LLC downlink user-data path
This only works for packets that are small enough to not need
fragmentation at the SNDCP layer (dns queries, ntp and the like).

It requires libgtp built from OpenGGSN dc3744fda045f9fca83de6881176987335a309a8
or later.  Plain 0.90 will NOT work.

Using this version, I could see bi-directional traffic from various
phones going all the way through BTS, OsmoSGSN, OpenGGSN and being routed
to and from the real internet.  Time to celebrate...
2010-06-03 06:38:38 +02:00
Harald Welte 96df60637a [GPRS] add comments to SGSN header file 2010-06-03 06:38:09 +02:00
Harald Welte 52421a0551 [GPRS] SGSN: specify the local bind address in the config file 2010-06-02 23:18:40 +02:00
Harald Welte 61ca7ce006 [GPRS] SGSN: use correct length+data for GSN_ADDRESS
We have to copy the sin_addr.s_addr, rather than the entire sin_addr.  The
latter results in the destination interpreting it as an IPv6 address, as
the only differentiator between IPv4 and IPv6 is the size of the payload
of this IE.
2010-06-02 23:17:33 +02:00
Harald Welte 5cc2bc37a7 [GPRS] SNDCP: Fix PCOMP and DCOMP header field length
They're both just one 4bit nibble, not 1 byte each.
2010-06-02 23:17:05 +02:00
Harald Welte e300d0021c [GPRS] SGSN: Allow vty-based configuration of local listen/bind IP for GTP 2010-06-02 12:41:34 +02:00
Harald Welte 6144452068 [GPRS] SNDCP: Add new SNDCP Entity to global list of entities
Also, don't reject SN-PDUs with positive packet length.
2010-06-02 12:40:48 +02:00
Harald Welte 69996cb534 [GPRS] SNDCP use DSNDCP instead of DGPRS 2010-06-02 10:26:19 +02:00
Harald Welte 16836a37aa [GPRS] SNDCP: Fix header length (pcomp is part of common_hdr)
Also add some more debug statements
2010-06-02 10:25:40 +02:00
Harald Welte f11b6d2f30 [GPRS] SGSN: fix another segfault (and use-after-free) when GGSN is dead 2010-06-02 10:09:50 +02:00
Harald Welte ebabdea0a6 [GPRS] hand SNDCP N-PDUs to the GTP to the GGSN
This so far only works for UNIT-DATA and only if the N-PDU is not fragmented at
the SNDCP layer.
2010-06-01 18:28:10 +02:00
Harald Welte 807a5d8264 [GPRS] Major LLC / TLLI handling fixes
* separate the LLME and LLE state in the LLC layer
* introduce gprs_llgmm_assign() function for LLGMM-ASSIGN.req primitive
* change QoS profile to match 'real' SGSN
* Update the new TLLI when assigning a P-TMSI

The result now is that the LLC layer is notified of TLLI changes, which in turn
means it doesn't allocate a new LLE structure every TLLI change, which again
in turn means that the UI frame sequence number does not reset to zero.

As a result, MS should no longer ignore frames based on wrong UI sequence number.
2010-06-01 11:57:13 +02:00
Harald Welte 1371f7dd2f [GPRS] SGSN GTP: Fix segfault in case GGSN is down 2010-06-01 11:52:41 +02:00
Harald Welte f7b3a219f6 [GPRS] update SGSN config file example 2010-06-01 11:52:21 +02:00
Harald Welte dce1255d8f [GPRS] GMM: Set LLC 'C/R' bit when sending IDENTITY REQUEST
Commands initiatied by the SGSN have to set C/R = 1
2010-05-31 22:31:04 +02:00
Harald Welte 56a0145dd8 [GPRS] Include IMSI and DRX params in BSSGP DL-UD
When we send a downlink unit-data request via BSSGP, there is a lot
of information that needs to be copied from the mm context, such as
the IMSI, DRX parametes, MS radio access parameters, ...

This is a quite strange layering violation, since we now need to pass
a pointer to the MM ctx from GMM through LLC into BSSGP :(
2010-05-31 22:12:30 +02:00
Harald Welte c2e8cc4a10 [GPRS] Implement TMSI reallocation and timers 3350 + 3370
Our state transitions and timers now reflect 04.08 for GMM much
better than before.  Also, we allocate a new P-TMSI on every ATTACH
and RA UPDATE, as some phones seem to get confused if they don't
get a P-TMSI.
2010-05-31 20:23:38 +02:00
Harald Welte 3d379ba589 [GPRS] BSSGP: Fix way too long TLLI debug line 2010-05-31 20:18:35 +02:00
Harald Welte c91ce1a9d3 [GPRS] BSSGP: More verbose debug log / error reporting 2010-05-31 18:07:17 +02:00
Harald Welte 72b4b20a2a [GPRS] BSSGP: When we receive a BLOCK, we should not respond with UNBLOCK-ACK 2010-05-31 17:16:36 +02:00
Harald Welte a6932d2eae [GPRS] NS: Fix GRE keepalive response in FR-GRE encapsulation 2010-05-31 11:02:57 +02:00
Harald Welte 02ea86fa71 [GPRS] BSSGP: Acknowledge all SUSPEND and RESUME requests
This is of course not the correct way of dealing with it, but for
now it should make the Ericsson Mobile Plafrom based phones happy
(they insist to do a suspend/resume cycle before pdp ctx act)
2010-05-30 22:00:53 +02:00
Harald Welte 6bdee6ada3 [GPRS] LLC: Increment V(U) and N(U) 2010-05-30 22:00:42 +02:00
Harald Welte b12aa4b1ee [GPRS] GMM: Add some FIXME's to the code 2010-05-30 20:28:22 +02:00
Harald Welte d75d71e95c [GPRS] NS: correctly pass the NS payload length to the TLV parser 2010-05-30 17:19:38 +02:00
Harald Welte 0ede21f547 [GPRS] NS: Don't hand Frame Relay LMI packets into the NS code 2010-05-28 16:12:57 +02:00
Harald Welte cc540c4a0c [GPRS] NS: Respond to GRE keepalive messages
GRE has the strange notion of keepalive messages being encapsulated IPv4
packets adressed back to the sender.  Since we actually really only care
about frame relay, this is a bit strange.  However, we'll do some sanity
checks and send it back through our GRE socket...
2010-05-28 16:06:53 +02:00
Harald Welte edcc3b8945 [GPRS] NS: Frame Relay DLCI for PVC from 16-1007
0 		Reserved for ANSI Annex D and CCITT Annex A link management
1 - 15 		Reserved
16 - 1007 	Any PVC
1008 - 1018 	Reserved
1019 - 1022 	Reserved for LMI multicast
1023 		Reserved for LMI link management
2010-05-28 14:11:49 +02:00
Harald Welte ea985a4357 [GPRS] NS: Print error message if TLV parser fails for some reason 2010-05-28 10:08:14 +02:00
Harald Welte dccf55535a [GPRS] NS: Start TEST procedure, not ALIVE procedure, on RESET/RESET_ACK
According to the spec, after an incoming RESET or RESET_ACK, we shall start the
TEST procedure, not the ALIVE procedure.

Also, when we start the TEST procedure, we have to always send a NS_ALIVE
packet at the same time (we didn't in the case of incoming RESET).

Furthermore, we now only start TIMER_TNS_ALIVE from within the
TIMER_TNS_RESET callback code, where we also make sure that the
alive_retries counter is reset to zero.
2010-05-28 10:03:14 +02:00
Holger Hans Peter Freyther 900aeaf415 gprs: Subtract the headroom for what we can receive
The buffer got allocated with headroom and we need to
subtract that from the size of the buffer.
2010-05-28 03:25:36 +08:00
Harald Welte c31f480f08 [VTY] use new struct vty_app_info in libvty 2010-05-25 23:40:38 +02:00
Harald Welte 4b037e4117 Migrate VTY code to libosmovty 2010-05-25 23:40:38 +02:00
Harald Welte 4f1e81543a [GPRS] NS: Always generate LOG_INFO message when we block NS-VC 2010-05-25 22:17:30 +02:00
Harald Welte 9ac340ef06 [GPRS] Use new 'encapsulation udp local-port 23000' in osmo_sgsn.cfg 2010-05-25 11:20:53 +02:00
Holger Hans Peter Freyther fa848d4923 gprs: Cast the lh to uint_8* and make the other method non-const
We are assigning the header to non const methods... so make
the param non-const.
2010-05-23 21:43:57 +08:00
Holger Hans Peter Freyther 3a6fdcd717 gprs: make gprs_llc_hdr_dump return void. 2010-05-23 21:35:25 +08:00
Holger Hans Peter Freyther 4752e0c3de gprs_llc.c: memset the llhp struct to be sure it is initialized. 2010-05-23 21:33:57 +08:00
Holger Hans Peter Freyther d6ca49633c gb_proxy_vty.c: Remove variable that appears to be unused
There is no other in_addr inside this file and it appears
that we don't use the 'ia' right now and will not use it
in the near future.
2010-05-23 21:25:41 +08:00
Holger Hans Peter Freyther 2fbf12dbeb gprs_ns_frgre.h: Create the header and include it 2010-05-23 21:23:44 +08:00
Holger Hans Peter Freyther cf4e9c8f07 gprs_ns.c: Make make_socket known to the compiler 2010-05-23 21:19:55 +08:00
Holger Hans Peter Freyther 83e0b3f544 gprs: Fix warnings on funny casts for the return statement
Change gprs_nsvc_reset to return void instead of a int
as the gb_proxy.c currently ignores the reutnr value anyway.

Change the caller inside gprs_ns to return the newly allocated
nsvc instead of the return of gprs_nsvc_reset.
2010-05-23 21:18:01 +08:00
Holger Hans Peter Freyther 9e28ecc325 gprs_bssgp.c: Return something from non void methods.
In one use the rc variable we are assigning to, in the
others return 0 even if we have a FIXME there.
2010-05-23 21:12:15 +08:00
Holger Hans Peter Freyther 2e22a5d85d gprs_bssgp.c: Cast const of TLVP_VAL away.
Fix a compiler warning, we cast the const away at various
other parts in the code as well. We should consider removing
the const from the TLV struct..
2010-05-23 21:11:19 +08:00
Holger Hans Peter Freyther 972c1f33b9 gprs: Disable strict aliasing as we are breaking the rules right now 2010-05-23 20:51:03 +08:00
Harald Welte 268bed07c0 [GPRS] Gb proxy VTY: Make sure all lines are aligned properly 2010-05-19 17:42:20 +02:00
Harald Welte 7570c21424 [GPRS] Gb Proxy: print only one line for every BVCI 2010-05-19 17:06:16 +02:00
Harald Welte 6624cae775 [GPRS] NS: Better formatting of VTY output 2010-05-19 17:02:57 +02:00
Harald Welte 94ac58e04e [GPRS] NS: properly parse FR DLCI on Rx 2010-05-19 16:48:12 +02:00
Harald Welte e72c61cc6f [GPRS] NS: Never respond to STATUS with STATUS to prevent loops! 2010-05-19 16:01:39 +02:00
Harald Welte ea92ac3777 [GPRS] NS: SOCK_RAW sockets always provide the full IPv4 header on receive 2010-05-19 15:53:22 +02:00
Harald Welte ffe191c477 [GPRS] NS/FR/GRE rcvmsg case: msgb_free() in error case 2010-05-19 15:46:49 +02:00
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