ggsn: Add per-APN VTY configuration option on G-PDU sequence numbers

This per-APN vty option determines if we are transmitting GTP sequence
numbers in downlink G-PDU messages.  This behavior is optional as per
GTP spec.  The default behavior is "true", like before this change.

Related: OS#2519
Change-Id: Ibf0de261f83951309b01b4feae998b6656c77664
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index c92d83e..9f343ec 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -103,6 +103,7 @@
 	apn->ggsn = ggsn;
 	apn->cfg.name = talloc_strdup(apn, name);
 	apn->cfg.shutdown = true;
+	apn->cfg.tx_gpdu_seq = true;
 	INIT_LLIST_HEAD(&apn->cfg.name_list);
 
 	llist_add_tail(&apn->list, &ggsn->apn_list);
@@ -558,6 +559,24 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_apn_gpdu_seq, cfg_apn_gpdu_seq_cmd,
+	"g-pdu tx-sequence-numbers",
+	"G-PDU Configuration\n" "Enable transmission of G-PDU sequence numbers\n")
+{
+	struct apn_ctx *apn = (struct apn_ctx *) vty->index;
+	apn->cfg.tx_gpdu_seq = true;
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_apn_no_gpdu_seq, cfg_apn_no_gpdu_seq_cmd,
+	"no g-pdu tx-sequence-numbers",
+	NO_STR "G-PDU Configuration\n" "Disable transmission of G-PDU sequence numbers\n")
+{
+	struct apn_ctx *apn = (struct apn_ctx *) vty->index;
+	apn->cfg.tx_gpdu_seq = false;
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_apn_shutdown, cfg_apn_shutdown_cmd,
 	"shutdown",
 	"Put the APN in administrative shut-down\n")
@@ -621,6 +640,9 @@
 			VTY_NEWLINE);
 	}
 
+	if (!apn->cfg.tx_gpdu_seq)
+		vty_out(vty, "  no g-pdu tx-sequence-numbers%s", VTY_NEWLINE);
+
 	/* IPv4 prefixes + DNS */
 	if (apn->v4.cfg.static_prefix.addr.len)
 		vty_dump_prefix(vty, "  ip prefix static", &apn->v4.cfg.static_prefix);
@@ -703,6 +725,8 @@
 
 	in46a_from_eua(&pdp->eua, &eua46);
 	vty_out(vty, " End-User Address: %s%s", in46a_ntoa(&eua46), VTY_NEWLINE);
+	vty_out(vty, " Transmit GTP Sequence Number for G-PDU: %s%s",
+		pdp->tx_gpdu_seq ? "Yes" : "No", VTY_NEWLINE);
 }
 
 DEFUN(show_pdpctx_imsi, show_pdpctx_imsi_cmd,
@@ -870,6 +894,8 @@
 	install_element(APN_NODE, &cfg_apn_no_ip_ifconfig_cmd);
 	install_element(APN_NODE, &cfg_apn_ipv6_ifconfig_cmd);
 	install_element(APN_NODE, &cfg_apn_no_ipv6_ifconfig_cmd);
+	install_element(APN_NODE, &cfg_apn_gpdu_seq_cmd);
+	install_element(APN_NODE, &cfg_apn_no_gpdu_seq_cmd);
 
 	return 0;
 }