Lines 75-87
Link Here
|
75 |
char *prog; |
75 |
char *prog; |
76 |
{ |
76 |
{ |
77 |
fprintf(stderr, "Usage:\t%s\n", prog); |
77 |
fprintf(stderr, "Usage:\t%s\n", prog); |
78 |
fprintf(stderr, "\t-a [-dnv] [-m <name>] [-o <role>] [-t type] [-T ttl] -i <ipaddr>[/netmask]\n"); |
78 |
fprintf(stderr, "\t-a [-dnvR] [-m <name>] [-o <role>] [-t type] [-T ttl] -i <ipaddr>[/netmask]\n"); |
79 |
fprintf(stderr, "\t-A [-dnv] [-m <name>] [-o <role>] [-S <seed>] [-t <type>]\n"); |
79 |
fprintf(stderr, "\t-A [-dnvR] [-m <name>] [-o <role>] [-S <seed>] [-t <type>]\n"); |
80 |
fprintf(stderr, "\t-f <file> [-dnuv]\n"); |
80 |
fprintf(stderr, "\t-f <file> [-dnuvR]\n"); |
81 |
fprintf(stderr, "\t-F [-dv] [-o <role>] [-t <type>]\n"); |
81 |
fprintf(stderr, "\t-F [-dv] [-o <role>] [-t <type>]\n"); |
82 |
fprintf(stderr, "\t-l [-dv] [-m <name>] [-t <type>] [-O <fields>]\n"); |
82 |
fprintf(stderr, "\t-l [-dvR] [-m <name>] [-t <type>] [-O <fields>]\n"); |
83 |
fprintf(stderr, "\t-r [-dnv] [-m <name>] [-o <role>] [-t type] -i <ipaddr>[/netmask]\n"); |
83 |
fprintf(stderr, "\t-r [-dnvR] [-m <name>] [-o <role>] [-t type] -i <ipaddr>[/netmask]\n"); |
84 |
fprintf(stderr, "\t-R [-dnv] [-m <name>] [-o <role>] [-t <type>]\n"); |
84 |
fprintf(stderr, "\t-R [-dnvR] [-m <name>] [-o <role>] [-t <type>]\n"); |
85 |
fprintf(stderr, "\t-s [-dtv] [-M <core>] [-N <namelist>]\n"); |
85 |
fprintf(stderr, "\t-s [-dtv] [-M <core>] [-N <namelist>]\n"); |
86 |
exit(1); |
86 |
exit(1); |
87 |
} |
87 |
} |
Lines 99-105
Link Here
|
99 |
|
99 |
|
100 |
assigndefined(getenv("IPPOOL_PREDEFINED")); |
100 |
assigndefined(getenv("IPPOOL_PREDEFINED")); |
101 |
|
101 |
|
102 |
switch (getopt(argc, argv, "aAf:FlnrRsv")) |
102 |
switch (getopt(argc, argv, "aAf:FlrRs")) |
103 |
{ |
103 |
{ |
104 |
case 'a' : |
104 |
case 'a' : |
105 |
err = poolnodecommand(0, argc, argv); |
105 |
err = poolnodecommand(0, argc, argv); |
Lines 116-124
Link Here
|
116 |
case 'l' : |
116 |
case 'l' : |
117 |
err = poollist(argc, argv); |
117 |
err = poollist(argc, argv); |
118 |
break; |
118 |
break; |
119 |
case 'n' : |
|
|
120 |
opts |= OPT_DONOTHING|OPT_DONTOPEN; |
121 |
break; |
122 |
case 'r' : |
119 |
case 'r' : |
123 |
err = poolnodecommand(1, argc, argv); |
120 |
err = poolnodecommand(1, argc, argv); |
124 |
break; |
121 |
break; |
Lines 128-136
Link Here
|
128 |
case 's' : |
125 |
case 's' : |
129 |
err = poolstats(argc, argv); |
126 |
err = poolstats(argc, argv); |
130 |
break; |
127 |
break; |
131 |
case 'v' : |
|
|
132 |
opts |= OPT_VERBOSE; |
133 |
break; |
134 |
default : |
128 |
default : |
135 |
exit(1); |
129 |
exit(1); |
136 |
} |
130 |
} |
Lines 207-221
Link Here
|
207 |
} |
201 |
} |
208 |
break; |
202 |
break; |
209 |
case 'T' : |
203 |
case 'T' : |
210 |
ttl = atoi(optarg); |
204 |
if (remove == 0) { |
211 |
if (ttl < 0) { |
205 |
ttl = atoi(optarg); |
212 |
fprintf(stderr, "cannot set negative ttl\n"); |
206 |
if (ttl < 0) { |
213 |
return -1; |
207 |
fprintf(stderr, "cannot set negative ttl\n"); |
|
|
208 |
return -1; |
209 |
} |
210 |
} else { |
211 |
usage(argv[0]); |
214 |
} |
212 |
} |
215 |
break; |
213 |
break; |
216 |
case 'v' : |
214 |
case 'v' : |
217 |
opts |= OPT_VERBOSE; |
215 |
opts |= OPT_VERBOSE; |
218 |
break; |
216 |
break; |
|
|
217 |
default : |
218 |
usage(argv[0]); |
219 |
break; /* keep compiler happy */ |
219 |
} |
220 |
} |
220 |
|
221 |
|
221 |
if (argv[optind] != NULL && ipset == 0) { |
222 |
if (argv[optind] != NULL && ipset == 0) { |
Lines 262-268
Link Here
|
262 |
char *argv[]; |
263 |
char *argv[]; |
263 |
{ |
264 |
{ |
264 |
int type, role, c, err; |
265 |
int type, role, c, err; |
265 |
char *poolname; |
266 |
char *poolname, *typearg = NULL; |
266 |
iphtable_t iph; |
267 |
iphtable_t iph; |
267 |
ip_pool_t pool; |
268 |
ip_pool_t pool; |
268 |
|
269 |
|
Lines 274-280
Link Here
|
274 |
bzero((char *)&iph, sizeof(iph)); |
275 |
bzero((char *)&iph, sizeof(iph)); |
275 |
bzero((char *)&pool, sizeof(pool)); |
276 |
bzero((char *)&pool, sizeof(pool)); |
276 |
|
277 |
|
277 |
while ((c = getopt(argc, argv, "dm:no:RSv")) != -1) |
278 |
optreset = optind = 1; |
|
|
279 |
|
280 |
while ((c = getopt(argc, argv, "dm:no:RSvt:")) != -1) |
278 |
switch (c) |
281 |
switch (c) |
279 |
{ |
282 |
{ |
280 |
case 'd' : |
283 |
case 'd' : |
Lines 295-310
Link Here
|
295 |
} |
298 |
} |
296 |
break; |
299 |
break; |
297 |
case 'R' : |
300 |
case 'R' : |
|
|
301 |
/* not in man page */ |
298 |
opts |= OPT_NORESOLVE; |
302 |
opts |= OPT_NORESOLVE; |
299 |
break; |
303 |
break; |
300 |
case 'S' : |
304 |
case 'S' : |
301 |
iph.iph_seed = atoi(optarg); |
305 |
if (remove == 0) |
|
|
306 |
iph.iph_seed = atoi(optarg); |
307 |
else |
308 |
usage(argv[0]); |
302 |
break; |
309 |
break; |
303 |
case 'v' : |
310 |
case 'v' : |
304 |
opts |= OPT_VERBOSE; |
311 |
opts |= OPT_VERBOSE; |
305 |
break; |
312 |
break; |
|
|
313 |
case 't' : |
314 |
type = gettype(optarg, &iph.iph_type); |
315 |
typearg = optarg; |
316 |
break; |
317 |
default : |
318 |
usage(argv[0]); |
319 |
break; /* keep compiler happy */ |
306 |
} |
320 |
} |
307 |
|
321 |
|
|
|
322 |
if (argc - optind > 0) |
323 |
usage(argv[0]); |
324 |
|
308 |
if (opts & OPT_DEBUG) |
325 |
if (opts & OPT_DEBUG) |
309 |
fprintf(stderr, "poolcommand: opts = %#x\n", opts); |
326 |
fprintf(stderr, "poolcommand: opts = %#x\n", opts); |
310 |
|
327 |
|
Lines 313-321
Link Here
|
313 |
return -1; |
330 |
return -1; |
314 |
} |
331 |
} |
315 |
|
332 |
|
316 |
type = gettype(argv[optind], &iph.iph_type); |
|
|
317 |
if (type == IPLT_NONE) { |
333 |
if (type == IPLT_NONE) { |
318 |
fprintf(stderr, "unknown type '%s'\n", argv[optind]); |
334 |
if (typearg == NULL) |
|
|
335 |
usage(argv[0]); |
336 |
else |
337 |
fprintf(stderr, "unknown type '%s'\n", typearg); |
319 |
return -1; |
338 |
return -1; |
320 |
} |
339 |
} |
321 |
|
340 |
|
Lines 382-387
Link Here
|
382 |
case 'v' : |
401 |
case 'v' : |
383 |
opts |= OPT_VERBOSE; |
402 |
opts |= OPT_VERBOSE; |
384 |
break; |
403 |
break; |
|
|
404 |
default : |
405 |
usage(argv[0]); |
406 |
break; /* keep compiler happy */ |
385 |
} |
407 |
} |
386 |
|
408 |
|
387 |
if (opts & OPT_DEBUG) |
409 |
if (opts & OPT_DEBUG) |
Lines 453-458
Link Here
|
453 |
case 'v' : |
475 |
case 'v' : |
454 |
opts |= OPT_VERBOSE; |
476 |
opts |= OPT_VERBOSE; |
455 |
break; |
477 |
break; |
|
|
478 |
default : |
479 |
usage(argv[0]); |
480 |
break; /* keep compiler happy */ |
456 |
} |
481 |
} |
457 |
|
482 |
|
458 |
if (opts & OPT_DEBUG) |
483 |
if (opts & OPT_DEBUG) |
Lines 559-564
Link Here
|
559 |
case 'v' : |
584 |
case 'v' : |
560 |
opts |= OPT_VERBOSE; |
585 |
opts |= OPT_VERBOSE; |
561 |
break; |
586 |
break; |
|
|
587 |
default : |
588 |
usage(argv[0]); |
589 |
break; /* keep compiler happy */ |
562 |
} |
590 |
} |
563 |
|
591 |
|
564 |
if (opts & OPT_DEBUG) |
592 |
if (opts & OPT_DEBUG) |
Lines 703-708
Link Here
|
703 |
case 'v' : |
731 |
case 'v' : |
704 |
opts |= OPT_VERBOSE; |
732 |
opts |= OPT_VERBOSE; |
705 |
break; |
733 |
break; |
|
|
734 |
default : |
735 |
usage(argv[0]); |
736 |
break; /* keep compiler happy */ |
706 |
} |
737 |
} |
707 |
|
738 |
|
708 |
if (opts & OPT_DEBUG) |
739 |
if (opts & OPT_DEBUG) |