Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 850891 Details for
Bug 876791
dhclient6 -P needs a way to specify prefix length
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Updated patch to include config option
dhcp-prefix-len.patch (text/plain), 7.54 KB, created by
Scott Shambarger
on 2014-01-16 07:37:10 UTC
(
hide
)
Description:
Updated patch to include config option
Filename:
MIME Type:
Creator:
Scott Shambarger
Created:
2014-01-16 07:37:10 UTC
Size:
7.54 KB
patch
obsolete
>diff --git a/client/clparse.c b/client/clparse.c >index c535d7b..4e75218 100644 >--- a/client/clparse.c >+++ b/client/clparse.c >@@ -151,6 +151,7 @@ isc_result_t read_client_conf () > top_level_config.requested_options = default_requested_options; > top_level_config.omapi_port = -1; > top_level_config.do_forward_update = 1; >+ top_level_config.max_prefix = ia_pd_max_prefix; > /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache) > */ > top_level_config.requested_lease = 7200; >@@ -320,6 +321,7 @@ void read_client_leases () > interface-declaration | > LEASE client-lease-statement | > ALIAS client-lease-statement | >+ MAX_PREFIX number | > KEY key-definition */ > > void parse_client_statement (cfile, ip, config) >@@ -739,6 +741,20 @@ void parse_client_statement (cfile, ip, config) > parse_reject_statement (cfile, config); > return; > >+ case MAX_PREFIX: >+ token = next_token (&val, (unsigned *)0, cfile); >+ if (token != NUMBER) { >+ parse_warn (cfile, "invalid prefix len: `%s'", val); >+ skip_to_semi (cfile); >+ return; >+ } >+ tmp = atoi (val); >+ if (tmp < 4 || tmp > 127) >+ parse_warn (cfile, "invalid prefix len %d.", tmp); >+ config -> max_prefix = tmp; >+ parse_semi (cfile); >+ return; >+ > default: > lose = 0; > stmt = (struct executable_statement *)0; >diff --git a/client/dhc6.c b/client/dhc6.c >index 8974e7a..916ef29 100644 >--- a/client/dhc6.c >+++ b/client/dhc6.c >@@ -1554,6 +1554,7 @@ do_init6(void *input) > struct timeval tv; > u_int32_t t1, t2; > int i, idx, len, send_ret; >+ int req_prefix; > > client = input; > >@@ -1795,6 +1796,7 @@ do_init6(void *input) > } > > /* Append IA_PD. */ >+ req_prefix = 0; > for (i = 0; i < wanted_ia_pd; i++) { > /* > * XXX: maybe the IA_PD('s) should be put into the sent_options >@@ -1855,6 +1857,10 @@ do_init6(void *input) > continue; > } > >+ /* Ignore an old binding if too small */ >+ if (client->config->max_prefix && old_addr->plen > client->config->max_prefix) >+ continue; >+ > if (!buffer_allocate(&addr.buffer, 25, MDL)) { > log_error("Unable to allocate memory " > "for IAPREFIX."); >@@ -1891,7 +1897,46 @@ do_init6(void *input) > &addr); > > data_string_forget(&addr, MDL); >+ >+ req_prefix++; >+ } >+ } >+ >+ if (client->config->max_prefix && !req_prefix) { >+ memset(&addr, 0, sizeof(addr)); >+ if (!buffer_allocate(&addr.buffer, 25, MDL)) { >+ log_error("Unable to allocate memory " >+ "for IAPREFIX."); >+ data_string_forget(&ia, MDL); >+ data_string_forget(&ds, MDL); >+ return; > } >+ >+ addr.data = addr.buffer->data; >+ addr.len = 25; >+ >+ t1 = client->config->requested_lease; >+ t2 = t1 + (t1 / 2); >+ putULong(addr.buffer->data, t1); >+ putULong(addr.buffer->data + 4, t2); >+ >+ putUChar(addr.buffer->data + 8, client->config->max_prefix); >+ memset(addr.buffer->data + 9, 0, 16); >+ >+ log_debug("XMT: | X-- Request prefix ::/%u.", >+ (unsigned) client->config->max_prefix); >+ log_debug("XMT: | | X-- Request " >+ "preferred in +%u", >+ (unsigned)t1); >+ log_debug("XMT: | | X-- Request valid " >+ "in +%u", >+ (unsigned)t2); >+ >+ append_option(&ia, &dhcpv6_universe, >+ iaprefix_option, >+ &addr); >+ >+ data_string_forget(&addr, MDL); > } > > append_option(&ds, &dhcpv6_universe, ia_pd_option, &ia); >diff --git a/client/dhclient.8 b/client/dhclient.8 >index 3539591..c61304e 100644 >--- a/client/dhclient.8 >+++ b/client/dhclient.8 >@@ -64,6 +64,10 @@ dhclient - Dynamic Host Configuration Protocol Client > .I port-number > ] > [ >+.B --max-prefix >+.I bits >+] >+[ > .B -d > ] > [ >@@ -306,6 +310,11 @@ If a different port is specified on which the client should listen and > transmit, the client will also use a different destination port - > one less than the specified port. > .TP >+.BI \--max-prefix \ bits >+The maximum IPV6 prefix length >+.B dhclient >+will request on startup when prefix delegation (\fI-P\fR) is enabled. >+.TP > .BI \-s \ server-addr > Specify the server IP address or fully qualified domain name to use as > a destination for DHCP protocol messages before >diff --git a/client/dhclient.c b/client/dhclient.c >index 551ccbf..461e6e5 100644 >--- a/client/dhclient.c >+++ b/client/dhclient.c >@@ -83,6 +83,7 @@ int onetry = 0; > int quiet = 1; > int nowait = 0; > int stateless = 0; >+unsigned int ia_pd_max_prefix = 0; > int wanted_ia_na = -1; /* the absolute value is the real one. */ > int wanted_ia_ta = 0; > int wanted_ia_pd = 0; >@@ -289,6 +290,13 @@ main(int argc, char **argv) { > wanted_ia_na = 0; > } > wanted_ia_pd++; >+ } else if (!strcmp(argv[i], "--max-prefix")) { >+ char *ep; >+ if (++i == argc) >+ log_fatal("--max-prefix requires an argument."); >+ ia_pd_max_prefix = strtoul(argv[i], &ep, 10); >+ if (*ep || ia_pd_max_prefix < 4 || ia_pd_max_prefix > 127) >+ log_fatal("Invalid max-prefix length: %s", argv[i]); > } else if (!strcmp(argv[i], "-D")) { > if (local_family_set && (local_family == AF_INET)) { > usage(); >@@ -709,6 +717,7 @@ static void usage() > log_fatal("Usage: dhclient " > #ifdef DHCPv6 > "[-4|-6] [-SNTP1dvrx] [-nw] [-p <port>] [-D LL|LLT]\n" >+ " [--max-prefix <bits>]\n" > #else /* DHCPv6 */ > "[-1dvrx] [-nw] [-p <port>]\n" > #endif /* DHCPv6 */ >diff --git a/client/dhclient.conf.5 b/client/dhclient.conf.5 >index f649662..6df73ca 100644 >--- a/client/dhclient.conf.5 >+++ b/client/dhclient.conf.5 >@@ -688,6 +688,15 @@ know the DHCP service(s) anycast MAC address prior to configuring your > client. The \fIlink-type\fR and \fImac-address\fR parameters are configured > in a similar manner to the \fBhardware\fR statement. > .PP >+ \fBmax-prefix\fR \fIprefix-bits\fR\fB;\fR >+.PP >+The >+.B max-prefix >+statement limits prefix delegation requests to a maximum of \fIprefix-bits\fR. >+Any existing leases with prefixes larger than \fIprefix-bits\fR are not >+rebound at startup, and if dhclient has no valid leases at startup an >+empty "hint" lease is requested with this prefix length. >+.PP > .SH SAMPLE > The following configuration file is used on a laptop running NetBSD > 1.3. The laptop has an IP alias of 192.5.5.213, and has one >diff --git a/common/conflex.c b/common/conflex.c >index 0ae5e69..3fd91e9 100644 >--- a/common/conflex.c >+++ b/common/conflex.c >@@ -1133,6 +1133,8 @@ intern(char *atom, enum dhcp_token dfv) { > return MAX_RESPONSE_DELAY; > if (!strcasecmp (atom + 3, "-unacked-updates")) > return MAX_UNACKED_UPDATES; >+ if (!strcasecmp (atom + 3, "-prefix")) >+ return MAX_PREFIX; > } > if (!strncasecmp (atom + 1, "in-", 3)) { > if (!strcasecmp (atom + 4, "balance")) >diff --git a/includes/dhcpd.h b/includes/dhcpd.h >index 12ed2ba..2c0638d 100644 >--- a/includes/dhcpd.h >+++ b/includes/dhcpd.h >@@ -1153,6 +1153,9 @@ struct client_config { > int do_forward_update; /* If nonzero, and if we have the > information we need, update the > A record for the address we get. */ >+ int max_prefix; /* maximum ipv6 prefix length to >+ request for lease, or 0 for no >+ limit (same as 128) */ > }; > > /* Per-interface state used in the dhcp client... */ >@@ -2684,6 +2687,7 @@ extern int nowait; > extern int wanted_ia_na; > extern int wanted_ia_ta; > extern int wanted_ia_pd; >+extern unsigned int ia_pd_max_prefix; > > extern const char *path_dhclient_conf; > extern const char *path_dhclient_db; >diff --git a/includes/dhctoken.h b/includes/dhctoken.h >index 6815da4..9694998 100644 >--- a/includes/dhctoken.h >+++ b/includes/dhctoken.h >@@ -364,7 +364,8 @@ enum dhcp_token { > GETHOSTBYNAME = 665, > PRIMARY6 = 666, > SECONDARY6 = 667, >- TOKEN_INFINIBAND = 668 >+ TOKEN_INFINIBAND = 668, >+ MAX_PREFIX = 669 > }; > > #define is_identifier(x) ((x) >= FIRST_TOKEN && \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 876791
:
850071
| 850891