[PATCH] 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 08:54:43 UTC 2017


Review at  https://gerrit.osmocom.org/4042

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, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/42/4042/1

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 46850a6..6ee6628 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -507,6 +507,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 2dd963c..2788da4 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 d7bd9a7..d56f857 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");
 
 	/* IPv4 prefixes + DNS */
 	if (apn->v4.cfg.static_prefix.addr.len)
@@ -870,6 +892,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: newchange
Gerrit-Change-Id: Ibf0de261f83951309b01b4feae998b6656c77664
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list