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

Aperta
#983 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ruby, yaml

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 +++

Lingua principale
Ruby
Stelle
36
Fork
84
Merge medio
2g 6h
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.