[PATCH] osmo-ggsn[master]: gtp.c: gtp_gpdu_ind: Convert ifelse to switch statement

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Jan 25 20:13:01 UTC 2018


Review at  https://gerrit.osmocom.org/6071

gtp.c: gtp_gpdu_ind: Convert ifelse to switch statement

Change-Id: I99b73f7a6d4100789fa92021c6ec9117869c881b
---
M gtp/gtp.c
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/71/6071/1

diff --git a/gtp/gtp.c b/gtp/gtp.c
index 53b38de..a2526a3 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -2701,7 +2701,8 @@
 	/* Need to include code to verify packet src and dest addresses */
 	struct pdp_t *pdp;
 
-	if (version == 0) {
+	switch (version) {
+	case 0:
 		if (pdp_getgtp0
 		    (&pdp, ntoh16(((union gtp_packet *)pack)->gtp0.h.flow))) {
 			gsn->err_unknownpdp++;
@@ -2711,7 +2712,8 @@
 						  len);
 		}
 		hlen = GTP0_HEADER_SIZE;
-	} else if (version == 1) {
+		break;
+	case 1:
 		if (pdp_getgtp1
 		    (&pdp, ntoh32(((union gtp_packet *)pack)->gtp1l.h.tei))) {
 			gsn->err_unknownpdp++;
@@ -2726,7 +2728,8 @@
 			hlen = GTP1_HEADER_SIZE_LONG;
 		else
 			hlen = GTP1_HEADER_SIZE_SHORT;
-	} else {
+		break;
+	default:
 		GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
 			    "Unknown version: %d\n", version);
 	}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99b73f7a6d4100789fa92021c6ec9117869c881b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list