Support multiple bind addresses for dual-stack (IPv4 + IPv6)

Aberta
#983 1 comentário 2 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
35/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
ruby, yaml

Direção de pesquisa

Start by locating the HAProxy job templates and specs that render every use of ha_proxy.binding_ip, including HTTP, HTTPS, WSS, health-check, and TCP bindings. Compare the proposed binding_ips behavior with the existing v4v6 rendering; completion should apply validated addresses across all bind sites and ensure IPv6 entries generate the intended v6only setting.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

stale

Problem

The current ha_proxy.binding_ip property accepts a single scalar address. Combined with ha_proxy.v4v6: true, it enables dual-stack by creating one IPv6 socket that also accepts IPv4 connections via the kernel's IPv4-mapped IPv6 mechanism (::ffff:x.x.x.x).

This has two drawbacks:

  1. IPv4-mapped addresses in logs -- All IPv4 client addresses appear as ::ffff:10.x.x.x because they arrive through the IPv6 socket. This may affect log parsing, ACL matching, and monitoring tools that expect plain IPv4 addresses.

  2. No separate socket option -- Some environments my require distinct IPv4 and IPv6 sockets (e.g., for independent firewall rules, clean logging, or compliance). The only workaround today is ha_proxy.frontend_config, which is fragile because it applies to all frontends, requires manually duplicating TLS/ALPN/mTLS options, and forces disabling the HTTP frontend to avoid port conflicts.

Related bug

ha_proxy.v4v6 uses if_p (presence check) instead of checking the Boolean value. Since the property defaults to false, binding_ip: "::" always renders v4v6 regardless of the property value. On most Linux stemcells this is masked by the kernel default (net.ipv6.bindv6only=0), but it is incorrect behavior.

Options

Option A: Flat address list (implemented on branch)
  • Auto-detects IPv4 vs IPv6 via IPAddr and applies v6only on IPv6 entries
  • Makes IPv6 addresses explicitly IPv6 only
  • Global scope: replaces binding_ip at all generated bind sites (HTTP, HTTPS, WSS, health checks, TCP routing, generic TCP)
  • Validates for type, duplicates, and invalid IPs
  • Rejects combination with v4v6: true
  • Simplest API for the dominant use case (0.0.0.0 + ::)
  • No explicit control over v4v6 vs v6only per address
ha_proxy:
  binding_ips:
  - 0.0.0.0
  - "::"
Option B: Per-family lists
  • Explicit control: operator chooses v4v6 or v6only per IPv6 address
  • More complex API and validation (combinatorial: what if same address in multiple lists? IPv4 in v6only?)
  • v4v6 list alongside v4 list creates overlapping socket ownership
  • Less ergonomic in BOSH ops files (nested properties)
ha_proxy:
  binding_ips:
    v4:
    - 0.0.0.0
    v4v6:
    - "::"
    v6only:
    - "::"
Option C: Flat list + mode flag
  • Keeps the simple flat list
  • Adds a single property to override the IPv6 socket behavior globally
  • Covers the rare case where v4v6 is desired on listed IPv6 addresses
  • Minimal additional complexity
ha_proxy:
  binding_ips:
  - 0.0.0.0
  - "::"
  binding_ips_v6_mode: v6only  # default, or "v4v6"
Recommendation

Option A (flat list) covers ~95% of real-world usage. Option C is a reasonable extension if explicit v4v6 control is ever needed. Option B adds complexity without a clear use case that justifies it.

+++ Additional Remarks +++

When binding_ip is set to :: and the v4v6 flag is not set or false the configuration / acceptance of IPv4 traffic depends on the kernel / stemcell configuration. This makes it non-deterministic whether IPv4 traffic is accepted when binding ::.

Proposal

When binding_ip is set to :: and the v4v6 flag is not set or false only accept IPv6 traffic by setting the v6only flag.
+++ This is can be a breaking change +++

Linguagem predominante
Ruby
Estrelas
36
Forks
84
Merge médio
2d 6h
PRs com merge (30d)
11

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Issues semelhantes

Mais issues de Ruby

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.