aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-08-28 16:52:56 +0200
committerlaforge <laforge@gnumonks.org>2019-09-02 09:02:38 +0000
commit6ec5dc26b394e060287da260f9a6a655278a23f8 (patch)
treec8fedae60d829b00b50b2980452d82bae8ca05d3
parent4ec21769b2e0779894895ef3942d3a5237b9f1a7 (diff)
Introduce log helper LOGGGSN and log category DGTP
It will be used in forthcoming commits. Change-Id: I30f46f44af1d0eee324b1a995c1dad2e1315af7c
-rw-r--r--include/osmocom/sgsn/debug.h1
-rw-r--r--include/osmocom/sgsn/gprs_sgsn.h6
-rw-r--r--src/gprs/sgsn_main.c7
3 files changed, 13 insertions, 1 deletions
diff --git a/include/osmocom/sgsn/debug.h b/include/osmocom/sgsn/debug.h
index 4d0fc6987..29d500da7 100644
--- a/include/osmocom/sgsn/debug.h
+++ b/include/osmocom/sgsn/debug.h
@@ -39,6 +39,7 @@ enum {
DVLR,
DIUCS,
DSIGTRAN,
+ DGTP,
Debug_LastEntry,
};
diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h
index 48c063d07..17cafa3d1 100644
--- a/include/osmocom/sgsn/gprs_sgsn.h
+++ b/include/osmocom/sgsn/gprs_sgsn.h
@@ -3,6 +3,7 @@
#include <stdint.h>
#include <netinet/in.h>
+#include <inttypes.h>
#include <osmocom/core/fsm.h>
#include <osmocom/core/timer.h>
@@ -405,6 +406,11 @@ void sgsn_ggsn_ctx_add_pdp(struct sgsn_ggsn_ctx *ggc, struct sgsn_pdp_ctx *pdp);
void sgsn_ggsn_ctx_remove_pdp(struct sgsn_ggsn_ctx *ggc, struct sgsn_pdp_ctx *pdp);
void sgsn_ggsn_ctx_check_echo_timer(struct sgsn_ggsn_ctx *ggc);
+#define LOGGGSN(ggc, level, fmt, args...) { \
+ char _buf[INET_ADDRSTRLEN]; \
+ LOGP(DGTP, level, "GGSN(%" PRIu32 ":%s): " fmt, (ggc)->id, inet_ntop(AF_INET, &(ggc)->remote_addr, _buf, sizeof(_buf)), ## args); \
+ } while (0)
+
struct apn_ctx {
struct llist_head list;
struct sgsn_ggsn_ctx *ggsn;
diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index 4232e2384..9f2e11179 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -340,7 +340,12 @@ static struct log_info_cat gprs_categories[] = {
.name = "DV42BIS",
.description = "V.42bis data compression (SNDCP)",
.enabled = 1, .loglevel = LOGL_NOTICE,
- }
+ },
+ [DGTP] = {
+ .name = "DGTP",
+ .description = "GPRS Tunnelling Protocol (GTP)",
+ .enabled = 1, .loglevel = LOGL_NOTICE,
+ },
};
static const struct log_info gprs_log_info = {