[MERGED] openggsn[master]: gtp.c: Improve debug statements about GTP header flags

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Dec 22 14:09:23 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: gtp.c: Improve debug statements about GTP header flags
......................................................................


gtp.c: Improve debug statements about GTP header flags

* as there are muptiple flags in the field, use plural
* print the flags as hex value, not decimal.  Hex is customary for bitfields.

Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b
---
M gtp/gtp.c
1 file changed, 8 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Holger Freyther: Looks good to me, approved



diff --git a/gtp/gtp.c b/gtp/gtp.c
index dcbe777..42aa4ea 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -210,7 +210,7 @@
 	} else if ((packet->flags & 0xe2) == 0x22) {	/* Version 1 with seq */
 		return ntoh16(packet->gtp1l.h.seq);
 	} else {
-		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags);
+		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags);
 		return 0;
 	}
 }
@@ -246,7 +246,7 @@
 	} else if ((packet->flags & 0xe7) == 0x20) {	/* Short version 1 */
 		return GTP1_HEADER_SIZE_SHORT;
 	} else {
-		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags);
+		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags);
 		return 0;
 	}
 }
@@ -265,7 +265,7 @@
 	} else if ((packet->flags & 0xe0) == 0x20) {	/* Version 1 */
 		return ntoh32(packet->gtp1l.h.tei);
 	} else {
-		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags);
+		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags);
 		return 0xffffffff;
 	}
 }
@@ -388,7 +388,7 @@
 			packet->gtp1l.h.tei = hton32(pdp->teic_gn);
 		fd = gsn->fd1c;
 	} else {
-		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags);
+		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags);
 		return -1;
 	}
 
@@ -537,7 +537,7 @@
 		else if (pdp)
 			packet->gtp1l.h.tei = hton32(pdp->teic_gn);
 	} else {
-		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags);
+		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags);
 		return -1;
 	}
 
@@ -595,7 +595,7 @@
 		packet->gtp1l.h.length = hton16(len - GTP1_HEADER_SIZE_SHORT);
 		packet->gtp1l.h.seq = hton16(seq);
 	} else {
-		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags);
+		LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags);
 		return -1;
 	}
 
@@ -2864,7 +2864,7 @@
 		if (((pheader->flags & 0xf7) != 0x32)) {
 			gsn->unsup++;
 			GTP_LOGPKG(LOGL_ERROR, &peer, buffer,
-				    status, "Unsupported packet flag\n");
+				    status, "Unsupported packet flags: 0x%02x\n", pheader->flags);
 			continue;
 		}
 
@@ -3039,7 +3039,7 @@
 		if (((pheader->flags & 0xf5) != 0x30)) {
 			gsn->unsup++;
 			GTP_LOGPKG(LOGL_ERROR, &peer, buffer,
-				    status, "Unsupported packet flag\n");
+				    status, "Unsupported packet flags 0x%02x\n", pheader->flags);
 			continue;
 		}
 

-- 
To view, visit https://gerrit.osmocom.org/1437
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b
Gerrit-PatchSet: 1
Gerrit-Project: openggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list