net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directive

Open Beginner friendly
#5,973 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
php
Domain
backend

Research direction

Start in the os-haproxy plugin code that validates the real server “Source address” field and generates its HAProxy server directive; the issue does not name specific files, so search for that field and the source directive. Check how IPv6 literals are recognized and whether the generated value is bracketed. Done when an IPv6 source address passes validation, produces HAProxy’s bracketed form, and the configuration test succeeds.

Written by the indexing model from the issue text.

Description

incomplete

Describe the bug

Setting an IPv6 address in the "Source address" field of a real server produces a source directive that HAProxy rejects, so the configuration test fails and the service cannot be reloaded.

The plugin writes the address expanded and without brackets. HAProxy treats everything after the last colon as the port.

To Reproduce

  1. Services → HAProxy → Real Servers: create a server with an IPv6 address (e.g. fd00:445d:0:4f::eb1, port 443).
  2. Enable advanced mode and set "Source address" to fd00:445d:0:4f::fe.
  3. Add the server to a backend pool and run the config test.

Generated line:

server hu-web1_HTTPS6 fd00:445d:0:4f::eb1:443 source fd00:445d:0000:004f:0000:0000:0000:00fe send-proxy-v2 check-send-proxy

Result:

[ALERT] config : [/usr/local/etc/haproxy.conf.staging:453] : 'server wp.hmu.com.ar_HTTPS/hu-web1_HTTPS6' : 'source fd00:445d:0000:004f:0000:0000:0000:00fe' : invalid character 'f' in port number '00fe' in 'fd00:445d:0000:004f:0000:0000:0000:00fe'.
[ALERT] config : Fatal errors found in configuration.

Entering the address with brackets ([fd00:445d:0:4f::fe]) is rejected by the form validation ("Please specify a valid source address, i.e. 10.0.0.1 or loadbalancer.example.com:50000…").

image

Expected behavior

An IPv6 source address should be written in bracketed form, which HAProxy accepts:

source [fd00:445d:0:4f::fe]

Either the template could add the brackets for IPv6 literals, or the field validation could accept bracketed input.

Workaround

Leave "Source address" empty and put source [fd00:445d:0:4f::fe] in the server's "Option pass-through" field. The config test passes with that.

Environment

  • OPNsense 26.7.8_2-amd64
  • os-haproxy 5.1
  • HAProxy 3.2.26-3e0f11a
Dominant language
PHP
Stars
1.2k
Forks
926
Avg merge
1d 10h
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opnsense/plugins

All issues in opnsense/plugins

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.