Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow-dup-ip is ignored if server has resolvers and backend has default-server #2559

Open
sigint2 opened this issue May 6, 2024 · 2 comments
Labels
2.0 This issue affects the HAProxy 2.0 stable branch. 2.2 This issue affects the HAProxy 2.2 stable branch. 2.4 This issue affects the HAProxy 2.4 stable branch. 2.6 This issue affects the HAProxy 2.6 stable branch. 2.8 This issue affects the HAProxy 2.8 stable branch. 2.9 This issue affects the HAProxy 2.9 stable branch. status: fixed This issue is a now-fixed bug. type: bug This issue describes a bug.

Comments

@sigint2
Copy link

sigint2 commented May 6, 2024

Detailed Description of the Problem

Hi -- I noticed that allow-dup-ip is ignored when:

  • a server has a resolvers associated with it ( either explicitly, or via a default ), AND
  • the backend that the server belongs to has a default-server line in it.

Expected Behavior

That the global default-server resolve-opts are not reset by a default-server in a backend.

Steps to Reproduce the Behavior

The following config should illustrate the behavior:

  • the backend level default-server backup is applied to all servers
  • the global defaults weight 42 is applied to all servers.
  • the global defaults field resolve-opts allow-dup-ip is not applied ( stats page shows server app2 in maintenance mode )
resolvers test
    parse-resolv-conf

defaults
    mode tcp
    default-server resolvers test resolve-opts allow-dup-ip weight 42

frontend foo
    bind 127.0.0.1:9999
    use_backend bar

backend bar
    default-server backup
    server app1 localhost:9999 no-check
    server app2 localhost:9990 no-check

the weight of the servers is overridden with 42

Do you have any idea what may have caused this?

In src/server.c the resolve opts seem to get reset to hard-coded values when the above conditions are met, the other option that is reset is resolve-prefer .

    else {
        *srv = newsrv = &curproxy->defsrv;
        *cur_arg = 1;
        newsrv->resolv_opts.family_prio = AF_INET6;
        newsrv->resolv_opts.accept_duplicate_ip = 0;
    }

Do you have an idea how to solve the issue?

No response

What is your configuration?

resolvers test
    parse-resolv-conf

defaults
    mode tcp
    default-server resolvers test resolve-opts allow-dup-ip weight 42

frontend foo
    bind 127.0.0.1:9999
    use_backend bar

backend bar
    default-server backup
    server app1 localhost:9999 no-check
    server app2 localhost:9990 no-check

Output of haproxy -vv

( cannot paste ) -- tested on standard builds of 2.6.15, and 3.0-dev10

Last Outputs and Backtraces

No response

Additional Information

No response

@sigint2 sigint2 added status: needs-triage This issue needs to be triaged. type: bug This issue describes a bug. labels May 6, 2024
@capflam
Copy link
Member

capflam commented May 7, 2024

Indeed, it seems you're right. There is no reason to reset resolve options when a default-server line is parsed.

@capflam capflam added dev This issue affects the HAProxy development branch. status: reviewed This issue was reviewed. A fix is required. 2.0 This issue affects the HAProxy 2.0 stable branch. 2.2 This issue affects the HAProxy 2.2 stable branch. 2.4 This issue affects the HAProxy 2.4 stable branch. 2.6 This issue affects the HAProxy 2.6 stable branch. 2.8 This issue affects the HAProxy 2.8 stable branch. 2.9 This issue affects the HAProxy 2.9 stable branch. and removed status: needs-triage This issue needs to be triaged. labels May 7, 2024
haproxy-mirror pushed a commit that referenced this issue May 24, 2024
…er line

When a new "default-server" line is parsed, some resolver options are reset.
Thus previously defined default options cannot be inherited. There is no
reason to do so. First because other server options are inherited. And then
because not all resolver options are reset. It is not consistent.

This patch should fix issue #2559. It should be backported to all stable
versions.
@capflam
Copy link
Member

capflam commented May 24, 2024

Fixed now, thanks !

@capflam capflam added status: fixed This issue is a now-fixed bug. and removed dev This issue affects the HAProxy development branch. status: reviewed This issue was reviewed. A fix is required. labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 This issue affects the HAProxy 2.0 stable branch. 2.2 This issue affects the HAProxy 2.2 stable branch. 2.4 This issue affects the HAProxy 2.4 stable branch. 2.6 This issue affects the HAProxy 2.6 stable branch. 2.8 This issue affects the HAProxy 2.8 stable branch. 2.9 This issue affects the HAProxy 2.9 stable branch. status: fixed This issue is a now-fixed bug. type: bug This issue describes a bug.
Projects
None yet
Development

No branches or pull requests

2 participants