expiration: Allow to disable the periodic location updating procedure

Disable the periodic LU using "no periodic location update" VTY
command. In that case set the expire_lu to 0 which will then be
translated to a NULL in the database layer. This leads to a bit of
copy and paste in the db_sync_subscriber method but I don't see
how we could easily use 'datetime(%i, 'unixepoch')' and 'NULL'
at the same time.

Change the query to find expired queries to check for NOT NULL
and the time being in the past. This means if there are still
old subscribers in the database they might not be expired. One
would need to execute a query like "UPATE Subscriber SET expire_lu
= 0 WHERE expire_lu is null". The same applies when disabling the
periodic LU. One would need to update the database by hand.

Manual tests executed/passed:

1.) periodic LU enabled:

  * use gst LUTest.st to do a LU
  * UPDATE Subscriber SET expire_lu=datetime('now');
  * observe the subscriber being expired (it was)

2.) periodic LU disabled:

  * use gst LUTest.st to do a LU
  * verify that the expire_lu is NULL in the database
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index b2b7977..45df90f 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -506,8 +506,13 @@
 				(sp->penalty_time*20)+20, VTY_NEWLINE);
 	}
 
-	vty_out(vty, "  periodic location update %u%s",
-		bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
+	/* Is periodic LU enabled or disabled? */
+	if (bts->si_common.chan_desc.t3212 == 0)
+		vty_out(vty, "  no periodic location update%s", VTY_NEWLINE);
+	else
+		vty_out(vty, "  periodic location update %u%s",
+			bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
+
 	vty_out(vty, "  channel allocator %s%s",
 		bts->chan_alloc_reverse ? "descending" : "ascending",
 		VTY_NEWLINE);
@@ -2036,6 +2041,19 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_bts_no_per_loc_upd, cfg_bts_no_per_loc_upd_cmd,
+      "no periodic location update",
+      NO_STR
+      "Periodic Location Updating Interval\n"
+      "Periodic Location Updating Interval\n"
+      "Periodic Location Updating Interval\n")
+{
+	struct gsm_bts *bts = vty->index;
+
+	bts->si_common.chan_desc.t3212 = 0;
+	return CMD_SUCCESS;
+}
+
 #define GPRS_TEXT	"GPRS Packet Network\n"
 
 DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
@@ -3053,6 +3071,7 @@
 	install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
 	install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
 	install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
+	install_element(BTS_NODE, &cfg_bts_no_per_loc_upd_cmd);
 	install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
 	install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
 	install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);