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
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO(a.garipov): Use client_v2 for the frontend tests once Windows build is
# fixed.
'name': 'build'
# Permissions are disabled for all the jobs by default, and then overridden for
# specific jobs if needed. This is a recommended practice for security reasons,
Expand Down Expand Up @@ -64,7 +66,7 @@
'restore-keys': '${{ runner.os }}-node-'
- 'name': 'Run tests'
'shell': 'bash'
'run': 'make VERBOSE=1 deps test go-bench go-fuzz'
'run': 'make CLIENT_DIR=client VERBOSE=1 deps test go-bench go-fuzz'
- 'name': 'Upload coverage'
'uses': 'codecov/codecov-action@v1'
'if': "success() && matrix.os == 'ubuntu-latest'"
Expand Down
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ See also the [v0.107.79 GitHub milestone][ms-v0.107.79].
NOTE: Add new changes BELOW THIS COMMENT.
-->

### Added

- New property `"language"` in `POST /control/install/check_config` and `POST /control/install/configure` HTTP APIs.

- The user is able to remove the static lease's hostname via the HTTP API.

### Changed

- The `edge` channel has been switched to the new UI and versioning scheme.

### Fixed

- Blocked requests without an EDNS(0) OPT record ([#8183]).

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

<!--
NOTE: Add new changes ABOVE THIS COMMENT.
-->
Expand Down Expand Up @@ -62,8 +78,6 @@ See also the [v0.107.78 GitHub milestone][ms-v0.107.78].

- The `filtering` object of the YAML configuration now includes a new property, `max_http_size`, which defines the maximum size of the HTTP request for rulelists. To disable the limitation, set a large size, such as `1 TB`.

### Fixed

- Invalid AA flag in DNS responses ([#7955]).

- The parsing of the `ech` parameter in DNS rewrite rules for the HTTPS record type ([#8276]).
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ GO.MACRO = $${GO:-go}
VERBOSE.MACRO = $${VERBOSE:-0}

CHANNEL = development
# TODO(ik): Update CLIENT_DIR to client_v2 for new frontend migration
CLIENT_DIR = client
CLIENT_DIR = client_v2
DEPLOY_SCRIPT_PATH = not/a/real/path
DIST_DIR = dist
GOAMD64 = v1
Expand Down
22 changes: 13 additions & 9 deletions bamboo-specs/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# flaky test suite.
'cacheBuster': '0'
'channel': 'edge'
'clientDir': 'client_v2'
'dockerFrontend': 'adguard/home-js-builder:4.0'
'dockerGo': 'adguard/go-builder:1.26.5--1'

Expand Down Expand Up @@ -67,8 +68,9 @@
docker info

docker build \
--build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \
--build-arg "BASE_IMAGE=${bamboo_dockerFrontend}" \
--build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \
--build-arg "CLIENT_DIR=${bamboo_clientDir}" \
--output '.' \
--progress 'plain' \
--target 'builder-exporter' \
Expand Down Expand Up @@ -104,7 +106,7 @@
set -e -f -u -x

# Explicitly checkout the revision that we need.
git checkout "${bamboo.repository.revision.number}"
git checkout "${bamboo_repository_revision_number}"

version="$(env CHANNEL=${bamboo_channel} sh ./scripts/make/version.sh)"
readonly version
Expand Down Expand Up @@ -160,8 +162,8 @@

# Login to DockerHub.
docker login \
-u="${bamboo.dockerHubUsername}" \
-p="${bamboo.dockerHubPassword}"
-u="${bamboo_dockerHubUsername}" \
-p="${bamboo_dockerHubPassword}"

# Boot the builder.
docker buildx inspect --bootstrap
Expand All @@ -172,8 +174,8 @@

# Prepare and push the build.
env \
CHANNEL="${bamboo.channel}" \
REVISION="${bamboo.repository.revision.number}" \
CHANNEL="${bamboo_channel}" \
REVISION="${bamboo_repository_revision_number}" \
DIST_DIR='dist' \
DOCKER_IMAGE_NAME='adguard/adguardhome' \
DOCKER_PUSH='1' \
Expand Down Expand Up @@ -202,7 +204,7 @@

cd ./dist/

CHANNEL="${bamboo.channel}"
CHANNEL="${bamboo_channel}"
export CHANNEL

../bamboo-deploy-publisher/deploy.sh adguard-home-"$CHANNEL"
Expand All @@ -227,7 +229,7 @@

set -e -f -u -x

channel="${bamboo.channel}"
channel="${bamboo_channel}"
readonly channel

if [ "$channel" != 'release' ] && [ "${channel}" != 'beta' ]
Expand All @@ -240,7 +242,7 @@
cd ./dist/

env\
GITHUB_TOKEN="${bamboo.githubPublicRepoPassword}"\
GITHUB_TOKEN="${bamboo_githubPublicRepoPassword}"\
../bamboo-deploy-publisher/deploy.sh adguard-home-github

'triggers':
Expand Down Expand Up @@ -279,6 +281,7 @@
# need to build a few of these.
'variables':
'channel': 'beta'
'clientDir': 'client'
'dockerFrontend': 'adguard/home-js-builder:4.0'
'dockerGo': 'adguard/go-builder:1.26.5--1'
# release-vX.Y.Z branches are the branches from which the actual final
Expand All @@ -295,5 +298,6 @@
# are the ones that actually get released.
'variables':
'channel': 'release'
'clientDir': 'client'
'dockerFrontend': 'adguard/home-js-builder:4.0'
'dockerGo': 'adguard/go-builder:1.26.5--1'
13 changes: 9 additions & 4 deletions bamboo-specs/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# flaky test suite.
'cacheBuster': '0'
'channel': 'development'
'clientDir': 'client_v2'
'dockerFrontend': 'adguard/home-js-builder:4.0'
'dockerGo': 'adguard/go-builder:1.26.5--1'

Expand Down Expand Up @@ -58,8 +59,9 @@
docker info

docker build \
--build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \
--build-arg "BASE_IMAGE=${bamboo_dockerFrontend}" \
--build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \
--build-arg "CLIENT_DIR=${bamboo_clientDir}" \
--output '.' \
--progress 'plain' \
--target 'tester' \
Expand Down Expand Up @@ -127,8 +129,9 @@
docker info

docker build \
--build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \
--build-arg "BASE_IMAGE=${bamboo_dockerFrontend}" \
--build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \
--build-arg "CLIENT_DIR=${bamboo_clientDir}" \
--output '.' \
--progress 'plain' \
--target 'builder-exporter' \
Expand Down Expand Up @@ -216,8 +219,9 @@
docker info

docker build \
--build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \
--build-arg "BASE_IMAGE=${bamboo_dockerFrontend}" \
--build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \
--build-arg "CLIENT_DIR=${bamboo_clientDir}" \
--output '.' \
--progress 'plain' \
--target 'e2etester' \
Expand Down Expand Up @@ -254,6 +258,7 @@
# Set the default release channel on the release branch to beta, as we
# may need to build a few of these.
'variables':
'channel': 'candidate'
'clientDir': 'client'
'dockerFrontend': 'adguard/home-js-builder:4.0'
'dockerGo': 'adguard/go-builder:1.26.5--1'
'channel': 'candidate'
16 changes: 14 additions & 2 deletions docker/frontend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

# NOTE: Keep in sync with bamboo-specs/bamboo.yaml.
ARG BASE_IMAGE=adguard/home-js-builder:4.0
ARG CLIENT_DIR=client

# The dependencies stage is needed to install packages and tool dependencies.
# This is also where binaries like osslsigncode, which may be required for tests
Expand All @@ -38,13 +39,15 @@ ARG BASE_IMAGE=adguard/home-js-builder:4.0
FROM "$BASE_IMAGE" AS dependencies
ADD Makefile /app/
ADD scripts /app/scripts
ADD client /app/client
ARG CLIENT_DIR
ADD "${CLIENT_DIR}" "/app/${CLIENT_DIR}"
WORKDIR /app
RUN \
--mount=type=cache,id=npm-root-cache,target=/root/.npm \
<<-'EOF'
set -e -f -u -x
make \
CLIENT_DIR="${CLIENT_DIR}" \
VERBOSE=1 \
js-deps \
;
Expand All @@ -53,14 +56,16 @@ EOF
# The linter stage is separated from the tester stage to make catching test
# failures easier.
FROM dependencies AS linter
ARG CACHE_BUSTER=0
ADD . /app
ARG CACHE_BUSTER=0
ARG CLIENT_DIR
WORKDIR /app
RUN \
--mount=type=cache,id=npm-root-cache,target=/root/.npm \
<<-'EOF'
set -e -f -u -x
make \
CLIENT_DIR="${CLIENT_DIR}" \
VERBOSE=1 \
js-typecheck \
js-lint \
Expand All @@ -70,11 +75,13 @@ EOF
# The test stage.
FROM linter AS tester
ARG CACHE_BUSTER=0
ARG CLIENT_DIR
RUN \
--mount=type=cache,id=npm-root-cache,target=/root/.npm \
<<-'EOF'
set -e -f -u -x
make \
CLIENT_DIR="${CLIENT_DIR}" \
VERBOSE=1 \
js-test \
;
Expand All @@ -83,13 +90,15 @@ EOF
# The e2e test stage.
FROM dependencies AS e2etester
ARG CACHE_BUSTER=0
ARG CLIENT_DIR
ADD . /app
WORKDIR /app
RUN \
--mount=type=cache,id=npm-root-cache,target=/root/.npm \
<<-'EOF'
set -e -f -u -x
make \
CLIENT_DIR="${CLIENT_DIR}" \
CI='true' \
VERBOSE=1 \
js-test-e2e \
Expand All @@ -99,13 +108,15 @@ EOF
# The builder stage.
FROM dependencies AS builder
ARG CACHE_BUSTER=0
ARG CLIENT_DIR
ADD . /app
WORKDIR /app
RUN \
--mount=type=cache,id=npm-root-cache,target=/root/.npm \
<<-'EOF'
set -e -f -u -x
make \
CLIENT_DIR="${CLIENT_DIR}" \
VERBOSE=1 \
js-build \
;
Expand All @@ -115,4 +126,5 @@ EOF
# could be published. This stage should only be used in a CI.
FROM scratch AS builder-exporter
ARG CACHE_BUSTER=0
ARG CLIENT_DIR
COPY --from=builder /app/build /build
12 changes: 10 additions & 2 deletions internal/dhcpd/http_unix_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ func TestServer_HandleUpdateStaticLease(t *testing.T) {
IP: leaseV4IP,
Hostname: "updated-client-v4",
},
}, {
name: "update_v4_empty_hostname",
pos: leaseV4Pos,
lease: &leaseStatic{
HWAddr: leaseV4MAC,
IP: leaseV4IP,
Hostname: "",
},
}, {
name: "update_v4_ip",
pos: leaseV4Pos,
Expand Down Expand Up @@ -306,15 +314,15 @@ func TestServer_HandleUpdateStaticLease_validation(t *testing.T) {
IP: anotherV4IP,
Hostname: leaseV4Name,
},
want: "dhcpv4: updating static lease: ip address is not unique\n",
want: "dhcpv4: updating static lease: ip address: duplicated value\n",
}, {
name: "update_v4_same_name",
lease: &leaseStatic{
HWAddr: leaseV4MAC,
IP: leaseV4IP,
Hostname: anotherV4Name,
},
want: "dhcpv4: updating static lease: hostname is not unique\n",
want: "dhcpv4: updating static lease: hostname: duplicated value\n",
}}

for _, tc := range testCases {
Expand Down
36 changes: 14 additions & 22 deletions internal/dhcpd/v4_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,6 @@ func (s *v4Server) rmDynamicLease(lease *dhcpsvc.Lease) (err error) {
return nil
}

const (
// ErrDupHostname is returned by addLease, validateStaticLease when the
// modified lease has a not empty non-unique hostname.
ErrDupHostname = errors.Error("hostname is not unique")

// ErrDupIP is returned by addLease, validateStaticLease when the modified
// lease has a non-unique IP address.
ErrDupIP = errors.Error("ip address is not unique")
)

// addLease adds a dynamic or static lease.
func (s *v4Server) addLease(l *dhcpsvc.Lease) (err error) {
r := s.conf.ipRange
Expand All @@ -342,7 +332,7 @@ func (s *v4Server) addLease(l *dhcpsvc.Lease) (err error) {
// TODO(e.burkov): l must have a valid hostname here, investigate.
if l.Hostname != "" {
if _, ok := s.hostsIndex[l.Hostname]; ok {
return ErrDupHostname
return fmt.Errorf("hostname: %w", errors.ErrDuplicated)
}

s.hostsIndex[l.Hostname] = l
Expand Down Expand Up @@ -485,23 +475,25 @@ func (s *v4Server) validateStaticLease(l *dhcpsvc.Lease) (err error) {
return err
}

err = netutil.ValidateHostname(hostname)
if err != nil {
return fmt.Errorf("validating hostname: %w", err)
}
if hostname != "" {
err = netutil.ValidateHostname(hostname)
if err != nil {
return fmt.Errorf("hostname: %w", err)
}

dup, ok := s.hostsIndex[hostname]
if ok && !bytes.Equal(dup.HWAddr, l.HWAddr) {
return ErrDupHostname
dup, ok := s.hostsIndex[hostname]
if ok && !bytes.Equal(dup.HWAddr, l.HWAddr) {
return fmt.Errorf("hostname: %w", errors.ErrDuplicated)
}
}

dup, ok = s.ipIndex[l.IP]
l.Hostname = hostname

dup, ok := s.ipIndex[l.IP]
if ok && !bytes.Equal(dup.HWAddr, l.HWAddr) {
return ErrDupIP
return fmt.Errorf("ip address: %w", errors.ErrDuplicated)
}

l.Hostname = hostname

if gwIP := s.conf.GatewayIP; gwIP == l.IP {
return fmt.Errorf("can't assign the gateway IP %q to the lease", gwIP)
}
Expand Down
Loading
Loading