aboutsummaryrefslogtreecommitdiffstats
path: root/lib/in46_addr.h
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-10-13 14:32:09 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-10-13 15:10:04 +0200
commit503f468366fc28720208aeee957bfb32a50a60d8 (patch)
tree0851e43c00d3faef3411ee83220437a1a021ceec /lib/in46_addr.h
parentd6ede37b7e62ca7e3544b7319b9234c564365dca (diff)
ippool: Implement and use blacklist instead of blindly using IPPOOL_NOGATEWAYpespin/ippool
Commit dda21ed7d4a897c9284c69175d0da598598eae40 modified previous calls to ippool_new() removing the pass of flags to avoid allocating certain problematic IPs from the pool to MS, such as the network, gateway and broadcast IPs. Today I did some unsucessful tests with osmo-ggsn with a pool "ip prefix dynamic 176.16.222.0/24", and thus IP 176.16.222.0 was being assigned to the MS. De-capsulated DNS packets were received in the tun interface, but the Linux system in there was unable to correctly forward the packets to the gateway interface connected to the Internet. However, adding a second MS which got 176.16.222.1 had its packets forwarded correctly. However, previous implementation relies on flag IPPOOL_NOGATEWAY flag to blindly blacklist first IP after the network ip (ie, .0 and .1 are removed), which limits the IP reserved for the tun device to be .1. If a different IP in the range is assigned, it may cause issues. As a result, a blacklist is introduced in this commit to dynamically fetch the tun IP address and exlucde it from the pool of available IPs. Change-Id: I8e91f7280d60490c858a769dd578c1c8e54e9243
Diffstat (limited to 'lib/in46_addr.h')
-rw-r--r--lib/in46_addr.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/in46_addr.h b/lib/in46_addr.h
index ce2df14..109a933 100644
--- a/lib/in46_addr.h
+++ b/lib/in46_addr.h
@@ -27,6 +27,9 @@ extern const char *in46p_ntoa(const struct in46_prefix *in46p);
extern int in46a_equal(const struct in46_addr *a, const struct in46_addr *b);
extern int in46a_prefix_equal(const struct in46_addr *a, const struct in46_addr *b);
extern int in46a_within_mask(const struct in46_addr *addr, const struct in46_addr *net, size_t prefixlen);
+extern unsigned int netmask_ipv4_prefixlen(const struct in_addr *netmask);
+extern unsigned int netmask_ipv6_prefixlen(const struct in6_addr *netmask);
+extern unsigned int in46a_prefixlen(const struct in46_addr *netmask);
int in46a_to_eua(const struct in46_addr *src, struct ul66_t *eua);
int in46a_from_eua(const struct ul66_t *eua, struct in46_addr *dst);