summaryrefslogtreecommitdiff
path: root/client/dhclient.c
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2017-12-11 09:19:54 -0500
committerThomas Markwalder <tmark@isc.org>2017-12-11 09:19:54 -0500
commit140612c8cb51825fdf9e5723afb78c997117ab2c (patch)
tree24caa28a29b4557c2849ba4e310433cb7b245d04 /client/dhclient.c
parentc2e5ee2882d6d9dba5e7227d432552a3ab75b9e2 (diff)
downloadisc-dhcp-140612c8cb51825fdf9e5723afb78c997117ab2c.tar.gz
[master] Changes DHCLIENT_DEFAULT_PREFIX_LEN to 128, adds --address-prefix-len to dhclient cli
Merges in rt23252.
Diffstat (limited to 'client/dhclient.c')
-rw-r--r--client/dhclient.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/client/dhclient.c b/client/dhclient.c
index 94dfbd91..55e1c61c 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -105,6 +105,7 @@ int dad_wait_time = 0;
int prefix_len_hint = 0;
#endif
+int address_prefix_len = DHCLIENT_DEFAULT_PREFIX_LEN;
char *mockup_relay = NULL;
char *progname = NULL;
@@ -163,12 +164,14 @@ static const char use_v6command[] = "Command not used for DHCPv4: %s";
#define DHCLIENT_USAGE0 \
"[-4|-6] [-SNTPRI1dvrxi] [-nw] -4o6 <port>] [-p <port>] [-D LL|LLT]\n" \
" [--dad-wait-time <seconds>] [--prefix-len-hint <length>]\n" \
-" [--decline-wait-time <seconds>]\n"
+" [--decline-wait-time <seconds>]\n" \
+" [--address-prefix-len length]\n"
#else /* DHCP4o6 */
#define DHCLIENT_USAGE0 \
"[-4|-6] [-SNTPRI1dvrxi] [-nw] [-p <port>] [-D LL|LLT]\n" \
" [--dad-wait-time <seconds>] [--prefix-len-hint <length>]\n" \
-" [--decline-wait-time <seconds>]\n"
+" [--decline-wait-time <seconds>]\n" \
+" [--address-prefix-len length]\n"
#endif
#else /* DHCPv6 */
#define DHCLIENT_USAGE0 \
@@ -495,7 +498,6 @@ main(int argc, char **argv) {
if (++i == argc) {
usage(use_noarg, argv[i-1]);
}
-
errno = 0;
dad_wait_time = (int)strtol(argv[i], &s, 10);
if (errno || (*s != '\0') || (dad_wait_time < 0)) {
@@ -513,6 +515,17 @@ main(int argc, char **argv) {
usage("Invalid value for --prefix-len-hint: %s",
argv[i]);
}
+ } else if (!strcmp(argv[i], "--address-prefix-len")) {
+ if (++i == argc) {
+ usage(use_noarg, argv[i-1]);
+ }
+ errno = 0;
+ address_prefix_len = (int)strtol(argv[i], &s, 10);
+ if (errno || (*s != '\0') ||
+ (address_prefix_len < 0)) {
+ usage("Invalid value for"
+ " --address-prefix-len: %s", argv[i]);
+ }
#endif /* DHCPv6 */
} else if (!strcmp(argv[i], "--decline-wait-time")) {
if (++i == argc) {