aboutsummaryrefslogtreecommitdiffstats
path: root/ggsn/ggsn.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-12 12:55:04 +0200
committerHarald Welte <laforge@gnumonks.org>2017-09-05 22:42:18 +0200
commit4857f3c2f39a12da1fc984dd65cbda9a3028ac03 (patch)
tree44253788559bc2f779d6d3f06127a1779a081091 /ggsn/ggsn.c
parentb513b951bdd9a7bb2d55a0d77fe7e3403448d2dd (diff)
lib/ippool: Move ippool_aton() out of ippool_new()
we rather pass the in46_prefix directly into ippool_new() Change-Id: Iadf6274e881a9bfc75eb41f9380f5ae2d8c92a0f
Diffstat (limited to 'ggsn/ggsn.c')
-rw-r--r--ggsn/ggsn.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index c82f630..7614b92 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -565,23 +565,24 @@ int main(int argc, char **argv)
}
/* dynip */
+ struct in46_prefix i46p;
+ size_t prefixlen;
if (!args_info.dynip_arg) {
- if (ippool_new(&ippool, args_info.net_arg, NULL, 1, 0,
- IPPOOL_NONETWORK | IPPOOL_NOGATEWAY |
- IPPOOL_NOBROADCAST)) {
- SYS_ERR(DGGSN, LOGL_ERROR, 0,
- "Failed to allocate IP pool!");
+ if (ippool_aton(&i46p.addr, &prefixlen, args_info.net_arg, 0)) {
+ SYS_ERR(DIP, LOGL_ERROR, 0, "Failed to parse dynamic pool");
exit(1);
}
} else {
- if (ippool_new(&ippool, args_info.dynip_arg, NULL, 1, 0,
- IPPOOL_NONETWORK | IPPOOL_NOGATEWAY |
- IPPOOL_NOBROADCAST)) {
- SYS_ERR(DGGSN, LOGL_ERROR, 0,
- "Failed to allocate IP pool!");
+ if (ippool_aton(&i46p.addr, &prefixlen, args_info.dynip_arg, 0)) {
+ SYS_ERR(DIP, LOGL_ERROR, 0, "Failed to parse dynamic pool");
exit(1);
}
}
+ i46p.prefixlen = prefixlen;
+ if (ippool_new(&ippool, &i46p, NULL, IPPOOL_NONETWORK | IPPOOL_NOGATEWAY | IPPOOL_NOBROADCAST)) {
+ SYS_ERR(DGGSN, LOGL_ERROR, 0, "Failed to allocate IP pool!");
+ exit(1);
+ }
/* DNS1 and DNS2 */
memset(&dns1, 0, sizeof(dns1));