aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2014-08-28osmux: allow to specify the osmux frame sizePablo Neira Ayuso1-6/+10
This patch adds a new field to the struct osmux_in_handle that allows you to specify the osmux frame size. If not specified, the default size assumes your nic uses a mtu of 1500 bytes.
2014-08-28osmux: fix leak in osmux_replay_lost_packets()Pablo Neira Ayuso1-2/+1
The original RTP header has been already sanity check. Therefore, we can assume the clone is sane.
2014-08-28osmux: revisit osmux_batch_enqueue() in case of batch fullPablo Neira Ayuso1-5/+12
1) Force batch delivery in case it is full. 2) Skip padding with more RTP clone in case of message lost if the batch is full.
2014-08-28osmux: add osmux_xfrm_input_fini()Pablo Neira Ayuso1-0/+12
To clean up the osmux input handle.
2014-04-28debian: Attempt to build a package with just the DSOHolger Hans Peter Freyther1-0/+1
Follow the debian rule to package the DSOs separately.
2014-04-28debian: Prepare a new debian release and bump SO versionHolger Hans Peter Freyther1-1/+1
2014-04-25osmux: cleanup debugging messagePablo Neira Ayuso1-7/+2
Remove message that is printed twice and reword the messages to make it more clear the traffic flow when compressing and decompressing the RTP AMR traffic.
2013-12-16osmux: (really) validate AMR FT fieldPablo Neira Ayuso1-10/+12
(dc898ab osmux: don't trust AMR FT field) was not correctly validating the AMR FT field as it was comparing the same value twice calculated in different ways. Use osmo_amr_bytes(amrh->ft) to obtain the expected length and check if it is what we got. Use the output of osmo_rtp_get_payload() as it also includes the RTP payload stripping possible extensions.
2013-12-16osmux: don't trust AMR FT fieldPablo Neira Ayuso1-1/+9
Sanity check that that we have enough bytes in the AMR payload for this frame-type.
2013-12-16osmux: limit RTP messages per batchPablo Neira Ayuso1-9/+38
The ctr field of the osmux header is 3 bits long, make sure we don't run over that boundary. This should not happen in practise unless we have to deal with network congestion or broken RTP stacks, but osmux should not crash in that case.
2013-12-16osmux: fix handling of old RTP messagesPablo Neira Ayuso1-1/+1
Make sure that osmux_replay_lost_packets() doesn't try to fill gaps if we see RTP messages whose sequence number is in the past.
2013-12-15osmux: pass rtp header to osmux_batch_add()Pablo Neira Ayuso1-7/+3
This patch is a cleanup. Pass the pointer to the header, so we don't need to obtain it from the message buffer again.
2013-12-15osmux: fix handling of too big RTP message in osmux_xfrm_input()Pablo Neira Ayuso1-1/+1
With this patch, osmux_xfrm_input() returns 0 (means "message has been processed") instead of 1 (means "retry") if the RTP message is too big to fit into one osmux batch. This fixes a likely infinite loop in the caller, which will retry forever for a message does not fit into the batch. Unlikely to happen in normal scenario, as RTP+AMR messages are way smaller than the interface MTU.
2013-12-14amr: use AMR_FT_MAX instead of hardcoded numberPablo Neira Ayuso1-1/+1
Use AMR_FT_MAX instead of 9. This patch is a cleanup.
2013-12-14osmux: don't print messages with wrong AMR FTPablo Neira Ayuso1-0/+6
The AMR FT field is used to infer the length of the payload, if a value higher than 8 (SID) is received, skip it. This fixes a possible crash in osmux_snprintf() in case we receive a malformed osmux header. This is also addresses the crash described in c733ae5b6e.
2013-12-14osmux: fix crash in osmux_snprintf when handling multi-batch messagesPablo Neira Ayuso1-2/+3
valgrind reports the following crash backtrace: !<001c> osmux.c:687 No room for OSMUX payload: only 49 bytes ==12800== ==12800== Process terminating with default action of signal 11 (SIGSEGV) ==12800== Access not within mapped region at address 0xDFA8E473 ==12800== at 0x4073FD2: osmux_snprintf (osmux.c:628) ==12800== by 0x80524F1: osmux_deliver (osmux.c:50) ==12800== by 0x407371C: osmux_xfrm_input_deliver (osmux.c:302) ==12800== by 0x4073792: osmux_batch_timer_expired (osmux.c:312) ==12800== by 0x405A4A0: osmo_timers_update (timer.c:243) ==12800== by 0x405A79A: osmo_select_main (select.c:133) ==12800== by 0x8049A53: main (mgcp_main.c:307) The problem is that osmux_snprintf() is not handling multi-batch messages (ie. messages that contain several osmux batches). More specifically, the offset to print the osmux batches was reset when parsing every osmux batch. The problem also manifested with wrong outputs. Reported by Mattias Lundstrom.
2013-12-13osmux: delete message from output list before calling tx_cbPablo Neira Ayuso1-2/+1
Valgrind complains about a possible use after free: ==12800== Invalid read of size 4 ==12800== at 0x4073DF6: osmux_tx_sched (linuxlist.h:119) ==12800== by 0x8052B0F: osmux_read_from_bsc_nat_cb (osmux.c:261) ==12800== by 0x453F967: ??? ==12800== Address 0x453f710 is 48 bytes inside a block of size 145 +free'd ==12800== at 0x402750C: free (vg_replace_malloc.c:427) ==12800== by 0x4064ADE: talloc_free (talloc.c:609) ==12800== by 0x405AAAA: msgb_free (msgb.c:72) ==12800== by 0x8052492: scheduled_tx_bts_cb (osmux.c:196) ==12800== by 0x4072CF8: osmux_tx_cb (osmux.c:554) ==12800== by 0x4073F03: osmux_tx_sched (osmux.c:582) ==12800== by 0x8052B0F: osmux_read_from_bsc_nat_cb (osmux.c:261) ==12800== by 0x453F967: ??? The problem is that osmux_tx_sched may immediately call osmux_tx_cb for the first extracted RTP message from the osmux batch, which releases the message after that. Remove the message from our list of messages to be transmitted before the message is passed to the tx callback. Reported by Mattias Lundstrom.
2013-09-12osmux: add artificial limit for cloned RTP packetsPablo Neira Ayuso1-0/+4
Avoid spamming lots of cloned RTP packets in case of severe gaps.
2013-08-27osmux: sanity check too big RTP/RTCP messages as inputPablo Neira Ayuso1-0/+6
Holger spotted that the caller may loop forever in case it receives big RTP/RCTP packets, that are likely to be spoofed.
2013-08-25ipa_unit: use talloc_strdupPablo Neira Ayuso1-12/+12
Reported by Holger.
2013-05-27osmux: disable timing debuggingPablo Neira Ayuso1-1/+1
Disable timing debugging by default.
2013-05-24osmux: nul-terminate all strings generated by _snprintfPablo Neira Ayuso1-0/+3
Make sure all strings are null-terminated. Spotted by Holger Hans Peter Freyther.
2013-05-24osmux: further sanity checkings for AMR FTPablo Neira Ayuso2-5/+44
According to RFC3267, AMR FT upper 9 should be discarded. This patch adds extra validation to make sure that input RTP traffic encapsulating AMR payload and OSMUX amr_ft field are OK with regards to that restriction.
2013-05-24amr: add AMR FT SID definitionPablo Neira Ayuso1-0/+1
According to RFC3267, AMR FT 8 is reserved to SID and its size is 8 bytes.
2013-05-24osmux: add sanity checking in osmux_xfrm_output_pullPablo Neira Ayuso1-2/+11
Osmux infers the size of the AMR payload from the FT type. Make sure we get enough data from the network according to what we expect.
2013-05-23osmux: remove trailing line break from osmux_snprintfPablo Neira Ayuso1-1/+1
2013-05-22rtp: fix wrong time arithmetics in osmo_rtp_buildPablo Neira Ayuso1-2/+2
rtp.c:154:26: warning: The left operand to '/' is always 0 frame_diff = (usec_diff / 20000); ~~~~~~~~~ ^ rtp.c:157:43: warning: The left operand to '-' is always 0 long int frame_diff_excess = frame_diff - 1; ~~~~~~~~~~ ^ rtp.c:153:39: warning: The right operand to '+' is always 0 usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec; ^ ~~~~~~~~~~~~~~~ rtp.c:153:29: warning: The left operand to '*' is always 0 usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec; ~~~~~~~~~~~~~~ ^ 4 warnings generated. Reported by Holger Hans Peter Freyther.
2013-05-22osmux: fix warning spotted by clang --analyzePablo Neira Ayuso1-1/+1
osmux.c:622:20: warning: Value stored to 'osmuxh' during its initialization is never read struct osmux_hdr *osmuxh = (struct osmux_hdr *)msg->data; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reported by Holger Hans Peter Freyther.
2013-05-21osmux: replay last RTP packet seen under packet loss scenarioPablo Neira Ayuso1-0/+51
If osmux notices a gap between two RTP packets, fill it with the last RTP packet seen. Without this patch, 10% of packet loss is enough to get garbage, with it we get glitches in the conversation with 30%, and pretty much broken conversation with 40% of it.
2013-05-20osmux: use ccid to identify batches instead of the RTP SSRCPablo Neira Ayuso1-8/+5
This should reduce the amount of batch nodes that are created by the maximum number of allowed circuit IDs.
2013-05-12osmux: add sanity checking to osmux_snprintfPablo Neira Ayuso1-5/+18
Add sanity checking to avoid crashes on malformed OSMUX packets
2013-05-12osmux: allow to set initial RTP SSRCPablo Neira Ayuso1-3/+3
Instead of using the osmuxh->circuit_id.
2013-02-19osmux: add osmux_snprintfPablo Neira Ayuso1-0/+92
Useful for debugging purposes. Modify also examples to use it.
2013-02-19osmux: RTP payload type for voice is dynamicPablo Neira Ayuso1-5/+6
Don't make any assumption on the payload type.
2013-02-19osmux: add talloc contextPablo Neira Ayuso1-3/+5
Good for debugging leaks.
2013-02-19osmux: initialize batch appropriately in osmux_xfrm_input_initPablo Neira Ayuso1-1/+1
Use talloc_size not talloc. Should fix: 0xb779401a in rb_erase (node=0x200200, root=0xb779c908) at rbtree.c:230 0xb779401a in rb_erase (node=0x200200, root=0xb779c908) at rbtree.c:230 0xb778ee48 in osmo_timer_del (timer=0x94aacd0) at timer.c:110 0xb778ef65 in osmo_timer_add (timer=0x94aacd0) at timer.c:72 0xb778f03c in osmo_timer_schedule (timer=0x94aacd0, seconds=0, microseconds=64000) 0xb77360ff in osmux_xfrm_input (h=0x94a4280, msg=0x94b8a50, ccid=18) at osmux.c:390 Due to uninitialization batch structures.
2013-02-12osmux: use ft instead of the cmrPablo Neira Ayuso2-15/+15
The cmr is the requested codec for the other peer, the ft actually contains the current codec mode. cmr may contain 15 which means "don't care".
2013-02-12osmux: remove arrays from osmux_out_handlePablo Neira Ayuso1-10/+6
there will be one osmux_out_handle per endpoint.
2013-02-11osmux: allow to pass data to osmux_deliverPablo Neira Ayuso1-6/+6
2012-10-21osmux: fix missing data set in osmux_tx_schedPablo Neira Ayuso1-1/+1
2012-10-21dgram: add osmo_dgram_get_dataPablo Neira Ayuso1-0/+5
2012-10-20osmux: remove generic functions to register and get ccidPablo Neira Ayuso1-53/+12
Remove these functions: - osmux_xfrm_input_get_ccid - osmux_xfrm_input_register_ccid The ccid will be managed by the BSC and it will be stored in the mgcp_endpoint structure. Also adjust all tests and examples using the API.
2012-10-15ipa: fix compilation warningPablo Neira Ayuso1-3/+2
Shows up with gcc-4.7 ipa.c: In function 'osmo_ipa_rcvmsg_base': ipa.c:210:6: warning: variable 'ret' set but not used [-Wunused-but-set-variabl
2012-10-15osmux: fix DELTA_RTP_MSGPablo Neira Ayuso1-2/+3
It should be 16000 and add DELTA_RTP_TIMESTAMP which is 160.
2012-10-15osmux: rewrite batching functionPablo Neira Ayuso1-67/+97
Rework batching routine to reduce its complexity, updates: * Now it uses a list of lists to store the messages that will be batched. batch list | `-> node SSRC=a ---> ... ---> node SSRC=b | | msg seq=x1 msg seq=y1 | | msg seq=x2 msg seq=y2 | | msg seq=x3 msg seq=y3 | | msg seq=x4 msg seq y4 This keeps easier the creation of the final batch that is sent from that data structure. * We also detect duplicate messages in the batch, ie. messages with the same sequence are skipped. Still pending to resolve reordering, corruption and omissions (reliability is desired).
2012-10-15osmux: RTP timestamp has to be bumped in 160Pablo Neira Ayuso1-1/+1
Between two RTP messages that were extracted from a batch, the timestamp difference should be 160. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-10-15osmux: release of batch message is controled by callerPablo Neira Ayuso1-1/+0
Instead of internally released. This is required if we use the osmo_dgram infrastructure, to avoid a double release. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-10-15osmux: use DLMIB instead of internal defined DOSMUXPablo Neira Ayuso1-20/+17
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-08-21ipa: add osmo_ipa_parse_msg_id_respPablo Neira Ayuso2-30/+42
Code extracted from ipa_stream_server.c.
2012-08-19ipa: add ipa_cli_id_ack and ipa_cli_id_respPablo Neira Ayuso2-77/+77
This functions were before located in channel/abis/ipa_stream_client.c, but they are generic for IPA units.