diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-20 13:24:55 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-28 11:14:57 +0200 |
commit | f612ffea8262f53017be8eaf465b23c4c18c532a (patch) | |
tree | e5202b7f57d934015b491023524b777afba94a67 /ggsn/ggsn.c | |
parent | 421f22e8cf8059a7141f08b8dcac0854305571fa (diff) |
Move pdp_get_peer_ipv() to lib/util.*
Preparation for next commit, where this function will be needed inside
libmisc (lib/*).
Change-Id: Ibab4f6c09d1e5f0e9cfaea28ae1e7ab5b5c219b5
Diffstat (limited to 'ggsn/ggsn.c')
-rw-r--r-- | ggsn/ggsn.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index c7756d9..4e13151 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -51,6 +51,7 @@ #include "../lib/syserr.h" #include "../lib/in46_addr.h" #include "../lib/gtp-kernel.h" +#include "../lib/util.h" #include "../gtp/pdp.h" #include "../gtp/gtp.h" #include "icmpv6.h" @@ -365,26 +366,6 @@ static int delete_context(struct pdp_t *pdp) return 0; } -/*! Get the peer of pdp based on IP version used. - * \param[in] pdp PDP context to select the peer from. - * \param[in] v4v6 IP version to select. Valid values are 4 and 6. - * \returns The selected peer matching the given IP version. NULL if not present. - */ -struct ippoolm_t *pdp_get_peer_ipv(struct pdp_t *pdp, bool is_ipv6) { - uint8_t i; - - for (i = 0; i < 2; i++) { - struct ippoolm_t * ippool = pdp->peer[i]; - if (!ippool) - continue; - if (is_ipv6 && in46a_is_v6(&ippool->addr)) - return ippool; - else if (!is_ipv6 && in46a_is_v4(&ippool->addr)) - return ippool; - } - return NULL; -} - static bool apn_supports_ipv4(const struct apn_ctx *apn) { if (apn->v4.cfg.static_prefix.addr.len || apn->v4.cfg.dynamic_prefix.addr.len) |