Lines 77-87
Link Here
|
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 [-dnv] [-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 [-dnv] [-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 [-dv] [-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 [-dnv] [-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 [-dnv] [-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 157-163
Link Here
|
157 |
bzero((char *)&pnode, sizeof(pnode)); |
151 |
bzero((char *)&pnode, sizeof(pnode)); |
158 |
bzero((char *)&hnode, sizeof(hnode)); |
152 |
bzero((char *)&hnode, sizeof(hnode)); |
159 |
|
153 |
|
160 |
while ((c = getopt(argc, argv, "di:m:no:Rt:T:v")) != -1) |
154 |
while ((c = getopt(argc, argv, "di:m:no:Rt:T:v")) != -1) { |
161 |
switch (c) |
155 |
switch (c) |
162 |
{ |
156 |
{ |
163 |
case 'd' : |
157 |
case 'd' : |
Lines 207-223
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 |
} |
|
|
221 |
} |
220 |
|
222 |
|
|
|
223 |
if (argc - 1 - optind > 0) |
224 |
usage(argv[0]); |
225 |
|
221 |
if (argv[optind] != NULL && ipset == 0) { |
226 |
if (argv[optind] != NULL && ipset == 0) { |
222 |
if (setnodeaddr(type, role, ptr, argv[optind]) == 0) |
227 |
if (setnodeaddr(type, role, ptr, argv[optind]) == 0) |
223 |
ipset = 1; |
228 |
ipset = 1; |
Lines 262-268
Link Here
|
262 |
char *argv[]; |
267 |
char *argv[]; |
263 |
{ |
268 |
{ |
264 |
int type, role, c, err; |
269 |
int type, role, c, err; |
265 |
char *poolname; |
270 |
char *poolname, *typearg = NULL; |
266 |
iphtable_t iph; |
271 |
iphtable_t iph; |
267 |
ip_pool_t pool; |
272 |
ip_pool_t pool; |
268 |
|
273 |
|
Lines 274-280
Link Here
|
274 |
bzero((char *)&iph, sizeof(iph)); |
279 |
bzero((char *)&iph, sizeof(iph)); |
275 |
bzero((char *)&pool, sizeof(pool)); |
280 |
bzero((char *)&pool, sizeof(pool)); |
276 |
|
281 |
|
277 |
while ((c = getopt(argc, argv, "dm:no:RSv")) != -1) |
282 |
while ((c = getopt(argc, argv, "dm:no:RSvt:")) != -1) |
278 |
switch (c) |
283 |
switch (c) |
279 |
{ |
284 |
{ |
280 |
case 'd' : |
285 |
case 'd' : |
Lines 298-310
Link Here
|
298 |
opts |= OPT_NORESOLVE; |
303 |
opts |= OPT_NORESOLVE; |
299 |
break; |
304 |
break; |
300 |
case 'S' : |
305 |
case 'S' : |
301 |
iph.iph_seed = atoi(optarg); |
306 |
if (remove == 0) |
|
|
307 |
iph.iph_seed = atoi(optarg); |
308 |
else |
309 |
usage(argv[0]); |
302 |
break; |
310 |
break; |
303 |
case 'v' : |
311 |
case 'v' : |
304 |
opts |= OPT_VERBOSE; |
312 |
opts |= OPT_VERBOSE; |
305 |
break; |
313 |
break; |
|
|
314 |
case 't' : |
315 |
type = gettype(optarg, &iph.iph_type); |
316 |
typearg = optarg; |
317 |
break; |
318 |
default : |
319 |
usage(argv[0]); |
320 |
break; /* keep compiler happy */ |
306 |
} |
321 |
} |
307 |
|
322 |
|
|
|
323 |
if (argc - 1 - optind > 0) |
324 |
usage(argv[0]); |
325 |
|
308 |
if (opts & OPT_DEBUG) |
326 |
if (opts & OPT_DEBUG) |
309 |
fprintf(stderr, "poolcommand: opts = %#x\n", opts); |
327 |
fprintf(stderr, "poolcommand: opts = %#x\n", opts); |
310 |
|
328 |
|
Lines 313-321
Link Here
|
313 |
return -1; |
331 |
return -1; |
314 |
} |
332 |
} |
315 |
|
333 |
|
316 |
type = gettype(argv[optind], &iph.iph_type); |
|
|
317 |
if (type == IPLT_NONE) { |
334 |
if (type == IPLT_NONE) { |
318 |
fprintf(stderr, "unknown type '%s'\n", argv[optind]); |
335 |
if (typearg == NULL) { |
|
|
336 |
fprintf(stderr, "type must be specified\n"); |
337 |
usage(argv[0]); |
338 |
} else { |
339 |
fprintf(stderr, "unknown type '%s'\n", typearg); |
340 |
} |
319 |
return -1; |
341 |
return -1; |
320 |
} |
342 |
} |
321 |
|
343 |
|
Lines 361-368
Link Here
|
361 |
{ |
383 |
{ |
362 |
int c; |
384 |
int c; |
363 |
|
385 |
|
364 |
infile = optarg; |
|
|
365 |
|
366 |
while ((c = getopt(argc, argv, "dnRuv")) != -1) |
386 |
while ((c = getopt(argc, argv, "dnRuv")) != -1) |
367 |
switch (c) |
387 |
switch (c) |
368 |
{ |
388 |
{ |
Lines 382-389
Link Here
|
382 |
case 'v' : |
402 |
case 'v' : |
383 |
opts |= OPT_VERBOSE; |
403 |
opts |= OPT_VERBOSE; |
384 |
break; |
404 |
break; |
|
|
405 |
default : |
406 |
usage(argv[0]); |
407 |
break; /* keep compiler happy */ |
385 |
} |
408 |
} |
386 |
|
409 |
|
|
|
410 |
if (argc - 1 - optind > 0) |
411 |
usage(argv[0]); |
412 |
|
387 |
if (opts & OPT_DEBUG) |
413 |
if (opts & OPT_DEBUG) |
388 |
fprintf(stderr, "loadpoolfile: opts = %#x\n", opts); |
414 |
fprintf(stderr, "loadpoolfile: opts = %#x\n", opts); |
389 |
|
415 |
|
Lines 453-460
Link Here
|
453 |
case 'v' : |
479 |
case 'v' : |
454 |
opts |= OPT_VERBOSE; |
480 |
opts |= OPT_VERBOSE; |
455 |
break; |
481 |
break; |
|
|
482 |
default : |
483 |
usage(argv[0]); |
484 |
break; /* keep compiler happy */ |
456 |
} |
485 |
} |
457 |
|
486 |
|
|
|
487 |
if (argc - 1 - optind > 0) |
488 |
usage(argv[0]); |
489 |
|
458 |
if (opts & OPT_DEBUG) |
490 |
if (opts & OPT_DEBUG) |
459 |
fprintf(stderr, "poolstats: opts = %#x\n", opts); |
491 |
fprintf(stderr, "poolstats: opts = %#x\n", opts); |
460 |
|
492 |
|
Lines 559-566
Link Here
|
559 |
case 'v' : |
591 |
case 'v' : |
560 |
opts |= OPT_VERBOSE; |
592 |
opts |= OPT_VERBOSE; |
561 |
break; |
593 |
break; |
|
|
594 |
default : |
595 |
usage(argv[0]); |
596 |
break; /* keep compiler happy */ |
562 |
} |
597 |
} |
563 |
|
598 |
|
|
|
599 |
if (argc - 1 - optind > 0) |
600 |
usage(argv[0]); |
601 |
|
564 |
if (opts & OPT_DEBUG) |
602 |
if (opts & OPT_DEBUG) |
565 |
fprintf(stderr, "poolflush: opts = %#x\n", opts); |
603 |
fprintf(stderr, "poolflush: opts = %#x\n", opts); |
566 |
|
604 |
|
Lines 663-669
Link Here
|
663 |
poolname = NULL; |
701 |
poolname = NULL; |
664 |
role = IPL_LOGALL; |
702 |
role = IPL_LOGALL; |
665 |
|
703 |
|
666 |
while ((c = getopt(argc, argv, "dm:M:N:o:Rt:v")) != -1) |
704 |
while ((c = getopt(argc, argv, "dm:M:N:O:o:Rt:v")) != -1) |
667 |
switch (c) |
705 |
switch (c) |
668 |
{ |
706 |
{ |
669 |
case 'd' : |
707 |
case 'd' : |
Lines 703-710
Link Here
|
703 |
case 'v' : |
741 |
case 'v' : |
704 |
opts |= OPT_VERBOSE; |
742 |
opts |= OPT_VERBOSE; |
705 |
break; |
743 |
break; |
|
|
744 |
default : |
745 |
usage(argv[0]); |
746 |
break; /* keep compiler happy */ |
706 |
} |
747 |
} |
707 |
|
748 |
|
|
|
749 |
if (argc - 1 - optind > 0) |
750 |
usage(argv[0]); |
751 |
|
708 |
if (opts & OPT_DEBUG) |
752 |
if (opts & OPT_DEBUG) |
709 |
fprintf(stderr, "poollist: opts = %#x\n", opts); |
753 |
fprintf(stderr, "poollist: opts = %#x\n", opts); |
710 |
|
754 |
|