mtp: Make it possible to block a link.

The semantic of a block is to take the physical
link down, call mtp_link_down and to make sure
that the link remains down and no packets are
forwarded there. The unblock call will reset the
link and this should get it back into operation
again.
diff --git a/src/link_udp.c b/src/link_udp.c
index 1e24faf..2dfc34b 100644
--- a/src/link_udp.c
+++ b/src/link_udp.c
@@ -107,6 +107,11 @@
 		goto exit;
 	}
 
+	if (link->blocked) {
+		LOGP(DINP, LOGL_ERROR, "The link is blocked.\n");
+		rc = 0;
+		goto exit;
+	}
 
 	/* throw away data as the link is down */
 	if (link->set->available == 0) {
@@ -167,6 +172,11 @@
 	return 0;
 }
 
+static int udp_link_shutdown(struct mtp_link *link)
+{
+	return udp_link_reset(link);
+}
+
 static int udp_link_write(struct mtp_link *link, struct msgb *msg)
 {
 	struct mtp_udp_link *ulnk;
@@ -202,7 +212,7 @@
 int link_udp_init(struct mtp_udp_link *link, const char *remote, int port)
 {
 	/* function table */
-	link->base.shutdown = udp_link_dummy;
+	link->base.shutdown = udp_link_shutdown;
 	link->base.clear_queue = udp_link_dummy;
 
 	link->base.reset = udp_link_reset;
@@ -296,7 +306,7 @@
 
 	link = &ulink->base;
 
-	if (res == SNMP_STATUS_TIMEOUT) {
+	if (res == SNMP_STATUS_TIMEOUT && !link->blocked) {
 		LOGP(DINP, LOGL_ERROR, "Failed to restart link: %d\n", link_id);
 		udp_link_reset(link);
 		return;
@@ -313,11 +323,13 @@
 		 * restart the link in 90 seconds...
 		 * to force a timeout on the BSC
 		 */
-		link->link_activate.cb = do_start;
-		link->link_activate.data = link;
-		bsc_schedule_timer(&link->link_activate, ulink->reset_timeout, 0);
-		LOGP(DINP, LOGL_NOTICE,
-		     "Will restart SLTM transmission in %d seconds.\n", ulink->reset_timeout);
+		if (!link->blocked) {
+			link->link_activate.cb = do_start;
+			link->link_activate.data = link;
+			bsc_schedule_timer(&link->link_activate, ulink->reset_timeout, 0);
+			LOGP(DINP, LOGL_NOTICE,
+			     "Will restart SLTM transmission in %d seconds.\n", ulink->reset_timeout);
+		}
 		break;
 	default:
 		LOGP(DINP, LOGL_ERROR, "Unknown event %d\n", area);