ladpm: Fix msgb handling and SAPI=3 establishment delay

Currently it takes 3s to establish a SAPI 3 SACCH connection with
osmo-bts. This is due to the fact, that a broken SABME request is
sent first and and is ignored by the MS. Then, after a T200 timeout
(2s) the SABME command is sent again (this time correctly) and
answered by the MS.

The first SABME message is broken (it has a length field of 3 and
ends with 3 bytes from the tail of the original RSL message),
because of it is expected throughout lapdm.c that msg buffers
containing RSL have msg->l2h == msg->data. Some abis input drivers
fulfill this but IPA doesn't, thus the 3 bytes of the IPA header
are still part of the msg and confuse length computation.

Since internal fields of the msg are modified directly, this is
difficult to see.

This patch adds a new function msgb_pull_to_l3() that explicitely
skips over all headers prepending L3 and therefore resets l1h and
l2h. This function is then used instead of msgb_pull_l2h() which
only worked correctly when msg->l2h == msg->data. In addition,
code manipulating msg->tail and msg->len directly has been replaced
by calls to msgb_trim().

Note that this patch does not fix all issues of this case in the LADP
related code.

Ticket: SYS#192
Sponsored-by: On-Waves ehf
Merge branch 'jerlbeck/fixes/ladp-sms'
sms: Fix typo in a macros name: GSM340_SMS_RESSERVED -> GSM340_SMS_RESERVED.
lapd: Improve log message and mention the SAPI the dl is on

When debugging an issue that involves SAPI=0 and SAPI=3 the
log file does not have enough context. Add the SAPI to this
message so we at least understand which SAPI we are talking
about.
sms_test: Do not crash on logging.
lapdm: Make lapdm_datalink_for_sapi public

This API allows you to get the lapdm_datalink for a SAPI. It's needed in
the lapdm_test, so make it public.
tests/lapd: Add a testcase to check for LAPDm sync issues

Regression test for LAPDm recording the current state
gsm/lapdm: Prevent LAPD tx_queue from filling up in polling mode

If LAPDm receives an I-Frame while there already is an I-Frame in the
tx_queue the code generates an additional RR (to acknowledge the
received I-Frame). Instead, N(R) of the I-Frame in the tx_queue should
be updated to ACK the data.
Merge remote-tracking branch 'daniel/lapdm-desync'

This should fix long delays when sending a long SMS on an encrypted
channel. It is the most minimal change to the polling mode. One
option we discussed internally is to queue a higher level representation
and generate the actual LAPDm frames later.
sms: Add missing brackets in the relative validity time calculation.
src/socket: Adding unix domain socket support

Added some function for adding the unix domain socket support.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
Release: Prepare the release of 0.6.6
backtrace: Speculative fix for FreeBSD10.0 and execinfo.h

FreeBSD 10.0 ships an execinfo.h but one needs to link to an
additional library for the backtrace functions. Check if there
is a backtrace symbol in libexecinfo and if so link to that
library.