Change in osmo-ggsn[master]: ggsn: Improve logging on incoming DL data packets

pespin gerrit-no-reply at lists.osmocom.org
Wed Apr 28 10:45:35 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/23861 )

Change subject: ggsn: Improve logging on incoming DL data packets
......................................................................

ggsn: Improve logging on incoming DL data packets

Change-Id: I3617c8f68d8f18617871c070e28cc6ae5c6a925b
---
M ggsn/ggsn.c
1 file changed, 33 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  lynxis lazus: Looks good to me, approved



diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index bde7f4b..0cde543 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -593,7 +593,7 @@
 	struct iphdr *iph = (struct iphdr *)pack;
 	struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
 	struct ippool_t *pool;
-	char straddr[INET6_ADDRSTRLEN];
+	char straddr[2][INET6_ADDRSTRLEN];
 	uint8_t pref_offset;
 
 	switch (iph->version) {
@@ -626,17 +626,41 @@
 		return 0;
 
 	if (ippool_getip(pool, &ipm, &dst)) {
-		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)));
+		LOGTUN(LOGL_DEBUG, tun, "APN(%s) Rx DL data packet for IP address outside "
+		       "pool of managed addresses: %s <- %s\n",
+		       apn->cfg.name,
+		       iph->version == 4 ?
+		         inet_ntop(AF_INET, &iph->daddr, straddr[0], sizeof(straddr[0])) :
+		         inet_ntop(AF_INET6, &ip6h->ip6_dst, straddr[0], sizeof(straddr[0])),
+		       iph->version == 4 ?
+		         inet_ntop(AF_INET, &iph->saddr, straddr[1], sizeof(straddr[1])) :
+		         inet_ntop(AF_INET6, &ip6h->ip6_src, straddr[1], sizeof(straddr[1])));
 		return 0;
 	}
-	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);
+	if (ipm->peer)	{	/* Check if a peer protocol is defined */
+		struct pdp_t *pdp = (struct pdp_t *)ipm->peer;
+		LOGTUN(LOGL_DEBUG, tun, "APN(%s) Rx DL data packet for PDP(%s:%u): %s <- %s\n",
+		       apn->cfg.name,
+		       imsi_gtp2str(&(pdp)->imsi), (pdp)->nsapi,
+		       iph->version == 4 ?
+		         inet_ntop(AF_INET, &iph->daddr, straddr[0], sizeof(straddr[0])) :
+		         inet_ntop(AF_INET6, &ip6h->ip6_dst, straddr[0], sizeof(straddr[0])),
+		       iph->version == 4 ?
+		         inet_ntop(AF_INET, &iph->saddr, straddr[1], sizeof(straddr[1])) :
+		         inet_ntop(AF_INET6, &ip6h->ip6_src, straddr[1], sizeof(straddr[1])));
+		gtp_data_req(apn->ggsn->gsn, pdp, pack, len);
+	} else {
+		LOGTUN(LOGL_DEBUG, tun, "APN(%s) Rx DL data packet for IP address with no "
+		       "associated PDP Ctx: %s <- %s\n",
+		       apn->cfg.name,
+		       iph->version == 4 ?
+ 		         inet_ntop(AF_INET, &iph->daddr, straddr[0], sizeof(straddr[0])) :
+ 		         inet_ntop(AF_INET6, &ip6h->ip6_dst, straddr[0], sizeof(straddr[0])),
+ 		       iph->version == 4 ?
+ 		         inet_ntop(AF_INET, &iph->saddr, straddr[1], sizeof(straddr[1])) :
+ 		         inet_ntop(AF_INET6, &ip6h->ip6_src, straddr[1], sizeof(straddr[1])));
+	}
 	return 0;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/23861
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I3617c8f68d8f18617871c070e28cc6ae5c6a925b
Gerrit-Change-Number: 23861
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210428/6df0589f/attachment.htm>


More information about the gerrit-log mailing list