all: upd chlog, minimize diff to master

This commit is contained in:
Ainar Garipov 2022-01-28 17:44:10 +03:00
parent 119100924c
commit 4813b4de25
7 changed files with 36 additions and 45 deletions

View File

@ -27,11 +27,6 @@ and this project adheres to
--> -->
- Go 1.17 support. v0.109.0 will require at least Go 1.18 to build. - Go 1.17 support. v0.109.0 will require at least Go 1.18 to build.
## Fixed
- Unnecessarily complex hosts-related logic leading to infinite recursion in
some cases ([#4216]).
### Removed ### Removed
- Go 1.16 support. - Go 1.16 support.
@ -40,9 +35,14 @@ and this project adheres to
<!--
## [v0.107.4] - 2022-03-01 (APPROX.) ## [v0.107.4] - 2022-03-01 (APPROX.)
-->
### Fixed
- Unnecessarily complex hosts-related logic leading to infinite recursion in
some cases ([#4216]).
[#4216]: https://github.com/AdguardTeam/AdGuardHome/issues/4216

View File

@ -111,7 +111,7 @@ func discover4(iface *net.Interface, dstAddr *net.UDPAddr, hostname string) (ok
// is spoiled. // is spoiled.
// //
// It's also known that listening on the specified interface's address // It's also known that listening on the specified interface's address
// ignores broadcasted packets when reading. // ignores broadcast packets when reading.
var c net.PacketConn var c net.PacketConn
if c, err = listenPacketReusable(iface.Name, "udp4", ":68"); err != nil { if c, err = listenPacketReusable(iface.Name, "udp4", ":68"); err != nil {
return false, fmt.Errorf("couldn't listen on :68: %w", err) return false, fmt.Errorf("couldn't listen on :68: %w", err)

View File

@ -12,33 +12,33 @@ import (
func TestNullBool_UnmarshalJSON(t *testing.T) { func TestNullBool_UnmarshalJSON(t *testing.T) {
testCases := []struct { testCases := []struct {
name string name string
data []byte
wantErrMsg string wantErrMsg string
data []byte
want nullBool want nullBool
}{{ }{{
name: "empty", name: "empty",
data: []byte{},
wantErrMsg: "", wantErrMsg: "",
data: []byte{},
want: nbNull, want: nbNull,
}, { }, {
name: "null", name: "null",
data: []byte("null"),
wantErrMsg: "", wantErrMsg: "",
data: []byte("null"),
want: nbNull, want: nbNull,
}, { }, {
name: "true", name: "true",
data: []byte("true"),
wantErrMsg: "", wantErrMsg: "",
data: []byte("true"),
want: nbTrue, want: nbTrue,
}, { }, {
name: "false", name: "false",
data: []byte("false"),
wantErrMsg: "", wantErrMsg: "",
data: []byte("false"),
want: nbFalse, want: nbFalse,
}, { }, {
name: "invalid", name: "invalid",
data: []byte("flase"), wantErrMsg: `invalid nullBool value "invalid"`,
wantErrMsg: `invalid nullBool value "flase"`, data: []byte("invalid"),
want: nbNull, want: nbNull,
}} }}

View File

@ -130,21 +130,19 @@ func parseDHCPOption(s string) (opt dhcpv4.Option, err error) {
// prepareOptions builds the set of DHCP options according to host requirements // prepareOptions builds the set of DHCP options according to host requirements
// document and values from conf. // document and values from conf.
func prepareOptions(conf V4ServerConf) (opts dhcpv4.Options) { func prepareOptions(conf V4ServerConf) (opts dhcpv4.Options) {
opts = dhcpv4.Options{ // Set default values for host configuration parameters listed in Appendix
// Set default values for host configuration parameters listed // A of RFC-2131. Those parameters, if requested by client, should be
// in Appendix A of RFC-2131. Those parameters, if requested by // returned with values defined by Host Requirements Document.
// client, should be returned with values defined by Host
// Requirements Document.
// //
// See https://datatracker.ietf.org/doc/html/rfc2131#appendix-A. // See https://datatracker.ietf.org/doc/html/rfc2131#appendix-A.
// //
// See also https://datatracker.ietf.org/doc/html/rfc1122, // See also https://datatracker.ietf.org/doc/html/rfc1122,
// https://datatracker.ietf.org/doc/html/rfc1123, and // https://datatracker.ietf.org/doc/html/rfc1123, and
// https://datatracker.ietf.org/doc/html/rfc2132. // https://datatracker.ietf.org/doc/html/rfc2132.
opts = dhcpv4.Options{
// IP-Layer Per Host // IP-Layer Per Host
dhcpv4.OptionNonLocalSourceRouting.Code(): []byte{0}, dhcpv4.OptionNonLocalSourceRouting.Code(): []byte{0},
// Set the current recommended default time to live for the // Set the current recommended default time to live for the
// Internet Protocol which is 64, see // Internet Protocol which is 64, see
// https://datatracker.ietf.org/doc/html/rfc1700. // https://datatracker.ietf.org/doc/html/rfc1700.

View File

@ -27,7 +27,6 @@ type DHCPServer interface {
Start() (err error) Start() (err error)
// Stop - stop server // Stop - stop server
Stop() (err error) Stop() (err error)
getLeasesRef() []*Lease getLeasesRef() []*Lease
} }

View File

@ -969,11 +969,10 @@ func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DH
Port: dhcpv4.ServerPort, Port: dhcpv4.ServerPort,
} }
if mtype == dhcpv4.MessageTypeNak { if mtype == dhcpv4.MessageTypeNak {
// Set the broadcast bit in the DHCPNAK, so that the // Set the broadcast bit in the DHCPNAK, so that the relay agent
// relay agent broadcasted it to the client, because the // broadcasts it to the client, because the client may not have
// client may not have a correct network address or // a correct network address or subnet mask, and the client may not
// subnet mask, and the client may not be answering ARP // be answering ARP requests.
// requests.
resp.SetBroadcast() resp.SetBroadcast()
} }
case mtype == dhcpv4.MessageTypeNak: case mtype == dhcpv4.MessageTypeNak:

View File

@ -384,16 +384,15 @@ rerun_with_root() {
log 'restarting with root privileges' log 'restarting with root privileges'
# Group curl together with an echo, so that if curl fails before # Group curl together with an echo, so that if curl fails before producing
# producing any output, the echo prints an exit command for the # any output, the echo prints an exit command for the following shell to
# following shell to execute to prevent it from getting an empty input # execute to prevent it from getting an empty input and exiting with a zero
# and exiting with a zero code in that case. # code in that case.
{ curl -L -S -s "$script_url" || echo 'exit 1'; }\ { curl -L -S -s "$script_url" || echo 'exit 1'; }\
| $sudo_cmd sh -s -- -c "$channel" -C "$cpu" -O "$os" -o "$out_dir" "$r" "$u" "$v" | $sudo_cmd sh -s -- -c "$channel" -C "$cpu" -O "$os" -o "$out_dir" "$r" "$u" "$v"
# Exit the script. Since if the code of the previous pipeline is # Exit the script. Since if the code of the previous pipeline is non-zero,
# non-zero, the execution won't reach this point thanks to set -e, exit # the execution won't reach this point thanks to set -e, exit with zero.
# with zero.
exit 0 exit 0
} }
@ -483,11 +482,7 @@ handle_existing() {
# Function install_service tries to install AGH as service. # Function install_service tries to install AGH as service.
install_service() { install_service() {
# Installing as root is required at least on FreeBSD. if ( cd "$agh_dir" && ./AdGuardHome -s install )
#
# TODO(e.burkov): Think about AGH's output suppressing with no verbose
# flag.
if ( cd "$agh_dir" && $sudo_cmd ./AdGuardHome -s install )
then then
return 0 return 0
fi fi