Skip to content

Sorting by Answer column, in DNS Rewrites tab, doesn't work correctly if CNAME and IP addresses present. #6320

Closed as not planned
@grogi

Description

@grogi

Prerequisites

Platform (OS and CPU architecture)

Linux, AMD64 (aka x86_64)

Installation

Docker

Setup

On one machine

AdGuard Home version

v0.107.38

Action

Inside the DNS Rewrites column, the table enables users to sort, which doesn't work properly.

Add 3 DNS Rewrite entries:

  • a.example.com -> 10.1.1.3
  • b.example.com -> 10.1.1.5
  • c.example.com -> b.example.com
  • d.example.com -> 10.1.1.1

Try sorting by the Answer column. The data is not sorted by .

image

Expected result

The table contents sorted in consistent way.

  • CNAME entries sorted alphabetically
  • IPv4 and IPv6 address sorted
  • CNAME entries before or after IP addresses (doesn't matter which, as long as it is consistent)

Actual result

The table contents is not sorted in any particular order. The IPv4 and CNAME addresses are mixed together.

Additional information and/or screenshots

When trying to perform the sort, the JavaScript console complains:

image

I think the core of the issue is in here helpers.js:getAddressesComparisonBytes function. It tries to parse the answer either as CIDR or IP address, when some of the values are CNAME. This causes an exception and sorting is dropped.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions