Skip to content

[Bug]: IS_IPV4_COMPAT misclassifies the IPv6 loopback address #28217

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

#23043 was the closed implementation request; no issue covers the reserved ::1 boundary.

Branch Name

main

Commit ID

e7bb0572235ec4bac81eb098eb0ad8900f0065ab

Other Environment Information

  • Local standalone MatrixOne; reference MySQL 8.3.0

Actual Behavior

IS_IPV4_COMPAT() classifies the IPv6 loopback address ::1 as IPv4-compatible:

SELECT IS_IPV4_COMPAT(INET6_ATON('::1'));
-- MatrixOne: 1
-- MySQL:    0

SELECT IS_IPV4_COMPAT(UNHEX('00000000000000000000000000000001'));
-- MatrixOne: 1
-- MySQL:    0

The result is stable across three runs.

Expected Behavior

The reserved IPv6 loopback address ::1 is not an IPv4-compatible address and must return 0. Valid values such as ::192.168.1.1 must continue to return 1.

Steps to Reproduce

SELECT IS_IPV4_COMPAT(INET6_ATON('::1'));
SELECT IS_IPV4_COMPAT(UNHEX('00000000000000000000000000000001'));

Additional information

isIPv4Compat currently accepts any 16-byte value with twelve zero prefix bytes except all-zero ::; it does not exclude the reserved loopback value ::1.

Activity

  1. added this to the MO-202609 milestone on Sep 5, 2026
  2. added
    kind/bug
    on Sep 5, 2026
  3. added theissue type on Sep 5, 2026
  4. self-assigned this
    on Sep 5, 2026
  5. Ariznawlll commented on Sep 12, 2026

    @Ariznawlll
    CollaboratorAuthor

    在当前 main 6875e4203519de1ed98b842c1cbc8c57f11dc326 上补充覆盖了常量、列值、PreparedStatement 和两 CN,::1 都被 IS_IPV4_COMPAT 判为 1,三轮结果一致:

    SELECT IS_IPV4_COMPAT(INET6_ATON('::1'));
    -- MatrixOne: 1
    -- MySQL 8.3: 0

    对等的 16 字节二进制值 UNHEX('00000000000000000000000000000001') 也得到 MatrixOne 1、MySQL 0。::192.0.2.1 仍为 1,普通 IPv4、IPv4-mapped IPv6 和普通 IPv6 为 0,因此边界集中在保留的 loopback 值 ::1。

  6. XuPeng-SH commented on Sep 12, 2026

    @XuPeng-SH
    Contributor

    PR #28800 tightens IPv4-compatible classification to exclude the reserved :: and ::1 values while retaining the valid payload boundary beginning at ::2. Boundary and SQL regression coverage is included. The PR is open; local UT/BVT were not run because the isolated worktree lacks provenance-validated CGo artifacts, and exact-head CI is still running.

  7. added a commit that references this issue on Sep 15, 2026
    f0f61f0
  8. Ariznawlll commented on Sep 15, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • MatrixOne main:0c3a04f390adaf6281fd592a49778ea5b1155e67
    • 本地 standalone(1 CN / 1 TN / 1 LogService),2026-09-15。

    原问题验证

    IS_IPV4_COMPAT('::1') 当前返回 0,IPv6 loopback 不再被误判为 IPv4-compatible。

    Happy Path 覆盖

    覆盖 IPv4-compatible ::192.168.1.1 与 IPv4-mapped ::ffff:192.168.1.1 的正确分类。

    Unhappy Path 覆盖

    覆盖 loopback ::1,断言其 incompatible/mapped 判断均为 0。

    白盒验证

    不适用:公开 SQL 函数结果已直接覆盖。

    回归测试

    已加入 MOTR:issue_28214_28217_ipv4_semantics,见 motr#176。

    测试证据

    新 MOTR 用例连续运行 3 轮成功;IPv4-compatible、mapped 和 loopback 分类均符合预期。

    测试结论

    测试通过。

  9. added 3 commits that reference this issue on Sep 17, 2026
    110e659
    0f3d83f
    5119681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions