[MERGED] osmo-ggsn[master]: ggsn: Add per-APN VTY configuration option on G-PDU sequence...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Sep 24 15:20:23 UTC 2017


Harald Welte has submitted this change and it was merged.

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


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
---
M ggsn/ggsn.c
M ggsn/ggsn.h
M ggsn/ggsn_vty.c
3 files changed, 31 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index d521e57..780a0c2 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -517,6 +517,9 @@
 
 	process_pco(apn, pdp);
 
+	/* Transmit G-PDU sequence numbers (only) if configured in APN */
+	pdp->tx_gpdu_seq = apn->cfg.tx_gpdu_seq;
+
 	LOGPPDP(LOGL_INFO, pdp, "Successful PDP Context Creation: APN=%s(%s), TEIC=%u, IP=%s\n",
 		name_buf, apn->cfg.name, pdp->teic_own, in46a_ntoa(&member->addr));
 	gtp_create_context_resp(gsn, pdp, GTPCAUSE_ACC_REQ);
diff --git a/ggsn/ggsn.h b/ggsn/ggsn.h
index 42f8e1c..c0774c4 100644
--- a/ggsn/ggsn.h
+++ b/ggsn/ggsn.h
@@ -63,6 +63,8 @@
 		enum apn_gtpu_mode gtpu_mode;
 		/* administratively shut-down (true) or not (false) */
 		bool shutdown;
+		/* transmit G-PDU sequeence numbers (true) or not (false) */
+		bool tx_gpdu_seq;
 	} cfg;
 
 	/* corresponding tun device */
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")
@@ -620,6 +639,9 @@
 		vty_out(vty, "  type-support %s%s", get_value_string(pdp_type_names, (1 << i)),
 			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)
@@ -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;
 }

-- 
To view, visit https://gerrit.osmocom.org/4042
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf0de261f83951309b01b4feae998b6656c77664
Gerrit-PatchSet: 4
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list