nitb: Set the DST field in generated MM info messages

Currently the NET_DST information element (see GSM 24.008) is not
included in generated MM info messages even when the DST field in the
timezone info has been set via the VTY or the control interface.

This patch modifies gsm48_tx_mm_info() to append this information
element if (and only if) a non-zero DST has been configured. The
DST IE is not part of GSM 4.8. Therefore it will only be sent, if the
DST offset is configured to a value != 0.

The DST functionality has been verified with wireshark by Jacob.

Sponsored-by: On-Waves ehf
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 997e996..9063f98 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -659,6 +659,7 @@
 	struct tm* gmt_time;
 	struct tm* local_time;
 	int tzunits;
+	int dst = 0;
 
 	msg->lchan = conn->lchan;
 
@@ -752,6 +753,9 @@
 			tzunits = tzunits + (bts->tz.mn/15);
 			ptr8[7] = bcdify(tzunits);
 		}
+		/* Convert DST value */
+		if (bts->tz.dst >= 0 && bts->tz.dst <= 2)
+			dst = bts->tz.dst;
 	}
 	else {
 		/* Need to get GSM offset and convert into 15 min units */
@@ -771,6 +775,17 @@
 		}
 		else
 			ptr8[7] = bcdify(tzunits);
+
+		/* Does not support DST +2 */
+		if (local_time->tm_isdst)
+			dst = 1;
+	}
+
+	if (dst) {
+		ptr8 = msgb_put(msg, 3);
+		ptr8[0] = GSM48_IE_NET_DST;
+		ptr8[1] = 1;
+		ptr8[2] = dst;
 	}
 
 	DEBUGP(DMM, "-> MM INFO\n");