[PATCH] openggsn[master]: IPv6: in46_addr: OSMO_ASSERT() in case of unsupported calls

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
Wed Aug 9 20:38:30 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3460

to look at the new patch set (#2).

IPv6: in46_addr: OSMO_ASSERT() in case of unsupported calls

There's a bit of trickery with the ip_pool and it's "lengty=8" IPv6
prefix handling, let's make sure we don't accidentially call any
support functions with addresses of wrong length.

Change-Id: I444c190bdcd18780344e1f0dad4faf3bcf9da5a5
---
M lib/in46_addr.c
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/60/3460/2

diff --git a/lib/in46_addr.c b/lib/in46_addr.c
index 1785377..8f5cc09 100644
--- a/lib/in46_addr.c
+++ b/lib/in46_addr.c
@@ -11,6 +11,8 @@
 
 #include "../lib/in46_addr.h"
 
+#include <osmocom/core/utils.h>
+
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
@@ -29,6 +31,7 @@
 	case 16:
 		return AF_INET6;
 	default:
+		OSMO_ASSERT(0);
 		return -1;
 	}
 }
@@ -49,6 +52,7 @@
 		sin6->sin6_addr = in->v6;
 		break;
 	default:
+		OSMO_ASSERT(0);
 		return -1;
 	}
 
@@ -161,6 +165,7 @@
 		create_ipv6_netmask(&netmask6, prefixlen);
 		return ipv6_within_mask(&addr->v6, &net->v6, &netmask6);
 	default:
+		OSMO_ASSERT(0);
 		return 0;
 	}
 }
@@ -184,6 +189,7 @@
 		memcpy(&eua->v[2], &src->v6, 16);	/* Copy a 16 byte address */
 		break;
 	default:
+		OSMO_ASSERT(0);
 		return -1;
 	}
 	return 0;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I444c190bdcd18780344e1f0dad4faf3bcf9da5a5
Gerrit-PatchSet: 2
Gerrit-Project: openggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list