aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-10-09 12:16:17 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-09 18:16:22 +0200
commit1c407aa99398db56cc88e87c887528d11b5cb936 (patch)
tree1483367373f0e649c607e7c83565f3960904a0d7 /openbsc
parent9b07135b92dce6c6b78a9ff0f0a1c6d2df64f9d6 (diff)
gbproxy: Pass the log level as argument to gprs_gb_log_parse_context
Currently, the log level is always LOGL_DEBUG. In case of errors it would be helpful to use a higher log level. This patch adds a log_level parameter to gprs_gb_log_parse_context to let the caller decide about the level. Ticket: OW#1307 Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/gprs_gb_parse.h3
-rw-r--r--openbsc/src/gprs/gb_proxy.c4
-rw-r--r--openbsc/src/gprs/gprs_gb_parse.c27
3 files changed, 18 insertions, 16 deletions
diff --git a/openbsc/include/openbsc/gprs_gb_parse.h b/openbsc/include/openbsc/gprs_gb_parse.h
index 090672b74..4dc5f6ff1 100644
--- a/openbsc/include/openbsc/gprs_gb_parse.h
+++ b/openbsc/include/openbsc/gprs_gb_parse.h
@@ -54,5 +54,6 @@ int gprs_gb_parse_bssgp(uint8_t *bssgp, size_t bssgp_len,
const char *gprs_gb_message_name(const struct gprs_gb_parse_context *parse_ctx,
const char *default_msg_name);
-void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
+void gprs_gb_log_parse_context(int log_level,
+ struct gprs_gb_parse_context *parse_ctx,
const char *default_msg_name);
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index 1437646fa..59771fa82 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -566,7 +566,7 @@ static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg,
gbprox_update_current_raid(parse_ctx.bssgp_raid_enc, peer,
parse_ctx.llc_msg_name);
- gprs_gb_log_parse_context(&parse_ctx, "BSSGP");
+ gprs_gb_log_parse_context(LOGL_DEBUG, &parse_ctx, "NS_UNITDATA");
link_info = gbproxy_update_link_state_ul(peer, now, &parse_ctx);
@@ -668,7 +668,7 @@ static void gbprox_process_bssgp_dl(struct gbproxy_config *cfg,
}
}
- gprs_gb_log_parse_context(&parse_ctx, "BSSGP");
+ gprs_gb_log_parse_context(LOGL_DEBUG, &parse_ctx, "NS_UNITDATA");
link_info = gbproxy_update_link_state_dl(peer, now, &parse_ctx);
diff --git a/openbsc/src/gprs/gprs_gb_parse.c b/openbsc/src/gprs/gprs_gb_parse.c
index 17d4b9c19..8e72cc819 100644
--- a/openbsc/src/gprs/gprs_gb_parse.c
+++ b/openbsc/src/gprs/gprs_gb_parse.c
@@ -623,7 +623,8 @@ int gprs_gb_parse_bssgp(uint8_t *bssgp, size_t bssgp_len,
return 1;
}
-void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
+void gprs_gb_log_parse_context(int log_level,
+ struct gprs_gb_parse_context *parse_ctx,
const char *default_msg_name)
{
const char *msg_name;
@@ -640,15 +641,15 @@ void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
if (parse_ctx->llc_msg_name)
msg_name = parse_ctx->llc_msg_name;
- LOGP(DGPRS, LOGL_DEBUG, "%s: Got", msg_name);
+ LOGP(DGPRS, log_level, "%s: Got", msg_name);
if (parse_ctx->tlli_enc) {
- LOGPC(DGPRS, LOGL_DEBUG, "%s TLLI %08x", sep, parse_ctx->tlli);
+ LOGPC(DGPRS, log_level, "%s TLLI %08x", sep, parse_ctx->tlli);
sep = ",";
}
if (parse_ctx->old_tlli_enc) {
- LOGPC(DGPRS, LOGL_DEBUG, "%s old TLLI %02x%02x%02x%02x", sep,
+ LOGPC(DGPRS, log_level, "%s old TLLI %02x%02x%02x%02x", sep,
parse_ctx->old_tlli_enc[0],
parse_ctx->old_tlli_enc[1],
parse_ctx->old_tlli_enc[2],
@@ -659,7 +660,7 @@ void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
if (parse_ctx->bssgp_raid_enc) {
struct gprs_ra_id raid;
gsm48_parse_ra(&raid, parse_ctx->bssgp_raid_enc);
- LOGPC(DGPRS, LOGL_DEBUG, "%s BSSGP RAID %u-%u-%u-%u", sep,
+ LOGPC(DGPRS, log_level, "%s BSSGP RAID %u-%u-%u-%u", sep,
raid.mcc, raid.mnc, raid.lac, raid.rac);
sep = ",";
}
@@ -667,7 +668,7 @@ void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
if (parse_ctx->raid_enc) {
struct gprs_ra_id raid;
gsm48_parse_ra(&raid, parse_ctx->raid_enc);
- LOGPC(DGPRS, LOGL_DEBUG, "%s RAID %u-%u-%u-%u", sep,
+ LOGPC(DGPRS, log_level, "%s RAID %u-%u-%u-%u", sep,
raid.mcc, raid.mnc, raid.lac, raid.rac);
sep = ",";
}
@@ -675,7 +676,7 @@ void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
if (parse_ctx->old_raid_enc) {
struct gprs_ra_id raid;
gsm48_parse_ra(&raid, parse_ctx->old_raid_enc);
- LOGPC(DGPRS, LOGL_DEBUG, "%s old RAID %u-%u-%u-%u", sep,
+ LOGPC(DGPRS, log_level, "%s old RAID %u-%u-%u-%u", sep,
raid.mcc, raid.mnc, raid.lac, raid.rac);
sep = ",";
}
@@ -683,14 +684,14 @@ void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
if (parse_ctx->ptmsi_enc) {
uint32_t ptmsi = GSM_RESERVED_TMSI;
gprs_parse_tmsi(parse_ctx->ptmsi_enc, &ptmsi);
- LOGPC(DGPRS, LOGL_DEBUG, "%s PTMSI %08x", sep, ptmsi);
+ LOGPC(DGPRS, log_level, "%s PTMSI %08x", sep, ptmsi);
sep = ",";
}
if (parse_ctx->new_ptmsi_enc) {
uint32_t new_ptmsi = GSM_RESERVED_TMSI;
gprs_parse_tmsi(parse_ctx->new_ptmsi_enc, &new_ptmsi);
- LOGPC(DGPRS, LOGL_DEBUG, "%s new PTMSI %08x", sep, new_ptmsi);
+ LOGPC(DGPRS, log_level, "%s new PTMSI %08x", sep, new_ptmsi);
sep = ",";
}
@@ -699,20 +700,20 @@ void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
mi_buf[0] = '\0';
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
parse_ctx->imsi, parse_ctx->imsi_len);
- LOGPC(DGPRS, LOGL_DEBUG, "%s IMSI %s",
+ LOGPC(DGPRS, log_level, "%s IMSI %s",
sep, mi_buf);
sep = ",";
}
if (parse_ctx->invalidate_tlli) {
- LOGPC(DGPRS, LOGL_DEBUG, "%s invalidate", sep);
+ LOGPC(DGPRS, log_level, "%s invalidate", sep);
sep = ",";
}
if (parse_ctx->await_reattach) {
- LOGPC(DGPRS, LOGL_DEBUG, "%s re-attach", sep);
+ LOGPC(DGPRS, log_level, "%s re-attach", sep);
sep = ",";
}
- LOGPC(DGPRS, LOGL_DEBUG, "\n");
+ LOGPC(DGPRS, log_level, "\n");
}
const char *gprs_gb_message_name(const struct gprs_gb_parse_context *parse_ctx,