sgsn: Add global require_update_location flag

This flag is used to determine, whether the Update Location procedure
shall be invoked. This is currently only set, when the 'remote'
authorization policy is set. When the flag is set, sgsn_auth_update
will not never be called directly by sgsn_auth_request, if an Attach
Request procedure is pending, even if the remote connection fails for
some reason.

Sponsored-by: On-Waves ehf
sgsn: Log requested state change in sgsn_auth_update

Sponsored-by: On-Waves ehf
sgsn/test: Add wrapper for gprs_subscr_rx_gsup_message

Currently, several lines of boiler plate are needed around a call to
gprs_subscr_rx_gsup_message.

This patch puts all of this (including the call to
gprs_subscr_rx_gsup_message) into a separate function.

Sponsored-by: On-Waves ehf
sgsn/test: Add GMM test for a GSUP based attach procedure

This test calls test_gmm_attach() where the mocked subscriber
functions insert GSUP messages instead of manipulating the
subscriber structure directly.

Sponsored-by: On-Waves ehf
sgsn/test: Extend tests to simulate lost GSUP requests

This patch extends test_gmm_attach to optionally resend Attach
Requests until the SGSN responds to it instead of calling
OSMO_ASSERT at a few places. The test_gmm_attach_subscr_gsup_auth
test optionally uses this feature. It is called once in either mode.

Sponsored-by: On-Waves ehf
gprs: Stop the GSUP client connect timer

Currently the connection timer is not stopped before reconnect before
calling talloc_free on the gsupc object.

This patch adds calls to osmo_timer_del() to gsup_client_connect and
gprs_gsup_client_destroy. The latter is now called instead of
talloc_free in gprs_gsup_client_create on error to be on the safe
side.

Sponsored-by: On-Waves ehf
sgsn: Avoid sending stale GSUP requests after reconnect

Currently, messages are added to the tx queue even if the connection
is down for some reason and all of these messages are eventually sent
after a re-connect.  The MS has probably sent several Attach Requests
while the connection was down and will continue doing so. Therefore
these stored messages could be dropped.

This patch clears the queue before re-connecting and also extends
gprs_gsup_client_send to return immediately, when the connection is
not established instead of calling ipa_client_conn_send.

Sponsored-by: On-Waves ehf
sgsn: Handle return code of ipa_client_conn_open correctly

The ipa_client_conn_open function does not distinguish between a
connection being already established or waiting for establishment.
In either case, the application gets informed about the connection
state via the updown_cb. The 'up' parameter is only set, if
poll/select consider the socket as writable.

This patch handles both cases equally and fully relies on the
updown_cb to adjust the gsupc obejct state.

Sponsored-by: On-Waves ehf
sgsn: Add logging to connect_timer_cb (TODO)

TODO:
  - LOGLevel ?

Sponsored-by: On-Waves ehf
sgsn: Handle incoming IPA CCM message in gsup_client_read_cb (TODO)

This patch adds a call to ipaccess_bts_handle_ccm and continues
depending on the return code.

TODO:
  - commit message (what changes this?)

Sponsored-by: On-Waves ehf
sgsn: Send PING and eventually reconnect (TODO)

Ticket: OW#????
Sponsored-by: On-Waves ehf
sgsn: Show GSUP client info on 'show sgsn' (TODO)

Ticket: OW#????
Sponsored-by: On-Waves ehf