osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/36069?usp=email )


Change subject: gsna2in46a: move and rename from in46a_from_gsna
......................................................................

gsna2in46a: move and rename from in46a_from_gsna

Prepare to move in46a functions to libosmocore. I added this function
recently, and it probably isn't useful outside of osmo-ggsn, so rename
and move it to be more consistent with similar functions in gtp.c.

Change-Id: I54c8a4b1d3a02b71d5983badcd923fa39ce7dd84
---
M ggsn/ggsn_vty.c
M gtp/gtp.c
M gtp/gtp_internal.h
M lib/gtp-kernel.c
M lib/in46_addr.c
M lib/in46_addr.h
6 files changed, 24 insertions(+), 11 deletions(-)



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

diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index f70daf1..01d7322 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -815,7 +815,7 @@
 {
        struct in46_addr in46;

-       in46a_from_gsna(in, &in46);
+       gsna2in46a(in, &in46);
        return in46a_ntoa(&in46);
 }

diff --git a/gtp/gtp.c b/gtp/gtp.c
index f426e6d..68d8003 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -3108,6 +3108,14 @@
        return 0;
 }

+void gsna2in46a(const struct ul16_t *gsna, struct in46_addr *dst)
+{
+       dst->len = gsna->l;
+       OSMO_ASSERT(gsna->l <= sizeof(dst->v6));
+       memcpy(&dst->v6, gsna->v, gsna->l);
+}
+
+
 /* TS 29.060 has yet again a different encoding for IMSIs than
  * what we have in other places, so we cannot use the gsm48
  * decoding functions.  Also, libgtp uses an uint64_t in
diff --git a/gtp/gtp_internal.h b/gtp/gtp_internal.h
index 826ea59..7ee47cc 100644
--- a/gtp/gtp_internal.h
+++ b/gtp/gtp_internal.h
@@ -49,4 +49,5 @@
 int ipv42eua(struct ul66_t *eua, struct in_addr *src);
 int eua2ipv4(struct in_addr *dst, struct ul66_t *eua);
 int in_addr2gsna(struct ul16_t *gsna, struct in_addr *src);
+void gsna2in46a(const struct ul16_t *gsna, struct in46_addr *dst);
 uint64_t gtp_imsi_str2gtp(const char *str);
diff --git a/lib/gtp-kernel.c b/lib/gtp-kernel.c
index 9f2ad65..f89097c 100644
--- a/lib/gtp-kernel.c
+++ b/lib/gtp-kernel.c
@@ -113,7 +113,7 @@

        pdp_debug(__func__, devname, pdp);

-       in46a_from_gsna(&pdp->gsnrc, &sgsn);
+       gsna2in46a(&pdp->gsnrc, &sgsn);

        ms_addr_count = in46a_from_eua(&pdp->eua, ms);

diff --git a/lib/in46_addr.c b/lib/in46_addr.c
index c5157be..f5cdf41 100644
--- a/lib/in46_addr.c
+++ b/lib/in46_addr.c
@@ -375,10 +375,3 @@
        dst->v4.s_addr = 0;
        return 1;
 }
-
-void in46a_from_gsna(const struct ul16_t *in, struct in46_addr *dst)
-{
-       dst->len = in->l;
-       OSMO_ASSERT(in->l <= sizeof(dst->v6));
-       memcpy(&dst->v6, in->v, in->l);
-}
diff --git a/lib/in46_addr.h b/lib/in46_addr.h
index 89e1e22..c3c9e9c 100644
--- a/lib/in46_addr.h
+++ b/lib/in46_addr.h
@@ -39,5 +39,3 @@
 static inline bool in46a_is_v4(const struct in46_addr *addr) {
        return addr->len == sizeof(struct in_addr);
 }
-
-void in46a_from_gsna(const struct ul16_t *in, struct in46_addr *dst);

--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/36069?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I54c8a4b1d3a02b71d5983badcd923fa39ce7dd84
Gerrit-Change-Number: 36069
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>
Gerrit-MessageType: newchange

Reply via email to