mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
add --ip-version option to force either IPv4 or IPv6 analysis
Proposed-by: Jeff Balley <jeffrey.bailey@bt.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
b9cff0d814
commit
782f63c3ad
3 changed files with 23 additions and 2 deletions
|
|
@ -206,6 +206,12 @@ is not in use.
|
||||||
Treat all stand-alone subnets as shared-network with named formed from it's
|
Treat all stand-alone subnets as shared-network with named formed from it's
|
||||||
CIDR. By default this option is not in use for backwards compatibility.
|
CIDR. By default this option is not in use for backwards compatibility.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-\-ip\-version\fR=\fI4|6\fR
|
||||||
|
Force command to read configuration and leases files in IPv4 or IPv6 mode.
|
||||||
|
Notice that when inputs do not match with what is forced analysis output is
|
||||||
|
garbage. This option should not be necessary to use, and exists only to
|
||||||
|
allow debugging.
|
||||||
|
.TP
|
||||||
\fB\-v\fR, \fB\-\-version\fR
|
\fB\-v\fR, \fB\-\-version\fR
|
||||||
Print version information to standard output and exit successfully.
|
Print version information to standard output and exit successfully.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,8 @@ int main(int argc, char **argv)
|
||||||
OPT_CRIT,
|
OPT_CRIT,
|
||||||
OPT_MINSIZE,
|
OPT_MINSIZE,
|
||||||
OPT_WARN_COUNT,
|
OPT_WARN_COUNT,
|
||||||
OPT_CRIT_COUNT
|
OPT_CRIT_COUNT,
|
||||||
|
OPT_SET_IPV
|
||||||
};
|
};
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
|
|
@ -130,6 +131,7 @@ int main(int argc, char **argv)
|
||||||
{"minsize", required_argument, NULL, OPT_MINSIZE},
|
{"minsize", required_argument, NULL, OPT_MINSIZE},
|
||||||
{"perfdata", no_argument, NULL, 'p'},
|
{"perfdata", no_argument, NULL, 'p'},
|
||||||
{"all-as-shared", no_argument, NULL, 'A'},
|
{"all-as-shared", no_argument, NULL, 'A'},
|
||||||
|
{"ip-version", required_argument, NULL, OPT_SET_IPV},
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -165,6 +167,7 @@ int main(int argc, char **argv)
|
||||||
/* Treat single networks as shared with network CIDR as name */
|
/* Treat single networks as shared with network CIDR as name */
|
||||||
config.all_as_shared = 0;
|
config.all_as_shared = 0;
|
||||||
prepare_memory();
|
prepare_memory();
|
||||||
|
set_ipv_functions(IPvUNKNOWN);
|
||||||
/* Parse command line options */
|
/* Parse command line options */
|
||||||
while (1) {
|
while (1) {
|
||||||
int c;
|
int c;
|
||||||
|
|
@ -240,6 +243,18 @@ int main(int argc, char **argv)
|
||||||
case OPT_MINSIZE:
|
case OPT_MINSIZE:
|
||||||
config.minsize = strtod_or_err(optarg, "illegal argument");
|
config.minsize = strtod_or_err(optarg, "illegal argument");
|
||||||
break;
|
break;
|
||||||
|
case OPT_SET_IPV:
|
||||||
|
switch(optarg[0]) {
|
||||||
|
case '4':
|
||||||
|
set_ipv_functions(IPv4);
|
||||||
|
break;
|
||||||
|
case '6':
|
||||||
|
set_ipv_functions(IPv6);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
error(EXIT_FAILURE, 0, "unknown --ip-version argument: %s", optarg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
/* Print additional performance data in alarming mode */
|
/* Print additional performance data in alarming mode */
|
||||||
config.perfdata = 1;
|
config.perfdata = 1;
|
||||||
|
|
@ -301,7 +316,6 @@ int main(int argc, char **argv)
|
||||||
error(EXIT_FAILURE, 0, "unknown output format: %s", quote(print_mac_addreses_tmp));
|
error(EXIT_FAILURE, 0, "unknown output format: %s", quote(print_mac_addreses_tmp));
|
||||||
}
|
}
|
||||||
/* Do the job */
|
/* Do the job */
|
||||||
set_ipv_functions(IPvUNKNOWN);
|
|
||||||
parse_config(1, config.dhcpdconf_file, shared_networks);
|
parse_config(1, config.dhcpdconf_file, shared_networks);
|
||||||
parse_leases();
|
parse_leases();
|
||||||
prepare_data();
|
prepare_data();
|
||||||
|
|
|
||||||
|
|
@ -476,6 +476,7 @@ void __attribute__ ((__noreturn__)) usage(int status)
|
||||||
fputs( " --snet-alarms suppress range alarms that are part of a shared-net\n", out);
|
fputs( " --snet-alarms suppress range alarms that are part of a shared-net\n", out);
|
||||||
fputs( " -p, --perfdata print additional perfdata in alarming mode\n", out);
|
fputs( " -p, --perfdata print additional perfdata in alarming mode\n", out);
|
||||||
fputs( " -A, --all-as-shared treat single subnets as shared-network with CIDR as their name\n", out);
|
fputs( " -A, --all-as-shared treat single subnets as shared-network with CIDR as their name\n", out);
|
||||||
|
fputs( " --ip-version=4|6 force analysis to use either IPv4 or IPv6 functions\n", out);
|
||||||
fputs( " -v, --version output version information and exit\n", out);
|
fputs( " -v, --version output version information and exit\n", out);
|
||||||
fputs( " -h, --help display this help and exit\n", out);
|
fputs( " -h, --help display this help and exit\n", out);
|
||||||
fputs( "\n", out);
|
fputs( "\n", out);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue