No appropriate Opt type for configuration options that take both IP addresses (IPv4, IPv6) and hostnames
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| oslo.config |
Fix Released
|
Undecided
|
Dharini Chandrasekar | ||
Bug Description
There is no Opt type to use for configuration options that take both hostnames and IP addresses (IPv4, IPv6).
1. Using ``IPOpt`` restricts operators from providing a hostname.
2. If using ``HostnameOpt`` type, even an incomplete or invalid IP passes as a valid hostname. For example: 10.0.0 passes as a hostname.
Also, ``HostnameOpt`` type does not accept IPv6 addresses.
So for configuration options that might have any of these 3 (IPv4 address, IPv6 address and hostname), developers are to use ``StrOpt`` which does not perform any validation of hostname or IP addresses.
Modifying HostnameOpt to accommodate IPv6 addresses would cause it to accept incorrect hostnames.
Also to validate an IPv4 address, it should not have any character and must be of a valid IPv4 type while a hostname must allow characters of course.
Hence to ensure that we do not break the existing functionality of any opt type and at the same time validate host addresses accurately, we need to extend the functionality of both IPOpt and HostnameOpt.
| Changed in oslo.config: | |
| assignee: | nobody → Dharini Chandrasekar (dharini-chandrasekar) |
| Changed in oslo.config: | |
| status: | New → In Progress |
Reviewed: https:/ /review. openstack. org/358045 /git.openstack. org/cgit/ openstack/ oslo.config/ commit/ ?id=babff882c07 94fab81665744bc c1aa155b90eed2
Committed: https:/
Submitter: Jenkins
Branch: master
commit babff882c0794fa b81665744bcc1aa 155b90eed2
Author: Dharini Chandrasekar <email address hidden>
Date: Fri Aug 19 18:34:18 2016 +0000
Fixing HostName and adding support for HostAddress
When config options in different projects use IPOpt as the opt's
type, it restricts operators to only IP addresses.
When the opt is set to HostnameOpt type, currently even an
incomplete or invalid IP passes as a valid hostname. Also, currently
HostnameOpt does not make sure that there is a presense of at least one
non-numeric character in the provided host name.
According to RFC 1123, (https:/ /tools. ietf.org/ html/rfc1123),
a valid host name can never have the dotted-decimal form #.#.#.#,
since at least the highest-level component label will be alphabetic.
This patch fixes the existing Hostname Opt to abide by the stated RFC sOpt" type. This would ensure that an invalid IP does
and also adds a new opt type that would enable operators to provide
either a hostname or an IP and at the same time perform checks on
both IPOpt type and HostnameOpt type, by setting opt type to
"HostAddres
not pass as a valid hostname and at the same time retains the rules
required to be followed for the validation of an acceptable hostname.
Change-Id: I77bdb64b7e6e56 ce761d76696bc44 48a9bd325eb
Closes-Bug: #1619044
Closes-Bug: #1615028