[PATCH] openggsn[master]: libgtp: Remove ctrl_handle from gsn_t, replace with private ...

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
Tue Sep 5 21:14:52 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3844

to look at the new patch set (#4).

libgtp: Remove ctrl_handle from gsn_t, replace with private context

The control interface handle never belonged into libgtp in the first
place.  Commit 727417dd28813c697b4820aef9f54f249e30c4b8 should not
have added this to the shared library (used by sgsnemu, osmo-sgsn, ...),
but to some private state of the GGSN.

Introducing a private context pointer at the same location will keep
ABI compatibilty.

Change-Id: I4f17516dae3e04114564828a3e5f6e2ea54212a5
---
M ggsn/ggsn.c
M gtp/gtp.h
2 files changed, 4 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/44/3844/4

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 7614b92..d865707 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -148,7 +148,7 @@
 
 	snprintf(val, sizeof(val), "%s,%s", imsi_gtp2str(&pdp->imsi), addrstr);
 
-	if (ctrl_cmd_send_trap(gsn->ctrl, var, val) < 0) {
+	if (ctrl_cmd_send_trap(gsn->priv, var, val) < 0) {
 		LOGP(DGGSN, LOGL_ERROR, "Failed to create and send TRAP for IMSI %" PRIu64 " [%s].\n", pdp->imsi, var);
 		return false;
 	}
@@ -722,8 +722,8 @@
 	gtp_set_cb_delete_context(gsn, delete_context);
 	gtp_set_cb_create_context_ind(gsn, create_context_ind);
 
-	gsn->ctrl = ctrl_interface_setup(NULL, OSMO_CTRL_PORT_GGSN, NULL);
-	if (!gsn->ctrl) {
+	gsn->priv = ctrl_interface_setup(NULL, OSMO_CTRL_PORT_GGSN, NULL);
+	if (!gsn->priv) {
 		LOGP(DGGSN, LOGL_ERROR, "Failed to create CTRL interface.\n");
 		exit(1);
 	}
diff --git a/gtp/gtp.h b/gtp/gtp.h
index 8f13ed2..7fa9ae7 100644
--- a/gtp/gtp.h
+++ b/gtp/gtp.h
@@ -12,8 +12,6 @@
 #ifndef _GTP_H
 #define _GTP_H
 
-#include <osmocom/ctrl/control_if.h>
-
 #define GTP_MODE_GGSN 1
 #define GTP_MODE_SGSN 2
 
@@ -247,7 +245,7 @@
 
 	unsigned char restart_counter;	/* Increment on restart. Stored on disk */
 	char *statedir;		/* Disk location for permanent storage */
-	struct ctrl_handle *ctrl;	/* Control Interface */
+	void *priv;		/* used by libgtp users to attach their own state) */
 	struct queue_t *queue_req;	/* Request queue */
 	struct queue_t *queue_resp;	/* Response queue */
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I4f17516dae3e04114564828a3e5f6e2ea54212a5
Gerrit-PatchSet: 4
Gerrit-Project: openggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list