aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ggsn/ggsn.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 29d8473..13ee3be 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -573,6 +573,7 @@ static int cb_tun_ind(struct tun_t *tun, void *pack, unsigned len)
struct iphdr *iph = (struct iphdr *)pack;
struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
struct ippool_t *pool;
+ struct pdp_t *pdp;
if (iph->version == 4) {
if (len < sizeof(*iph) || len < 4*iph->ihl)
@@ -597,15 +598,20 @@ static int cb_tun_ind(struct tun_t *tun, void *pack, unsigned len)
if (!pool)
return 0;
- DEBUGP(DTUN, "Received packet from tun!\n");
-
if (ippool_getip(pool, &ipm, &dst)) {
- DEBUGP(DTUN, "Received packet with no PDP contex!!\n");
+ DEBUGP(DTUN, "Received IP packet for addr not used by any PDP contex!!\n");
return 0;
}
- if (ipm->peer) /* Check if a peer protocol is defined */
- gtp_data_req(apn->ggsn->gsn, (struct pdp_t *)ipm->peer, pack, len);
+ pdp = (struct pdp_t *) ipm->peer;
+ if (!pdp) {
+ LOGP(DTUN, LOGL_ERROR, "Received IP packet for pool member without PDP contex?!\n");
+ return 0;
+ }
+
+ LOGPPDP(LOGL_DEBUG, pdp, "Received IP packet tun -> gtp!\n");
+
+ gtp_data_req(apn->ggsn->gsn, (struct pdp_t *)ipm->peer, pack, len);
return 0;
}
@@ -625,7 +631,7 @@ static int encaps_tun(struct pdp_t *pdp, void *pack, unsigned len)
OSMO_ASSERT(tun);
OSMO_ASSERT(apn);
- LOGPPDP(LOGL_DEBUG, pdp, "Packet received: forwarding to tun\n");
+ LOGPPDP(LOGL_DEBUG, pdp, "Received IP packet gtp -> tun\n");
switch (iph->version) {
case 6: