Corrected pointer error in ggsn.c
This commit is contained in:
parent
9944eba320
commit
a7c3381c2b
|
@ -27,7 +27,7 @@ fg
|
||||||
# TAG: statedir
|
# TAG: statedir
|
||||||
# Directory to use for nonvolatile storage.
|
# Directory to use for nonvolatile storage.
|
||||||
# The program must have write access to this directory.
|
# The program must have write access to this directory.
|
||||||
#pidfile /var/lib/ggsn/
|
#statedir /var/lib/ggsn/
|
||||||
|
|
||||||
|
|
||||||
# TAG: listen
|
# TAG: listen
|
||||||
|
@ -53,6 +53,7 @@ listen 10.0.0.240
|
||||||
# Dynamic IP address pool.
|
# Dynamic IP address pool.
|
||||||
# Used for allocation of dynamic IP address when address is not given
|
# Used for allocation of dynamic IP address when address is not given
|
||||||
# by HLR or radius server.
|
# by HLR or radius server.
|
||||||
|
# If this option is not given then the net option is used as a substitute.
|
||||||
#dynip 192.168.0.0/24
|
#dynip 192.168.0.0/24
|
||||||
|
|
||||||
# TAG: statip
|
# TAG: statip
|
||||||
|
|
|
@ -53,8 +53,8 @@ cmdline_parser_print_help (void)
|
||||||
printf(" -nSTRING --net=STRING Network (default='192.168.0.0/24')\n");
|
printf(" -nSTRING --net=STRING Network (default='192.168.0.0/24')\n");
|
||||||
printf(" --ipup=STRING Script to run after link-up\n");
|
printf(" --ipup=STRING Script to run after link-up\n");
|
||||||
printf(" --ipdown=STRING Script to run after link-down\n");
|
printf(" --ipdown=STRING Script to run after link-down\n");
|
||||||
printf(" --dynip=STRING Dynamic IP address pool (default='192.168.0.0/24')\n");
|
printf(" --dynip=STRING Dynamic IP address pool\n");
|
||||||
printf(" --statip=STRING Static IP address pool (default='192.168.1.0/24')\n");
|
printf(" --statip=STRING Static IP address pool\n");
|
||||||
printf(" --pcodns1=STRING PCO DNS Server 1 (default='0.0.0.0')\n");
|
printf(" --pcodns1=STRING PCO DNS Server 1 (default='0.0.0.0')\n");
|
||||||
printf(" --pcodns2=STRING PCO DNS Server 2 (default='0.0.0.0')\n");
|
printf(" --pcodns2=STRING PCO DNS Server 2 (default='0.0.0.0')\n");
|
||||||
printf(" --timelimit=INT Exit after timelimit seconds (default='0')\n");
|
printf(" --timelimit=INT Exit after timelimit seconds (default='0')\n");
|
||||||
|
@ -111,8 +111,8 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i
|
||||||
args_info->net_arg = strdup("192.168.0.0/24") ;\
|
args_info->net_arg = strdup("192.168.0.0/24") ;\
|
||||||
args_info->ipup_arg = NULL; \
|
args_info->ipup_arg = NULL; \
|
||||||
args_info->ipdown_arg = NULL; \
|
args_info->ipdown_arg = NULL; \
|
||||||
args_info->dynip_arg = strdup("192.168.0.0/24") ;\
|
args_info->dynip_arg = NULL; \
|
||||||
args_info->statip_arg = strdup("192.168.1.0/24") ;\
|
args_info->statip_arg = NULL; \
|
||||||
args_info->pcodns1_arg = strdup("0.0.0.0") ;\
|
args_info->pcodns1_arg = strdup("0.0.0.0") ;\
|
||||||
args_info->pcodns2_arg = strdup("0.0.0.0") ;\
|
args_info->pcodns2_arg = strdup("0.0.0.0") ;\
|
||||||
args_info->timelimit_arg = 0 ;\
|
args_info->timelimit_arg = 0 ;\
|
||||||
|
|
|
@ -24,8 +24,8 @@ option "net" n "Network" string default="192.168.
|
||||||
option "ipup" - "Script to run after link-up" string no
|
option "ipup" - "Script to run after link-up" string no
|
||||||
option "ipdown" - "Script to run after link-down" string no
|
option "ipdown" - "Script to run after link-down" string no
|
||||||
|
|
||||||
option "dynip" - "Dynamic IP address pool" string default="192.168.0.0/24" no
|
option "dynip" - "Dynamic IP address pool" string no
|
||||||
option "statip" - "Static IP address pool" string default="192.168.1.0/24" no
|
option "statip" - "Static IP address pool" string no
|
||||||
|
|
||||||
option "pcodns1" - "PCO DNS Server 1" string default="0.0.0.0" no
|
option "pcodns1" - "PCO DNS Server 1" string default="0.0.0.0" no
|
||||||
option "pcodns2" - "PCO DNS Server 2" string default="0.0.0.0" no
|
option "pcodns2" - "PCO DNS Server 2" string default="0.0.0.0" no
|
||||||
|
|
|
@ -29,8 +29,8 @@ struct gengetopt_args_info
|
||||||
char * net_arg; /* Network (default='192.168.0.0/24'). */
|
char * net_arg; /* Network (default='192.168.0.0/24'). */
|
||||||
char * ipup_arg; /* Script to run after link-up. */
|
char * ipup_arg; /* Script to run after link-up. */
|
||||||
char * ipdown_arg; /* Script to run after link-down. */
|
char * ipdown_arg; /* Script to run after link-down. */
|
||||||
char * dynip_arg; /* Dynamic IP address pool (default='192.168.0.0/24'). */
|
char * dynip_arg; /* Dynamic IP address pool. */
|
||||||
char * statip_arg; /* Static IP address pool (default='192.168.1.0/24'). */
|
char * statip_arg; /* Static IP address pool. */
|
||||||
char * pcodns1_arg; /* PCO DNS Server 1 (default='0.0.0.0'). */
|
char * pcodns1_arg; /* PCO DNS Server 1 (default='0.0.0.0'). */
|
||||||
char * pcodns2_arg; /* PCO DNS Server 2 (default='0.0.0.0'). */
|
char * pcodns2_arg; /* PCO DNS Server 2 (default='0.0.0.0'). */
|
||||||
int timelimit_arg; /* Exit after timelimit seconds (default='0'). */
|
int timelimit_arg; /* Exit after timelimit seconds (default='0'). */
|
||||||
|
|
21
ggsn/ggsn.c
21
ggsn/ggsn.c
|
@ -132,7 +132,7 @@ int create_context(struct pdp_t *pdp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pdp_ntoeua(&member->addr, &pdp->eua);
|
pdp_ntoeua(&member->addr, &pdp->eua);
|
||||||
pdp->peer = &member;
|
pdp->peer = member;
|
||||||
pdp->ipif = tun; /* TODO */
|
pdp->ipif = tun; /* TODO */
|
||||||
member->peer = pdp;
|
member->peer = pdp;
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ int main(int argc, char **argv)
|
||||||
PACKAGE, args_info.listen_arg);
|
PACKAGE, args_info.listen_arg);
|
||||||
syslog(LOG_ERR, "Invalid listening address: %s!",
|
syslog(LOG_ERR, "Invalid listening address: %s!",
|
||||||
args_info.listen_arg);
|
args_info.listen_arg);
|
||||||
return 1;
|
exit(1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memcpy(&listen_.s_addr, host->h_addr, host->h_length);
|
memcpy(&listen_.s_addr, host->h_addr, host->h_length);
|
||||||
|
@ -275,21 +275,30 @@ int main(int argc, char **argv)
|
||||||
if(ippool_aton(&net, &mask, args_info.net_arg, 0)) {
|
if(ippool_aton(&net, &mask, args_info.net_arg, 0)) {
|
||||||
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
|
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
|
||||||
"Invalid network address: %s!", args_info.net_arg);
|
"Invalid network address: %s!", args_info.net_arg);
|
||||||
return -1;
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
|
||||||
|
"Network address must be specified: %s!", args_info.net_arg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* dynip */
|
/* dynip */
|
||||||
if (!args_info.dynip_arg) {
|
if (!args_info.dynip_arg) {
|
||||||
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
|
if (ippool_new(&ippool, args_info.net_arg,
|
||||||
"No dynamic address pool given!");
|
IPPOOL_NONETWORK | IPPOOL_NOBROADCAST)) {
|
||||||
return -1;
|
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
|
||||||
|
"Failed to allocate IP pool!");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (ippool_new(&ippool, args_info.dynip_arg,
|
if (ippool_new(&ippool, args_info.dynip_arg,
|
||||||
IPPOOL_NONETWORK | IPPOOL_NOBROADCAST)) {
|
IPPOOL_NONETWORK | IPPOOL_NOBROADCAST)) {
|
||||||
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
|
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
|
||||||
"Failed to allocate IP pool!");
|
"Failed to allocate IP pool!");
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue