aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_sndcp.c
AgeCommit message (Collapse)AuthorFilesLines
2014-10-10sgsn: Prevent memory leak and double freeHolger Hans Peter Freyther1-3/+6
This has been re-produced using the "osmo-pcu emulator" code and a ping to force segmented SNDCP messages. When the NS link enters the DEAD/BLOCKED state the msgb would be freed twice. Once inside gprs_ns_sendmsg and once by the caller. Based on the return one can not see if the parameter has been deleted. I changed libosmocore/libosmogb to always free the msgb in case of an error on the way to gprs_ns_sendmsg. Catch up, avoid the double free and fix some memory leaks. In case the sending fails assume the entire segmented message is at end and free the original input data. This has been tested by posix suspending/resuming the emulator process to have the GPRS-NS link go to dead/blocked to alive and unblocked. The ping recovers and "SIGUSR1" to the SGSN does not show active memory allocations. The SGSN calls bssgp_tx_dl_ud at the lowest level and has the following callchains. Most of them allocate the msgb and have no early return and transfer ownership already: <- gprs_llc_tx_u <- gprs_llc_tx_ui <- gsm48_gmm_sendmsg (all callers sane) <- _tx_status <- _tx_detach_req <- gprs_llc_tx_xid (all callers sane) <- sndcp_unitdata_req <- sndcp_send_ud_frag
2014-04-04gprs: Fix compiler warnings in gprs_sndcp.cHolger Hans Peter Freyther1-4/+2
CC gprs_sndcp.o gprs_sndcp.c: In function ‘defrag_input’: gprs_sndcp.c:188:25: warning: variable ‘scomph’ set but not used [-Wunused-but-set-variable] struct sndcp_comp_hdr *scomph = NULL; ^ gprs_sndcp.c: In function ‘sndcp_llunitdata_ind’: gprs_sndcp.c:512:11: warning: variable ‘npdu_num’ set but not used [-Wunused-but-set-variable] uint16_t npdu_num; ^ gprs_sndcp.c: At top level: gprs_sndcp.c:565:12: warning: ‘sndcp_ll_reset_ind’ defined but not used [-Wunused-function] static int sndcp_ll_reset_ind(struct gprs_sndcp_entity *se) ^ gprs_sndcp.c:573:12: warning: ‘sndcp_ll_status_ind’ defined but not used [-Wunused-function] static int sndcp_ll_status_ind() ^
2012-06-16split libgb into a separate library for outside useHarald Welte1-1/+1
This also removes the dependency to osmo_sock() inside libcommon and replaces it with osmo_sock_* from libosmocore
2012-03-01misc: Use msgb_free for freeing the messagesHolger Hans Peter Freyther1-1/+1
2011-10-14gprs: Fix compiler warnings in the codeHolger Hans Peter Freyther1-0/+4
2011-03-23src: use new library libosmogsm and new path to headers in libosmocorePablo Neira Ayuso1-4/+4
libosmogsm is a new library that is distributed in the libosmocore. Now, openbsc depends on it. This patch gets openbsc with this change. This patch also rewrites all include path to the new osmocom/[gsm|core] Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-01-01License change: We are now AGPLv3+ instead of GPLv2+Harald Welte1-6/+5
The reason for this is quite simple: We want to make sure anyone running a customized version of OpenBSC to operate a network will have to release all custom modifiations to the source code.
2010-07-02[SGSN] SNDCP: Subtract SNDCP header from fragment lengthHarald Welte1-2/+3
We don't want to store too many bytes as we would otherwise create too large re-assembled packets..
2010-07-02[SGSN] SNDCP: SN-PDUs need a 16bit length fieldHarald Welte1-1/+2
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[SGSN] SNDCP: re-set total number of fragment lengthHarald Welte1-1/+7
2010-07-02[SNDCP] some more defragmentation debug statementsHarald Welte1-11/+9
2010-07-02[SGSN] SNDCP defrag: use correct length, don't include LLC FCSHarald Welte1-3/+4
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[SGSN] SNDCP: Actually copy the payload data in the defrag queue entryHarald Welte1-0/+2
Prior to this patch our defragmented messages always consisted of 00-bytes
2010-07-02[SGSN] SNDCP: Fix off-by-one error missing last segment in defragHarald Welte1-1/+1
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-01[SGSN] SNDCP: more verbose defragmentation debuggingHarald Welte1-2/+8
2010-07-01[SGSN] Fix segfault when passing re-assembled SN-PDU to GMMHarald Welte1-3/+5
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[SGSN] SNDCP: fix off-by-one error during defragmentationHarald Welte1-1/+1
2010-07-01[SGSN] SNDCP: Initialize defrag list headerHarald Welte1-0/+1
2010-07-01[SGSN] SNDCP: use llist_for_each_entry_safe() when cleaning frag queueHarald Welte1-2/+2
2010-07-01[SGSN] Add VTY interface for SNDCPHarald Welte1-67/+31
2010-06-10[gprs] sndcp: Fix call to msgb_alloc_headroom to have both head&tail roomSylvain Munaut1-2/+2
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-03[GPRS] SNDCP: Implement fragmentation of N-PDUs to SN-PDUs in downlinkHarald Welte1-28/+346
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[GPRS] SNDCP: Check if SN-PDU is too large and reject itHarald Welte1-0/+8
... since we don't do fragmentation yet
2010-06-03[GPRS] implement GTP->SNDCP->LLC downlink user-data pathHarald Welte1-0/+36
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-02[GPRS] SNDCP: Fix PCOMP and DCOMP header field lengthHarald Welte1-2/+2
They're both just one 4bit nibble, not 1 byte each.
2010-06-02[GPRS] SNDCP: Add new SNDCP Entity to global list of entitiesHarald Welte1-4/+7
Also, don't reject SN-PDUs with positive packet length.
2010-06-02[GPRS] SNDCP use DSNDCP instead of DGPRSHarald Welte1-6/+6
2010-06-02[GPRS] SNDCP: Fix header length (pcomp is part of common_hdr)Harald Welte1-9/+18
Also add some more debug statements
2010-06-01[GPRS] hand SNDCP N-PDUs to the GTP to the GGSNHarald Welte1-12/+144
This so far only works for UNIT-DATA and only if the N-PDU is not fragmented at the SNDCP layer.
2010-05-17[GPRS] Initial untested support for libgtpHarald Welte1-0/+59
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-04[gprs] Move all GPRS related code to src/gprs subdirectoryHarald Welte1-0/+70