Change in osmo-hlr[master]: gsup_router.c: gsup_route_find(): support blob

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

osmith gerrit-no-reply at lists.osmocom.org
Tue Feb 26 11:42:49 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/13048


Change subject: gsup_router.c: gsup_route_find(): support blob
......................................................................

gsup_router.c: gsup_route_find(): support blob

Do not require the blob (addr, addr_len) passed to gsup_route_find()
to be nul-terminated. We already have the length, so the nul-termination
is redundant.

This is needed for the upcoming gsup message forwarding patch [1]: we
want to be able to directly pass non-nul-terminated source and
destination name blobs to gsup_route_find().

I have looked into fixing all code that calls gsup_route_find() to never
pass a nul-terminated blob combination. But this is a can of worms,
because it involves both gsup client and server code. Wireshark shows
that clients are sending the nul-terminated string in TLV IEs of IPA
messages. The server assumes that this is the case in various places.
So we would need to fix it in both (server and client), but then we
would lose backwards compatibility with old servers and clients.

[1]: change-id Ia4f345abc877baaf0a8f73b8988e6514d9589bf5

Related: OS#3793
Change-Id: I01a45900e14d41bcd338f50ad85d9fabf2c61405
---
M src/gsup_router.c
1 file changed, 8 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/48/13048/1

diff --git a/src/gsup_router.c b/src/gsup_router.c
index 16ea202..2101fb7 100644
--- a/src/gsup_router.c
+++ b/src/gsup_router.c
@@ -40,8 +40,14 @@
 	struct gsup_route *gr;
 
 	llist_for_each_entry(gr, &gs->routes, list) {
-		if (talloc_total_size(gr->addr) == addrlen &&
-		    !memcmp(gr->addr, addr, addrlen))
+		size_t gr_addrlen = talloc_total_size(gr->addr); /* gr->addr is a nul-terminated string */
+
+		/* FIXME: despite passing addrlen, a lot of code assumes that addr is also nul-terminated */
+		if (gr_addrlen == addrlen && !memcmp(gr->addr, addr, addrlen))
+			return gr->conn;
+
+		/* Compare addr as non-nul-terminated blob */
+		if (gr_addrlen - 1 == addrlen && !memcmp(gr->addr, addr, addrlen))
 			return gr->conn;
 	}
 	return NULL;

-- 
To view, visit https://gerrit.osmocom.org/13048
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01a45900e14d41bcd338f50ad85d9fabf2c61405
Gerrit-Change-Number: 13048
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190226/e1164bf6/attachment.htm>


More information about the gerrit-log mailing list