summaryrefslogtreecommitdiff
path: root/ot_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_config.c')
-rw-r--r--ot_config.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/ot_config.c b/ot_config.c
index e9666f9..32625bd 100644
--- a/ot_config.c
+++ b/ot_config.c
@@ -107,7 +107,7 @@ static int listen_scan_options(char *p, int *shared, int *workers) {
107 *shared = 1; 107 *shared = 1;
108 break; 108 break;
109 case LISTEN_OPTION_WORKERS: { 109 case LISTEN_OPTION_WORKERS: {
110 size_t off = scan_udec(p, &value, UINT_MAX); 110 size_t off = scan_uint(p, &value, UINT_MAX);
111 111
112 if (!off) 112 if (!off)
113 return 0; 113 return 0;
@@ -140,7 +140,7 @@ static int scan_ip6_port(const char *src, ot_ip6 ip, uint16_t *port) {
140 ++s; 140 ++s;
141 if (*s == '[') 141 if (*s == '[')
142 ++s, ++bracket; /* for v6 style notation */ 142 ++s, ++bracket; /* for v6 style notation */
143 if (!(off = ip_scan(s, ip))) 143 if (!(off = ip_parse(s, ip)))
144 return 0; 144 return 0;
145 s += off; 145 s += off;
146 if (bracket && *s == ']') 146 if (bracket && *s == ']')
@@ -157,7 +157,7 @@ static int scan_ip6_port(const char *src, ot_ip6 ip, uint16_t *port) {
157 if (*(s++) != ':') 157 if (*(s++) != ':')
158 return 0; 158 return 0;
159 } 159 }
160 if (!(off = scan_udec(s, &value, 65535))) 160 if (!(off = scan_uint(s, &value, 65535)))
161 return 0; 161 return 0;
162 *port = (uint16_t)value; 162 *port = (uint16_t)value;
163 return off + s - src; 163 return off + s - src;
@@ -169,14 +169,14 @@ static int scan_ip6_net(const char *src, ot_net *net) {
169 int off; 169 int off;
170 while (isspace(*s)) 170 while (isspace(*s))
171 ++s; 171 ++s;
172 if (!(off = ip_scan(s, net->address))) 172 if (!(off = ip_parse(s, net->address)))
173 return 0; 173 return 0;
174 s += off; 174 s += off;
175 if (*s != '/') 175 if (*s != '/')
176 net->bits = 128; 176 net->bits = 128;
177 else { 177 else {
178 s++; 178 s++;
179 if (!(off = scan_udec(s, &value, 128))) 179 if (!(off = scan_uint(s, &value, 128)))
180 return 0; 180 return 0;
181 net->bits = (int)value; 181 net->bits = (int)value;
182 if (ip_is_v4mapped(net->address)) 182 if (ip_is_v4mapped(net->address))
@@ -264,7 +264,7 @@ static config_kind parse_config_key(char **p) {
264 return CONFIG_UNKNOWN; 264 return CONFIG_UNKNOWN;
265} 265}
266 266
267int parse_configfile(char *config_filename) { 267static int parse_configfile(char *config_filename) {
268 FILE *config_file_handle; 268 FILE *config_file_handle;
269 char inbuf[512]; 269 char inbuf[512];
270 ot_ip6 tmpip; 270 ot_ip6 tmpip;
@@ -324,12 +324,12 @@ int parse_configfile(char *config_filename) {
324 break; 324 break;
325 } 325 }
326 case CONFIG_LISTEN_UDP_WORKERS: 326 case CONFIG_LISTEN_UDP_WORKERS:
327 if (!scan_udec(p, &value, UINT_MAX)) 327 if (!scan_uint(p, &value, UINT_MAX))
328 goto parse_error; 328 goto parse_error;
329 g_listen_workers = (int)value; 329 g_listen_workers = (int)value;
330 break; 330 break;
331 case CONFIG_LISTEN_SHARED: 331 case CONFIG_LISTEN_SHARED:
332 if (!scan_udec(p, &value, 1)) 332 if (!scan_uint(p, &value, 1))
333 goto parse_error; 333 goto parse_error;
334 g_listen_shared = (int)value; 334 g_listen_shared = (int)value;
335 break; 335 break;
@@ -479,7 +479,7 @@ void config_parse(int argc, char **argv) {
479 scanon = 0; 479 scanon = 0;
480 break; 480 break;
481 case 'i': 481 case 'i':
482 if (!ip_scan(optarg, serverip)) { 482 if (!ip_parse(optarg, serverip)) {
483 usage(argv[0]); 483 usage(argv[0]);
484 exit(1); 484 exit(1);
485 } 485 }
@@ -494,7 +494,7 @@ void config_parse(int argc, char **argv) {
494 break; 494 break;
495#endif 495#endif
496 case 'p': 496 case 'p':
497 if (!scan_udec(optarg, &value, 65535)) { 497 if (!scan_uint(optarg, &value, 65535)) {
498 usage(argv[0]); 498 usage(argv[0]);
499 exit(1); 499 exit(1);
500 } 500 }
@@ -502,7 +502,7 @@ void config_parse(int argc, char **argv) {
502 bound++; 502 bound++;
503 break; 503 break;
504 case 'P': 504 case 'P':
505 if (!scan_udec(optarg, &value, 65535)) { 505 if (!scan_uint(optarg, &value, 65535)) {
506 usage(argv[0]); 506 usage(argv[0]);
507 exit(1); 507 exit(1);
508 } 508 }
@@ -511,7 +511,7 @@ void config_parse(int argc, char **argv) {
511 break; 511 break;
512#ifdef WANT_SYNC_LIVE 512#ifdef WANT_SYNC_LIVE
513 case 's': 513 case 's':
514 if (!scan_udec(optarg, &value, 65535)) { 514 if (!scan_uint(optarg, &value, 65535)) {
515 usage(argv[0]); 515 usage(argv[0]);
516 exit(1); 516 exit(1);
517 } 517 }