aboutsummaryrefslogtreecommitdiffstats
path: root/ggsn/gtp-kernel.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-02 19:49:47 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-09 22:08:57 +0200
commitd12eab9c4e375e1669637dd34674c8b8208cf867 (patch)
tree2a105db1821f3b1db6a12b1ab8f3c1ef9d301648 /ggsn/gtp-kernel.c
parentd9d8862a58702ba71b5194faa01ecf1eb234519c (diff)
ippool: Add IPv6 support to IP pool implementation
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
Diffstat (limited to 'ggsn/gtp-kernel.c')
-rw-r--r--ggsn/gtp-kernel.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/ggsn/gtp-kernel.c b/ggsn/gtp-kernel.c
index dbe5a9f..458ac27 100644
--- a/ggsn/gtp-kernel.c
+++ b/ggsn/gtp-kernel.c
@@ -70,17 +70,6 @@ static void pdp_debug(struct pdp_t *pdp)
printf("\n");
}
-static int mask2prefix(struct in_addr *mask)
-{
- uint32_t tmp = ntohl(mask->s_addr);
- int k;
-
- for (k=0; tmp > 0; k++)
- tmp = (tmp << 1);
-
- return k;
-}
-
static struct {
int genl_id;
struct mnl_socket *nl;
@@ -91,7 +80,7 @@ static struct {
#define GTP_DEVNAME "gtp0"
int gtp_kernel_init(struct gsn_t *gsn, struct in_addr *net,
- struct in_addr *mask,
+ size_t prefixlen,
struct gengetopt_args_info *args_info)
{
if (!args_info->gtp_linux_given)
@@ -126,7 +115,7 @@ int gtp_kernel_init(struct gsn_t *gsn, struct in_addr *net,
DEBUGP(DGGSN, "Setting route to reach %s via %s\n",
args_info->net_arg, GTP_DEVNAME);
- if (gtp_dev_config(GTP_DEVNAME, net, mask2prefix(mask)) < 0) {
+ if (gtp_dev_config(GTP_DEVNAME, net, prefixlen) < 0) {
SYS_ERR(DGGSN, LOGL_ERROR, 0,
"Cannot add route to reach network %s\n",
args_info->net_arg);