gb: Fix NS RESET/RESET_ACK abnormal cases

This changes the implementations for the reception of RESET and
RESET_ACK to be compatible with 3GPP TS 08.16, 7.3.1:

- Just send a RESET_ACK with correct values back to the SGSN when a
  RESET with an invalid NSVCI or NSEI has been received.
- Check RESET_ACK for matching NSEI and NSVCI.
- Ignore unexpected RESET_ACKs.

In addition, use RESET_ACK from a BSS to update the BSS source
address based on the NSVCI to be tolerant with changing UDP source
addresses/ports.

Sponsored-by: On-Waves ehf
diff --git a/include/osmocom/gprs/gprs_ns.h b/include/osmocom/gprs/gprs_ns.h
index b28c58d..296800e 100644
--- a/include/osmocom/gprs/gprs_ns.h
+++ b/include/osmocom/gprs/gprs_ns.h
@@ -36,6 +36,7 @@
 
 #define NSE_S_BLOCKED	0x0001
 #define NSE_S_ALIVE	0x0002
+#define NSE_S_RESET	0x0004
 
 /*! \brief Osmocom NS link layer types */
 enum gprs_ns_ll {
@@ -199,12 +200,16 @@
 	S_NS_UNBLOCK,
 	S_NS_ALIVE_EXP,	/* Tns-alive expired more than N times */
 	S_NS_REPLACED, /* nsvc object is replaced (sets old_nsvc) */
+	S_NS_MISMATCH, /* got an unexpected IE (sets msg, pdu_type, ie_type) */
 };
 
 struct ns_signal_data {
 	struct gprs_nsvc *nsvc;
 	struct gprs_nsvc *old_nsvc;
 	uint8_t cause;
+	uint8_t pdu_type;
+	uint8_t ie_type;
+	struct msgb *msg;
 };
 
 void gprs_ns_set_log_ss(int ss);