Skip to content

support IPv4/IPv6 dual-stack for admin_listen #13744

Description

@gjing1st

Description

Problem
deployment.admin.admin_listen currently only accepts a single {ip, port} object. Attempting the array form (to listen on both IPv4 and IPv6 on the same port):

listen:
  - ip: 0.0.0.0
    port: 9180
  - ip: "[::]"
    port: 9180

is silently ignored — APISIX falls back to the default 0.0.0.0:9180 (IPv4 only). Verified against current master source:

apisix/cli/ops.lua reads only admin_listen.ip / admin_listen.port scalars
apisix/cli/ngx_tpl.lua emits a single listen {* admin_server_addr *}; So there is no way to run the Admin API on a dual stack today.
Root cause
The address is built as one ip:port string; the template has no loop, and the port-conflict checker rejects reusing one port across addresses.

Proposal
Make admin_listen accept either the existing object or an array of {ip, port}. The CLI collects all addresses, the template emits one listen per address, and the port-conflict check allows the same port to be reused across addresses of the same service (required for dual-stack). Backward compatible with the single-object form.

Related
Supersedes / relates to #7972 (IPv6 on control plane, closed as not planned, no fix shipped).

I'd like to contribute a PR with this change plus a CLI test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions