[MERGED] osmo-ggsn[master]: ggsn.c: cb_tun_ind: Don't drop packets targeting pdp ctx ll ...

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 Jan 31 14:59:18 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: ggsn.c: cb_tun_ind: Don't drop packets targeting pdp ctx ll addr
......................................................................


ggsn.c: cb_tun_ind: Don't drop packets targeting pdp ctx ll addr

Change-Id: I72602a78baa2a7e3412d8b69c1bf1b3ac0efa434
---
M ggsn/ggsn.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index fed8f73..caf6151 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -726,6 +726,7 @@
 	struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
 	struct ippool_t *pool;
 	char straddr[INET6_ADDRSTRLEN];
+	uint8_t pref_offset;
 
 	switch (iph->version) {
 	case 4:
@@ -739,9 +740,12 @@
 		/* Due to the fact that 3GPP requires an allocation of a
 		 * /64 prefix to each MS, we must instruct
 		 * ippool_getip() below to match only the leading /64
-		 * prefix, i.e. the first 8 bytes of the address */
+		 * prefix, i.e. the first 8 bytes of the address. If the ll addr
+		 * is used, then the match should be done on the trailing 64
+		 * bits. */
 		dst.len = 8;
-		dst.v6 = ip6h->ip6_dst;
+		pref_offset = IN6_IS_ADDR_LINKLOCAL(&ip6h->ip6_dst) ? 8 : 0;
+		memcpy(&dst.v6, ((uint8_t*)&ip6h->ip6_dst) + pref_offset, 8);
 		pool = apn->v6.pool;
 		break;
 	default:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I72602a78baa2a7e3412d8b69c1bf1b3ac0efa434
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list