diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-20 13:43:38 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-28 11:14:57 +0200 |
commit | 012d51ed7d87167af75c7685934274ae41ebe863 (patch) | |
tree | 49f4e5f41618222608bbbfa41e501473e12a64e6 | |
parent | 1ef2621d3f646866c791b454e39ebe9faf2837e1 (diff) |
Introduce LOGTUN log helper
Change-Id: I237acdee0be19498804e0d509c610f4e0454ba72
-rw-r--r-- | ggsn/ggsn.c | 10 | ||||
-rw-r--r-- | ggsn/ggsn.h | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index 4e13151..94f47e3 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -556,7 +556,7 @@ static int cb_tun_ind(struct tun_t *tun, void *pack, unsigned len) pool = apn->v6.pool; break; default: - LOGP(DTUN, LOGL_NOTICE, "non-IPv%u packet received from tun\n", iph->version); + LOGTUN(LOGL_NOTICE, tun, "non-IPv%u packet received\n", iph->version); return -1; } @@ -564,15 +564,15 @@ static int cb_tun_ind(struct tun_t *tun, void *pack, unsigned len) if (!pool) return 0; - DEBUGP(DTUN, "Received packet for APN(%s) from tun %s", apn->cfg.name, tun->devname); - if (ippool_getip(pool, &ipm, &dst)) { - DEBUGPC(DTUN, " with no PDP contex! (%s)\n", iph->version == 4 ? + LOGTUN(LOGL_DEBUG, tun, "Received packet for APN(%s) with no PDP contex! (%s)\n", + apn->cfg.name, + iph->version == 4 ? inet_ntop(AF_INET, &iph->saddr, straddr, sizeof(straddr)) : inet_ntop(AF_INET6, &ip6h->ip6_src, straddr, sizeof(straddr))); return 0; } - DEBUGPC(DTUN, "\n"); + LOGTUN(LOGL_DEBUG, tun, "Received packet for APN(%s)\n", apn->cfg.name); if (ipm->peer) /* Check if a peer protocol is defined */ gtp_data_req(apn->ggsn->gsn, (struct pdp_t *)ipm->peer, pack, len); diff --git a/ggsn/ggsn.h b/ggsn/ggsn.h index 88fd8b9..6155b30 100644 --- a/ggsn/ggsn.h +++ b/ggsn/ggsn.h @@ -153,3 +153,6 @@ extern int apn_stop(struct apn_ctx *apn); LOGP(DGGSN, level, "GGSN(%s): " fmt, (ggsn)->cfg.name, ## args) #define LOGPPDP(level, pdp, fmt, args...) LOGPDPX(DGGSN, level, pdp, fmt, ## args) + +#define LOGTUN(level, tun, fmt, args...) \ + LOGP(DTUN, level, "TUN(%s): " fmt, (tun)->devname, ## args) |