gprs-ns/test: Re-add return value check for gprs_nsvc_reset

The return value check has been removed in the commit 'Use
gprs_nsvc_reset instead of gprs_ns_tx_reset', because gprs_nsvc_reset
had no return value then. Since a compatible return value has been
added by 'Let gprs_nsvc_reset return a value', the former patch is
partly reverted by this commit.

The printf is now an OSMO_ASSERT. The commit message was taken
from Jacob.

Sponsored-by: On-Waves ehf
gprs-ns/test: Check the nsvc state explicitely

This patch extends test_sgsn_reset_invalid_state by assertions to check
that nscv->state and nsvc->remote_state have been set as expected.

Sponsored-by: On-Waves ehf
bssgp: Free msgb in case of error when calling into gprs_ns_sendmsg

In the OsmoSGSN we have a crash with a DEAD/BLOCKED GPRS-NS and
segmented SN-UNITDATA. For the caller it is not easy to know if
the passed msg buffer has been freed or not. The most easy solution
is to always take the ownership and either pass it on or free it
in case of an error.

Adjust indirect and direct callers of gprs_ns_sendmsg. I found
the following call-chains with an external msgb parameter.

gprs_ns_sendmsg
  <- _bssgp_tx_dl_ud
     <- bssgp_fc_in
        <- bssgp_tx_dl_ud

Update the test to allocate a real msgb because for the test with
'1000' we will msgb_free it right away.

Sponsored-by: On-Waves ehf
Move common socket routine into separate function

Signed-off-by: Max <max.suraev@fairwaves.co>
gprs: Don't discard SUSPEND/RESUME in bssgp_rcvmsg (TODO)

Currently sending SUSPEND/RESUME messages to this function (like it
is done in the osmo-sgsn) results in STATUS messages complaining
about an unknown BVCI. The reason is, that these messages rely on a
TLLI/RAI pair to identify the context and do not contain an explicit
BVCI.

This patch modifies bssgp_rcvmsg() to only complain about and unknown
BVCI if one is given but a matching context is not found (except for
RESET messages). The ctx argument is removed from the functions
handling SUSPEND and RESUME since it will always be NULL then.

TODO:
  - test cases
  - end-to-end test

Sponsored-by: On-Waves ehf