Pull request 1840: 5752-unspec-ipv6
Merge in DNS/adguard-home from 5752-unspec-ipv6 to master Closes #5752. Squashed commit of the following: commit 654b808d17c6d2374b6be919515113b361fc5ff7 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Apr 21 18:11:34 2023 +0300 home: imp docs commit 28b4c36df790f1eaa05b11a1f0a7b986894d37dc Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Apr 21 16:50:16 2023 +0300 all: fix empty bind host
This commit is contained in:
parent
757ddb06f8
commit
620b51e3ea
|
@ -25,6 +25,11 @@ NOTE: Add new changes BELOW THIS COMMENT.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Unquoted IPv6 bind hosts with trailing colons erroneously considered
|
||||||
|
unspecified addresses are now properly validated ([#5752]).
|
||||||
|
|
||||||
|
**NOTE:** the Docker healthcheck script now also doesn't interpret the `""`
|
||||||
|
value as unspecified address.
|
||||||
- Incorrect `Content-Type` header value in `POST /control/version.json` and `GET
|
- Incorrect `Content-Type` header value in `POST /control/version.json` and `GET
|
||||||
/control/dhcp/interfaces` HTTP APIs ([#5716]).
|
/control/dhcp/interfaces` HTTP APIs ([#5716]).
|
||||||
- Provided bootstrap servers are now used to resolve the hostnames of plain
|
- Provided bootstrap servers are now used to resolve the hostnames of plain
|
||||||
|
@ -64,6 +69,7 @@ See also the [v0.107.29 GitHub milestone][ms-v0.107.29].
|
||||||
[#5712]: https://github.com/AdguardTeam/AdGuardHome/issues/5712
|
[#5712]: https://github.com/AdguardTeam/AdGuardHome/issues/5712
|
||||||
[#5721]: https://github.com/AdguardTeam/AdGuardHome/issues/5721
|
[#5721]: https://github.com/AdguardTeam/AdGuardHome/issues/5721
|
||||||
[#5725]: https://github.com/AdguardTeam/AdGuardHome/issues/5725
|
[#5725]: https://github.com/AdguardTeam/AdGuardHome/issues/5725
|
||||||
|
[#5752]: https://github.com/AdguardTeam/AdGuardHome/issues/5752
|
||||||
|
|
||||||
[ms-v0.107.29]: https://github.com/AdguardTeam/AdGuardHome/milestone/65?closed=1
|
[ms-v0.107.29]: https://github.com/AdguardTeam/AdGuardHome/milestone/65?closed=1
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
addrs[$2] = true
|
addrs[$2] = true
|
||||||
prev_line = FNR
|
prev_line = FNR
|
||||||
|
|
||||||
if ($2 == "0.0.0.0" || $2 == "\"\"" || $2 == "'::'") {
|
if ($2 == "0.0.0.0" || $2 == "'::'") {
|
||||||
# Drop all the other addresses.
|
# Drop all the other addresses.
|
||||||
delete addrs
|
delete addrs
|
||||||
addrs[""] = true
|
addrs[""] = true
|
||||||
|
|
|
@ -414,6 +414,22 @@ func getLogSettings() logSettings {
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validateBindHosts returns error if any of binding hosts from configuration is
|
||||||
|
// not a valid IP address.
|
||||||
|
func validateBindHosts(conf *configuration) (err error) {
|
||||||
|
if !conf.BindHost.IsValid() {
|
||||||
|
return errors.Error("bind_host is not a valid ip address")
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, addr := range conf.DNS.BindHosts {
|
||||||
|
if !addr.IsValid() {
|
||||||
|
return fmt.Errorf("dns.bind_hosts at index %d is not a valid ip address", i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// parseConfig loads configuration from the YAML file
|
// parseConfig loads configuration from the YAML file
|
||||||
func parseConfig() (err error) {
|
func parseConfig() (err error) {
|
||||||
var fileData []byte
|
var fileData []byte
|
||||||
|
@ -425,6 +441,13 @@ func parseConfig() (err error) {
|
||||||
config.fileData = nil
|
config.fileData = nil
|
||||||
err = yaml.Unmarshal(fileData, &config)
|
err = yaml.Unmarshal(fileData, &config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Don't wrap the error since it's informative enough as is.
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validateBindHosts(config)
|
||||||
|
if err != nil {
|
||||||
|
// Don't wrap the error since it's informative enough as is.
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,8 @@ func upgradeConfig() error {
|
||||||
|
|
||||||
err = yaml.Unmarshal(body, &diskConf)
|
err = yaml.Unmarshal(body, &diskConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Couldn't parse config file: %s", err)
|
log.Printf("parsing config file for upgrade: %s", err)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue