diff options
-rw-r--r-- | openbsc/src/gprs/gtphub_ares.c | 22 | ||||
-rw-r--r-- | openbsc/src/gprs/gtphub_main.c | 34 |
2 files changed, 30 insertions, 26 deletions
diff --git a/openbsc/src/gprs/gtphub_ares.c b/openbsc/src/gprs/gtphub_ares.c index 4cacf88fd..852255639 100644 --- a/openbsc/src/gprs/gtphub_ares.c +++ b/openbsc/src/gprs/gtphub_ares.c @@ -163,7 +163,7 @@ struct gtphub_peer_port *gtphub_resolve_ggsn_addr(struct gtphub *hub, struct ggsn_lookup); OSMO_ASSERT(lookup); - LOGP(DGTPHUB, LOGL_NOTICE, "Request to resolve IMSI" + LOGP(DGTPHUB, LOGL_DEBUG, "Request to resolve IMSI" " '%s' with APN-NI '%s' (%p / %p)\n", imsi_str, apn_ni_str, lookup, &lookup->expiry_entry); @@ -178,22 +178,26 @@ struct gtphub_peer_port *gtphub_resolve_ggsn_addr(struct gtphub *hub, make_addr_str(lookup); - LOGP(DGTPHUB, LOGL_NOTICE, "looking for active queries...\n"); struct ggsn_lookup *active; llist_for_each_entry(active, &hub->ggsn_lookups, entry) { if (strncmp(active->apn_oi_str, lookup->apn_oi_str, sizeof(lookup->apn_oi_str)) == 0) { + LOGP(DGTPHUB, LOGL_DEBUG, + "Query already pending for %s\n", + lookup->apn_oi_str); /* A query already pending. Just tip our hat. */ return NULL; } } - LOGP(DGTPHUB, LOGL_NOTICE, "looking for already resolved GGSNs...\n"); struct gtphub_resolved_ggsn *resolved; llist_for_each_entry(resolved, &hub->resolved_ggsns, entry) { if (strncmp(resolved->apn_oi_str, lookup->apn_oi_str, sizeof(lookup->apn_oi_str)) == 0) { - /* Already resolved. */ + LOGP(DGTPHUB, LOGL_DEBUG, + "GGSN resolved from cache: %s -> %s\n", + lookup->apn_oi_str, + gtphub_peer_str(resolved->peer)); return resolved->peer; } } @@ -201,7 +205,11 @@ struct gtphub_peer_port *gtphub_resolve_ggsn_addr(struct gtphub *hub, /* Kick off a resolution, but so far return nothing. The hope is that * the peer will resend the request (a couple of times), and by then * the GGSN will be resolved. */ - LOGP(DGTPHUB, LOGL_NOTICE, "kick off resolution.\n"); + LOGP(DGTPHUB, LOGL_DEBUG, + "Sending out DNS query for %s..." + " (Returning failure, hoping for a retry once resolution" + " has concluded)\n", + lookup->apn_oi_str); llist_add(&lookup->entry, &hub->ggsn_lookups); @@ -209,10 +217,6 @@ struct gtphub_peer_port *gtphub_resolve_ggsn_addr(struct gtphub *hub, expiry_add(&hub->expire_seq_maps, &lookup->expiry_entry, gtphub_now()); start_ares_query(lookup); - LOGP(DGTPHUB, LOGL_NOTICE, "Resolving %s %s ..." - " (Returning failure, hoping for a retry" - "once resolution has concluded)\n", - imsi_str, apn_ni_str); return NULL; } diff --git a/openbsc/src/gprs/gtphub_main.c b/openbsc/src/gprs/gtphub_main.c index e0df0d6d3..e747c77d5 100644 --- a/openbsc/src/gprs/gtphub_main.c +++ b/openbsc/src/gprs/gtphub_main.c @@ -42,12 +42,6 @@ #include "../../bscconfig.h" -#define LOGERR(fmt, args...) \ - LOGP(DGTPHUB, LOGL_ERROR, fmt, ##args) - -#define LOG(fmt, args...) \ - LOGP(DGTPHUB, LOGL_NOTICE, fmt, ##args) - #ifndef OSMO_VTY_PORT_GTPHUB /* should come from libosmocore */ #define OSMO_VTY_PORT_GTPHUB 4253 @@ -67,7 +61,8 @@ static struct log_info_cat gtphub_categories[] = { .name = "DGTPHUB", .description = "GTP Hub", .color = "\033[1;33m", - .enabled = 1, .loglevel = LOGL_NOTICE, + .enabled = 1, + .loglevel = LOGL_NOTICE, }, }; @@ -87,17 +82,21 @@ void log_cfg(struct gtphub_cfg *cfg) { struct gtphub_cfg_addr *a; a = &cfg->to_sgsns[GTPH_PLANE_CTRL].bind; - LOG("to-SGSNs bind, Control: %s port %d\n", - a->addr_str, a->port); + LOGP(DGTPHUB, LOGL_NOTICE, + "to-SGSNs bind, Control: %s port %d\n", + a->addr_str, a->port); a = &cfg->to_sgsns[GTPH_PLANE_USER].bind; - LOG("to-SGSNs bind, User: %s port %d\n", - a->addr_str, a->port); + LOGP(DGTPHUB, LOGL_NOTICE, + "to-SGSNs bind, User: %s port %d\n", + a->addr_str, a->port); a = &cfg->to_ggsns[GTPH_PLANE_CTRL].bind; - LOG("to-GGSNs bind, Control: %s port %d\n", - a->addr_str, a->port); + LOGP(DGTPHUB, LOGL_NOTICE, + "to-GGSNs bind, Control: %s port %d\n", + a->addr_str, a->port); a = &cfg->to_ggsns[GTPH_PLANE_USER].bind; - LOG("to-GGSNs bind, User: %s port %d\n", - a->addr_str, a->port); + LOGP(DGTPHUB, LOGL_NOTICE, + "to-GGSNs bind, User: %s port %d\n", + a->addr_str, a->port); } static void signal_handler(int signal) @@ -254,7 +253,8 @@ int main(int argc, char **argv) rc = gtphub_cfg_read(cfg, ccfg->config_file); if (rc < 0) { - LOGP(DGTPHUB, LOGL_FATAL, "Cannot parse config file '%s'\n", ccfg->config_file); + LOGP(DGTPHUB, LOGL_FATAL, "Cannot parse config file '%s'\n", + ccfg->config_file); exit(2); } @@ -266,7 +266,7 @@ int main(int argc, char **argv) if (ccfg->daemonize) { rc = osmo_daemonize(); if (rc < 0) { - LOGERR("Error during daemonize"); + LOGP(DGTPHUB, LOGL_FATAL, "Error during daemonize"); exit(1); } } |