aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ippool.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-06ippool: Correctly compute size of static poolHarald Welte1-1/+1
* we have to use stataddr, not addr (dynamic) * we have to multiply the length of the address by 8 to get its bit length * we can simplify the -1 +1 logic (like dynamic) Change-Id: I174102051bef95f7df34b7d7c480a00ae408be7d Fixes: Coverity CID#174189
2017-10-17ippool: Implement and use blacklist instead of blindly using IPPOOL_NOGATEWAYPau Espin Pedrol1-12/+24
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
2017-10-16lib/ippool: Fix listsize calculated 1 elem too smallPau Espin Pedrol1-1/+1
Take the chance this commit is changing test output to also remove use of IPPOOL_NOGATEWAY which is going to be removed soon, and instead test IPPOOL_NOBROADCAST. Change-Id: I95c24bc690490155bec9e3933d678e4668d7745f
2017-10-13Remove trailing whitespacePau Espin Pedrol1-2/+2
Change-Id: I8e24f95a88bef3a59006a89c219871e6156963d7
2017-09-05lib/ippool: Move ippool_aton() out of ippool_new()Harald Welte1-17/+11
we rather pass the in46_prefix directly into ippool_new() Change-Id: Iadf6274e881a9bfc75eb41f9380f5ae2d8c92a0f
2017-09-05lib/ippool: Add back-pointer from pool member to poolHarald Welte1-0/+2
This allows us to remove pool members without having to keep a pointer to the pool around. Change-Id: I9042eb85989c5451d7894678eca110dd19e78002
2017-08-09ippool: Extend pool to work with /64 prefixesHarald Welte1-7/+10
In IPv6 GPRS, we actually don't want to allocate an individual v6 address (like in IPv4), but we want to allocate a prefix. The standard prefix lengh is 8 bytes, i.e. a /64 prefix. This patch extends the pool to be able to work with such v6 prefixes. Change-Id: I0cf700b6baf195a2e5fbea000531f801acaaa443
2017-08-09ggsn: Send proper errors in create_context_ind()Harald Welte1-8/+8
When we receive PDP context requests for unknown PDP types or if we run out of dynamic addresses, we need to inform the SGSN that PDP context creation failed. Change-Id: Ibf199c1726130d27c8f80230b30ee51101c93b06
2017-08-09ippool_new(): const-ify input argumentsHarald Welte1-1/+1
Change-Id: If3e53584e8c9c1f06bba4c183c9fd65fae913904
2017-08-09ippool: Add IPv6 support to IP pool implementationHarald Welte1-102/+136
Extend the IP pool implementation to be able to manage both pools of 32bit addresses (IPv4) as well as pools of 128bit addresses (IPv6) Change-Id: Ib98cc4bf634d6be9a7bf8c03a24e629455fcafc8
2014-12-04logging: Switch to using libosmocore logging for all the codeHolger Hans Peter Freyther1-23/+22
2011-11-02Convert all code to Linux coding styleHarald Welte1-463/+476
After so many years of silence, we don't expect the original author to return to the project. To make things a bit simpler for us, we convert the coding style to what we are used to (Linux style). The conversion was made using the 'Lindent' script which is part of the Linux kernel.
2010-10-20Move common sgsnemu/ggsn files to directory "lib"Emmanuel Bretelle1-0/+526
Some files like in sgsnemu and ggsn directory where exactly the same. They are now moved to the same directory for easier maintenance Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>