Set server name implementation#11
Open
alexanderstephan wants to merge 7 commits intomasterfrom
Open
Conversation
Garfield96
reviewed
Apr 10, 2026
Garfield96
left a comment
There was a problem hiding this comment.
Please also add a test case similar to https://github.com/haproxy/haproxy/blob/master/reg-tests/server/cli_add_server.vtc for this functionality.
Comment on lines
+59
to
+60
| #include <haproxy/stick_table-t.h> | ||
| #include <haproxy/peers-t.h> |
| if (rule->table.t && rule->table.t->peers.p) | ||
| return "Cannot rename: backend has store-response rules using a peer-synced table.\n"; | ||
| } | ||
|
|
There was a problem hiding this comment.
Length of new server name is not checked.
Comment on lines
+5435
to
+5439
| /* reject control characters, spaces, and '/' which break CLI parsing */ | ||
| for (p = new_name; *p; p++) { | ||
| if ((unsigned char)*p <= ' ' || *p == '/') | ||
| return "Server name must not contain spaces, control characters, or '/'.\n"; | ||
| } |
There was a problem hiding this comment.
Is there no utility function for this task?
Author
There was a problem hiding this comment.
I searched again, but I couldn't find any helper like that sadly.
…enaming Add a global-level 'server-rename' keyword as an alternative to the per-backend 'option server-rename'. When set in the global section, it allows runtime server renaming via 'set server <b>/<s> name' on all backends without requiring the per-backend option individually. The per-backend 'option server-rename' still works independently — either one is sufficient to enable renaming for a given backend. This uses bit 24 of global.tune.options (GTUNE_SRV_RENAME) and follows the same pattern as other global boolean toggles like 'insecure-fork-wanted'. The 'no' prefix is supported to disable it.
Add a VTC test covering:
- error cases: missing name, backend without opt-in, server not in
maintenance, invalid characters in name, duplicate name
- success: rename, verify via 'show servers state', old name no
longer resolves, rename back, traffic still works
- global 'server-rename' keyword: rename succeeds on a backend
without 'option server-rename' when global toggle is set
Add a VTC test covering:
- error cases: missing name, backend without opt-in, server not in
maintenance, invalid characters in name, duplicate name
- success: rename, verify via 'show servers state', old name no
longer resolves, rename back, traffic still works
- global 'server-rename' keyword: rename succeeds on a backend
without 'option server-rename' when global toggle is set
alexanderstephan
pushed a commit
that referenced
this pull request
May 8, 2026
New type sockaddr_in46 has been recently introduced. It serves as a
union which can store either an IPv4 or IPv6 address. The objective is
to reduce the storage size for QUIC datagrams which previously uses a
sockaddr_storage field.
On qc_new_conn(), source and destination addresses from the datagram are
passed to the function as sockaddr_storage so that they are copied into
the newly built quic_conn instance. However, the involved memcpy() is
producing a buffer overflow as sockaddr_in46 is smaller than
sockaddr_storage type.
This patch fixes this by defining a new helper function
in46un_to_addr(). This allows to convert safely sockaddr_in46 to a plain
sockaddr type. The function is now used before invoking qc_new_conn().
Note that there is still other several places where union sockaddr_in46
is casted as sockaddr_storage type. However, these should be safe as in
these cases sockaddr fields are accessed individually after checking
ss_family. The memory issue only exists when plain memcpy is used.
This bug was detected using ASAN. It generates the following traces when
a QUIC connection is instantiated.
==37474==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7c3bb9a61100 at pc 0x5631f52c3946 bp 0x7ffc83e45b50 sp 0x7ffc83e45310
READ of size 128 at 0x7c3bb9a61100 thread T0
#0 0x5631f52c3945 in __asan_memcpy (/home/amaury/work/haproxy-quic-dev/haproxy+0x3ae945) (BuildId: a7ccfd74b7a71a869b8ff8d13f6dcde8c82c1487)
#1 0x5631f55f9e34 in qc_new_conn /home/amaury/work/haproxy-quic-dev/src/quic_conn.c:1311:2
#2 0x5631f558d5c3 in quic_rx_pkt_retrieve_conn /home/amaury/work/haproxy-quic-dev/src/quic_rx.c:1875:10
#3 0x5631f558330b in quic_dgram_parse /home/amaury/work/haproxy-quic-dev/src/quic_rx.c:2463:29
#4 0x5631f5625da6 in quic_lstnr_dghdlr /home/amaury/work/haproxy-quic-dev/src/quic_sock.c:206:3
#5 0x5631f6a64173 in run_tasks_from_lists /home/amaury/work/haproxy-quic-dev/src/task.c:660:26
#6 0x5631f6a6ba1e in process_runnable_tasks /home/amaury/work/haproxy-quic-dev/src/task.c:913:9
#7 0x5631f5e984c3 in run_poll_loop /home/amaury/work/haproxy-quic-dev/src/haproxy.c:2982:3
#8 0x5631f5e9a715 in run_thread_poll_loop /home/amaury/work/haproxy-quic-dev/src/haproxy.c:3212:2
#9 0x5631f5e9f732 in main /home/amaury/work/haproxy-quic-dev/src/haproxy.c:3853:2
#10 0x7f2bba8276c0 (/usr/lib/libc.so.6+0x276c0) (BuildId: ca0db5ab57a36507d61bbcf4988d344974331f19)
#11 0x7f2bba8277f8 in __libc_start_main (/usr/lib/libc.so.6+0x277f8) (BuildId: ca0db5ab57a36507d61bbcf4988d344974331f19)
#12 0x5631f51be594 in _start (/home/amaury/work/haproxy-quic-dev/haproxy+0x2a9594) (BuildId: a7ccfd74b7a71a869b8ff8d13f6dcde8c82c1487)
No need to backport.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes haproxy#952.