Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ See also the [v0.107.78 GitHub milestone][ms-v0.107.78].
NOTE: Add new changes BELOW THIS COMMENT.
-->

### Added

- Improved updater logging to give users more insight into the problem with version updating ([#8410]).

[#8410]: https://github.com/AdguardTeam/AdGuardHome/issues/8410

### Security

- Go version has been updated to prevent the possibility of exploiting the Go vulnerabilities fixed in [1.26.4][go-1.26.4].
Expand All @@ -32,6 +26,12 @@ NOTE: Add new changes BELOW THIS COMMENT.

- The size of rulelists is limited. This is necessary to prevent a user's machine from becoming overloaded if the filter source misbehaves.

### Added

- Improved updater logging to give users more insight into the problem with version updating ([#8410]).

[#8410]: https://github.com/AdguardTeam/AdGuardHome/issues/8410

### Changed

- The interval of filter updates can now be set to any number of ours between 0 and 365 days in the configuration file.
Expand All @@ -42,10 +42,13 @@ NOTE: Add new changes BELOW THIS COMMENT.

### Fixed

- The parsing of the `ech` parameter in DNS rewrite rules for the HTTPS record type ([#8276]).

- Blocked services check on the Custom filtering rules page does not work properly without specifying of a client.

[rfc9113]: https://datatracker.ietf.org/doc/html/rfc9113
[#8276]: https://github.com/AdguardTeam/AdGuardHome/issues/8276
[go-1.26.4]: https://groups.google.com/g/golang-announce/c/tKs3rmcBcKw
[rfc9113]: https://datatracker.ietf.org/doc/html/rfc9113

<!--
NOTE: Add new changes ABOVE THIS COMMENT.
Expand Down
97 changes: 86 additions & 11 deletions internal/dhcpsvc/dhcpsvc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ const testTimeout = 10 * time.Second
// testLeaseTTL is the lease duration used in tests.
const testLeaseTTL = 24 * time.Hour

// testXid is a common transaction ID for DHCPv4 tests.
const testXid = 1

// testLogger is a common logger for tests.
var testLogger = slogutil.NewDiscardLogger()

Expand Down Expand Up @@ -102,11 +99,15 @@ const (
const (
// testRangeStartV6Str is the string representation of the range start of
// the IPv6 interface used in tests.
testRangeStartV6Str = "2001:db8::1"
testRangeStartV6Str = "2001:db8::2"

// testAnotherRangeStartV6Str is the string representation of the range
// start of the second IPv6 interface used in tests.
testAnotherRangeStartV6Str = "2001:db9::1"

// testIfaceAddrV6Str is the string representation of the interface's IPv6
// address used in tests.
testIfaceAddrV6Str = "2001:db8::1"
)

var (
Expand All @@ -133,10 +134,23 @@ var (
RASLAACOnly: true,
}

// testIfaceAddr is a common valid IPv4 address of the test network
// disabledIPv4Conf is a configuration of IPv4 part of the interfaces
// configuration that is disabled.
disabledIPv4Conf = &dhcpsvc.IPv4Config{Enabled: false}

// disabledIPv6Conf is a configuration of IPv6 part of the interfaces
// configuration that is disabled.
disabledIPv6Conf = &dhcpsvc.IPv6Config{Enabled: false}

// testIfaceAddrV4 is a common valid IPv4 address of the test network
// interface, compliant with [testIPv4Conf], i.e. outside of the range,
// within the subnet, not equal to the gateway.
testIfaceAddr = netip.MustParseAddr(testIfaceAddrV4Str)
testIfaceAddrV4 = netip.MustParseAddr(testIfaceAddrV4Str)

// testIfaceAddrV6 is a common valid IPv6 address of the test network
// interface, compliant with [testIPv6Conf], i.e. outside of the range,
// within the subnet, not equal to the gateway.
testIfaceAddrV6 = netip.MustParseAddr(testIfaceAddrV6Str)

// testIfaceHWAddr is a common valid hardware address of the test network
// interface.
Expand Down Expand Up @@ -171,19 +185,44 @@ var testInterfaceConf = map[string]*dhcpsvc.InterfaceConfig{
},
}

// disabledIPv6Config is a configuration of IPv6 part of the interfaces
// configuration that is disabled.
var disabledIPv6Config = &dhcpsvc.IPv6Config{Enabled: false}
// Hardware addresses for test cases.
//
// NOTE: Keep in sync with testdata.
var (
// testHWUnknown is the test MAC address for an unknown client.
testHWUnknown = net.HardwareAddr{0x0, 0x1, 0x2, 0x3, 0x4, 0x5}

// fullLayersStack is the complete stack of layers expected to appear in the
// testHWStatic is the test MAC address for a known static lease.
testHWStatic = net.HardwareAddr{0x1, 0x2, 0x3, 0x4, 0x5, 0x6}

// testHWDynamic is the test MAC address for a known dynamic lease.
testHWDynamic = net.HardwareAddr{0x2, 0x3, 0x4, 0x5, 0x6, 0x7}

// testHWExpired is the test MAC address for a known expired lease.
testHWExpired = net.HardwareAddr{0x3, 0x4, 0x5, 0x6, 0x7, 0x8}

// testHWAnother is the test MAC address for a lease with another IP.
testHWAnother = net.HardwareAddr{0x4, 0x5, 0x6, 0x7, 0x8, 0x9}
)

// fullLayersStack4 is the complete stack of layers expected to appear in the
// DHCP response packets.
var fullLayersStack = []gopacket.LayerType{
var fullLayersStack4 = []gopacket.LayerType{
layers.LayerTypeEthernet,
layers.LayerTypeIPv4,
layers.LayerTypeUDP,
layers.LayerTypeDHCPv4,
}

// fullLayersStack6 is the complete stack of layers expected to appear in the
// DHCPv6 response packets.
var fullLayersStack6 = []gopacket.LayerType{
layers.LayerTypeEthernet,
layers.LayerTypeIPv6,
layers.LayerTypeUDP,
layers.LayerTypeDHCPv6,
}

// newTempDB copies the leases database file located in the testdata FS, under
// tb.Name()/leases.json, to a temporary directory and returns the path to the
// copied file.
Expand Down Expand Up @@ -235,3 +274,39 @@ func newTestDHCPServer(tb testing.TB, conf *dhcpsvc.Config) (srv *dhcpsvc.DHCPSe
func startTestDHCPServer(tb testing.TB, conf *dhcpsvc.Config) {
servicetest.RequireRun(tb, newTestDHCPServer(tb, conf), testTimeout)
}

// newTestPacket creates a valid packet from ls using first as first layer
// decoder.
func newTestPacket(
tb testing.TB,
first gopacket.Decoder,
ls ...gopacket.SerializableLayer,
) (pkg gopacket.Packet) {
tb.Helper()

buf := gopacket.NewSerializeBuffer()

opts := gopacket.SerializeOptions{
FixLengths: true,
ComputeChecksums: true,
}
err := gopacket.SerializeLayers(buf, opts, ls...)
require.NoError(tb, err)

return gopacket.NewPacket(buf.Bytes(), first, gopacket.Default)
}

// assertNoResponse asserts that no response is received on the channel within
// the timeout.
//
// TODO(e.burkov): Improve the helper to not rely on timeout.
func assertNoResponse(tb testing.TB, outCh <-chan []byte, timeout time.Duration) {
tb.Helper()

var resp []byte
require.Panics(tb, func() {
resp, _ = testutil.RequireReceive(testutil.NewPanicT(tb), outCh, timeout)
})

require.Nil(tb, resp)
}
Loading
Loading