mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-12 20:36:15 -04:00
Compare commits
No commits in common. "master" and "v3.2-dev16" have entirely different histories.
master
...
v3.2-dev16
868 changed files with 24032 additions and 63495 deletions
|
|
@ -1,7 +1,7 @@
|
|||
FreeBSD_task:
|
||||
freebsd_instance:
|
||||
matrix:
|
||||
image_family: freebsd-14-3
|
||||
image_family: freebsd-14-2
|
||||
only_if: $CIRRUS_BRANCH =~ 'master|next'
|
||||
install_script:
|
||||
- pkg update -f && pkg upgrade -y && pkg install -y openssl git gmake lua54 socat pcre2
|
||||
|
|
|
|||
48
.github/actions/setup-vtest/action.yml
vendored
48
.github/actions/setup-vtest/action.yml
vendored
|
|
@ -1,48 +0,0 @@
|
|||
name: 'setup VTest'
|
||||
description: 'ssss'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
||||
- name: Setup coredumps
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||
shell: bash
|
||||
run: |
|
||||
sudo sysctl -w fs.suid_dumpable=1
|
||||
sudo sysctl kernel.core_pattern=/tmp/core.%h.%e.%t
|
||||
|
||||
- name: Setup ulimit for core dumps
|
||||
shell: bash
|
||||
run: |
|
||||
# This is required for macOS which does not actually allow to increase
|
||||
# the '-n' soft limit to the hard limit, thus failing to run.
|
||||
ulimit -n 65536
|
||||
ulimit -c unlimited
|
||||
|
||||
- name: Get VTest latest commit SHA
|
||||
id: vtest-sha
|
||||
shell: bash
|
||||
run: |
|
||||
echo "sha=$(git ls-remote https://code.vinyl-cache.org/vtest/VTest2 HEAD | cut -f1)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache VTest
|
||||
id: cache-vtest
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ github.workspace }}/vtest
|
||||
key: vtest-${{ runner.os }}-${{ runner.arch }}-${{ steps.vtest-sha.outputs.sha }}
|
||||
|
||||
- name: Install VTest
|
||||
if: steps.cache-vtest.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
DESTDIR=${{ github.workspace }}/vtest scripts/build-vtest.sh
|
||||
|
||||
- name: Install problem matcher for VTest
|
||||
shell: bash
|
||||
# This allows one to more easily see which tests fail.
|
||||
run: echo "::add-matcher::.github/vtest.json"
|
||||
|
||||
|
||||
|
||||
2
.github/h2spec.config
vendored
2
.github/h2spec.config
vendored
|
|
@ -19,7 +19,7 @@ defaults
|
|||
|
||||
frontend h2
|
||||
mode http
|
||||
bind 127.0.0.1:8443 ssl crt reg-tests/ssl/certs/common.pem alpn h2,http/1.1
|
||||
bind 127.0.0.1:8443 ssl crt reg-tests/ssl/common.pem alpn h2,http/1.1
|
||||
default_backend h2b
|
||||
|
||||
backend h2b
|
||||
|
|
|
|||
161
.github/matrix.py
vendored
161
.github/matrix.py
vendored
|
|
@ -12,7 +12,6 @@ import functools
|
|||
import json
|
||||
import re
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from os import environ
|
||||
from packaging import version
|
||||
|
|
@ -20,10 +19,9 @@ from packaging import version
|
|||
#
|
||||
# this CI is used for both development and stable branches of HAProxy
|
||||
#
|
||||
# naming convention used, if branch/tag name matches:
|
||||
# naming convention used, if branch name matches:
|
||||
#
|
||||
# "haproxy-" - stable branches
|
||||
# "vX.Y.Z" - release tags
|
||||
# otherwise - development branch (i.e. "latest" ssl variants, "latest" github images)
|
||||
#
|
||||
|
||||
|
|
@ -34,24 +32,13 @@ def get_all_github_tags(url):
|
|||
headers = {}
|
||||
if environ.get("GITHUB_TOKEN") is not None:
|
||||
headers["Authorization"] = "token {}".format(environ.get("GITHUB_TOKEN"))
|
||||
all_tags = []
|
||||
page = 1
|
||||
sep = "&" if "?" in url else "?"
|
||||
while True:
|
||||
paginated_url = "{}{}per_page=100&page={}".format(url, sep, page)
|
||||
request = urllib.request.Request(paginated_url, headers=headers)
|
||||
try:
|
||||
response = urllib.request.urlopen(request)
|
||||
except urllib.error.URLError:
|
||||
return all_tags if all_tags else None
|
||||
tags = json.loads(response.read().decode("utf-8"))
|
||||
if not tags:
|
||||
break
|
||||
all_tags.extend([tag['name'] for tag in tags])
|
||||
if len(tags) < 100:
|
||||
break
|
||||
page += 1
|
||||
return all_tags if all_tags else None
|
||||
request = urllib.request.Request(url, headers=headers)
|
||||
try:
|
||||
tags = urllib.request.urlopen(request)
|
||||
except:
|
||||
return None
|
||||
tags = json.loads(tags.read().decode("utf-8"))
|
||||
return [tag['name'] for tag in tags]
|
||||
|
||||
@functools.lru_cache(5)
|
||||
def determine_latest_openssl(ssl):
|
||||
|
|
@ -77,8 +64,6 @@ def determine_latest_aws_lc(ssl):
|
|||
if not tags:
|
||||
return "AWS_LC_VERSION=failed_to_detect"
|
||||
valid_tags = list(filter(aws_lc_version_valid, tags))
|
||||
if not valid_tags:
|
||||
return "AWS_LC_VERSION=failed_to_detect"
|
||||
latest_tag = max(valid_tags, key=aws_lc_version_string_to_num)
|
||||
return "AWS_LC_VERSION={}".format(latest_tag[1:])
|
||||
|
||||
|
|
@ -90,12 +75,11 @@ def aws_lc_fips_version_valid(version_string):
|
|||
|
||||
@functools.lru_cache(5)
|
||||
def determine_latest_aws_lc_fips(ssl):
|
||||
tags = get_all_github_tags("https://api.github.com/repos/aws/aws-lc/tags")
|
||||
# the AWS-LC-FIPS tags are at the end of the list, so let's get a lot
|
||||
tags = get_all_github_tags("https://api.github.com/repos/aws/aws-lc/tags?per_page=200")
|
||||
if not tags:
|
||||
return "AWS_LC_FIPS_VERSION=failed_to_detect"
|
||||
valid_tags = list(filter(aws_lc_fips_version_valid, tags))
|
||||
if not valid_tags:
|
||||
return "AWS_LC_FIPS_VERSION=failed_to_detect"
|
||||
latest_tag = max(valid_tags, key=aws_lc_fips_version_string_to_num)
|
||||
return "AWS_LC_FIPS_VERSION={}".format(latest_tag[12:])
|
||||
|
||||
|
|
@ -136,18 +120,14 @@ def clean_compression(compression):
|
|||
def main(ref_name):
|
||||
print("Generating matrix for branch '{}'.".format(ref_name))
|
||||
|
||||
is_stable = "haproxy-" in ref_name or re.match(r'^v\d+\.\d+\.\d+$', ref_name)
|
||||
|
||||
matrix = []
|
||||
|
||||
# Ubuntu
|
||||
|
||||
if is_stable:
|
||||
os = "ubuntu-24.04" # stable branch
|
||||
os_arm = "ubuntu-24.04-arm" # stable branch
|
||||
if "haproxy-" in ref_name:
|
||||
os = "ubuntu-22.04" # stable branch
|
||||
else:
|
||||
os = "ubuntu-24.04" # development branch
|
||||
os_arm = "ubuntu-24.04-arm" # development branch
|
||||
os = "ubuntu-24.04" # development branch
|
||||
|
||||
TARGET = "linux-glibc"
|
||||
for CC in ["gcc", "clang"]:
|
||||
|
|
@ -192,37 +172,36 @@ def main(ref_name):
|
|||
|
||||
# ASAN
|
||||
|
||||
for os_asan in [os, os_arm]:
|
||||
matrix.append(
|
||||
{
|
||||
"name": "{}, {}, ASAN, all features".format(os_asan, CC),
|
||||
"os": os_asan,
|
||||
"TARGET": TARGET,
|
||||
"CC": CC,
|
||||
"FLAGS": [
|
||||
"USE_OBSOLETE_LINKER=1",
|
||||
'ARCH_FLAGS="-g -fsanitize=address"',
|
||||
'OPT_CFLAGS="-O1"',
|
||||
"USE_ZLIB=1",
|
||||
"USE_OT=1",
|
||||
"OT_INC=${HOME}/opt-ot/include",
|
||||
"OT_LIB=${HOME}/opt-ot/lib",
|
||||
"OT_RUNPATH=1",
|
||||
"USE_PCRE2=1",
|
||||
"USE_PCRE2_JIT=1",
|
||||
"USE_LUA=1",
|
||||
"USE_OPENSSL=1",
|
||||
"USE_WURFL=1",
|
||||
"WURFL_INC=addons/wurfl/dummy",
|
||||
"WURFL_LIB=addons/wurfl/dummy",
|
||||
"USE_DEVICEATLAS=1",
|
||||
"DEVICEATLAS_SRC=addons/deviceatlas/dummy",
|
||||
"USE_PROMEX=1",
|
||||
"USE_51DEGREES=1",
|
||||
"51DEGREES_SRC=addons/51degrees/dummy/pattern",
|
||||
],
|
||||
}
|
||||
)
|
||||
matrix.append(
|
||||
{
|
||||
"name": "{}, {}, ASAN, all features".format(os, CC),
|
||||
"os": os,
|
||||
"TARGET": TARGET,
|
||||
"CC": CC,
|
||||
"FLAGS": [
|
||||
"USE_OBSOLETE_LINKER=1",
|
||||
'ARCH_FLAGS="-g -fsanitize=address"',
|
||||
'OPT_CFLAGS="-O1"',
|
||||
"USE_ZLIB=1",
|
||||
"USE_OT=1",
|
||||
"OT_INC=${HOME}/opt-ot/include",
|
||||
"OT_LIB=${HOME}/opt-ot/lib",
|
||||
"OT_RUNPATH=1",
|
||||
"USE_PCRE2=1",
|
||||
"USE_PCRE2_JIT=1",
|
||||
"USE_LUA=1",
|
||||
"USE_OPENSSL=1",
|
||||
"USE_WURFL=1",
|
||||
"WURFL_INC=addons/wurfl/dummy",
|
||||
"WURFL_LIB=addons/wurfl/dummy",
|
||||
"USE_DEVICEATLAS=1",
|
||||
"DEVICEATLAS_SRC=addons/deviceatlas/dummy",
|
||||
"USE_PROMEX=1",
|
||||
"USE_51DEGREES=1",
|
||||
"51DEGREES_SRC=addons/51degrees/dummy/pattern",
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
for compression in ["USE_ZLIB=1"]:
|
||||
matrix.append(
|
||||
|
|
@ -239,14 +218,13 @@ def main(ref_name):
|
|||
"stock",
|
||||
"OPENSSL_VERSION=1.0.2u",
|
||||
"OPENSSL_VERSION=1.1.1s",
|
||||
"OPENSSL_VERSION=3.5.1",
|
||||
"QUICTLS_VERSION=OpenSSL_1_1_1w-quic1",
|
||||
"QUICTLS=yes",
|
||||
"WOLFSSL_VERSION=5.7.0",
|
||||
"AWS_LC_VERSION=1.39.0",
|
||||
# "BORINGSSL=yes",
|
||||
]
|
||||
|
||||
if not is_stable: # development branch
|
||||
if "haproxy-" not in ref_name: # development branch
|
||||
ssl_versions = ssl_versions + [
|
||||
"OPENSSL_VERSION=latest",
|
||||
"LIBRESSL_VERSION=latest",
|
||||
|
|
@ -254,7 +232,8 @@ def main(ref_name):
|
|||
|
||||
for ssl in ssl_versions:
|
||||
flags = ["USE_OPENSSL=1"]
|
||||
skipdup=0
|
||||
if ssl == "BORINGSSL=yes" or ssl == "QUICTLS=yes" or "LIBRESSL" in ssl or "WOLFSSL" in ssl or "AWS_LC" in ssl:
|
||||
flags.append("USE_QUIC=1")
|
||||
if "WOLFSSL" in ssl:
|
||||
flags.append("USE_OPENSSL_WOLFSSL=1")
|
||||
if "AWS_LC" in ssl:
|
||||
|
|
@ -264,23 +243,8 @@ def main(ref_name):
|
|||
flags.append("SSL_INC=${HOME}/opt/include")
|
||||
if "LIBRESSL" in ssl and "latest" in ssl:
|
||||
ssl = determine_latest_libressl(ssl)
|
||||
skipdup=1
|
||||
if "OPENSSL" in ssl and "latest" in ssl:
|
||||
ssl = determine_latest_openssl(ssl)
|
||||
skipdup=1
|
||||
|
||||
# if "latest" equals a version already in the list
|
||||
if ssl in ssl_versions and skipdup == 1:
|
||||
continue
|
||||
|
||||
openssl_supports_quic = False
|
||||
try:
|
||||
openssl_supports_quic = version.Version(ssl.split("OPENSSL_VERSION=",1)[1]) >= version.Version("3.5.0")
|
||||
except:
|
||||
pass
|
||||
|
||||
if ssl == "BORINGSSL=yes" or "QUICTLS" in ssl or "LIBRESSL" in ssl or "WOLFSSL" in ssl or "AWS_LC" in ssl or openssl_supports_quic:
|
||||
flags.append("USE_QUIC=1")
|
||||
|
||||
matrix.append(
|
||||
{
|
||||
|
|
@ -293,21 +257,24 @@ def main(ref_name):
|
|||
}
|
||||
)
|
||||
|
||||
# macOS on dev branches
|
||||
if not is_stable:
|
||||
os = "macos-26" # development branch
|
||||
# macOS
|
||||
|
||||
TARGET = "osx"
|
||||
for CC in ["clang"]:
|
||||
matrix.append(
|
||||
{
|
||||
"name": "{}, {}, no features".format(os, CC),
|
||||
"os": os,
|
||||
"TARGET": TARGET,
|
||||
"CC": CC,
|
||||
"FLAGS": [],
|
||||
}
|
||||
)
|
||||
if "haproxy-" in ref_name:
|
||||
os = "macos-13" # stable branch
|
||||
else:
|
||||
os = "macos-15" # development branch
|
||||
|
||||
TARGET = "osx"
|
||||
for CC in ["clang"]:
|
||||
matrix.append(
|
||||
{
|
||||
"name": "{}, {}, no features".format(os, CC),
|
||||
"os": os,
|
||||
"TARGET": TARGET,
|
||||
"CC": CC,
|
||||
"FLAGS": [],
|
||||
}
|
||||
)
|
||||
|
||||
# Print matrix
|
||||
|
||||
|
|
|
|||
95
.github/workflows/aws-lc-fips.yml
vendored
95
.github/workflows/aws-lc-fips.yml
vendored
|
|
@ -5,8 +5,97 @@ on:
|
|||
- cron: "0 0 * * 4"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/aws-lc-template.yml
|
||||
with:
|
||||
command: "from matrix import determine_latest_aws_lc_fips; print(determine_latest_aws_lc_fips(''))"
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install VTest
|
||||
run: |
|
||||
scripts/build-vtest.sh
|
||||
- name: Determine latest AWS-LC release
|
||||
id: get_aws_lc_release
|
||||
run: |
|
||||
result=$(cd .github && python3 -c "from matrix import determine_latest_aws_lc_fips; print(determine_latest_aws_lc_fips(''))")
|
||||
echo $result
|
||||
echo "result=$result" >> $GITHUB_OUTPUT
|
||||
- name: Cache AWS-LC
|
||||
id: cache_aws_lc
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '~/opt/'
|
||||
key: ssl-${{ steps.get_aws_lc_release.outputs.result }}-Ubuntu-latest-gcc
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
||||
sudo apt-get --no-install-recommends -y install socat gdb jose
|
||||
- name: Install AWS-LC
|
||||
if: ${{ steps.cache_ssl.outputs.cache-hit != 'true' }}
|
||||
run: env ${{ steps.get_aws_lc_release.outputs.result }} scripts/build-ssl.sh
|
||||
- name: Compile HAProxy
|
||||
run: |
|
||||
make -j$(nproc) ERR=1 CC=gcc TARGET=linux-glibc \
|
||||
USE_OPENSSL_AWSLC=1 USE_QUIC=1 \
|
||||
SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include \
|
||||
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
||||
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
||||
sudo make install
|
||||
- name: Show HAProxy version
|
||||
id: show-version
|
||||
run: |
|
||||
ldd $(which haproxy)
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
- name: Install problem matcher for VTest
|
||||
run: echo "::add-matcher::.github/vtest.json"
|
||||
- name: Run VTest for HAProxy
|
||||
id: vtest
|
||||
run: |
|
||||
# This is required for macOS which does not actually allow to increase
|
||||
# the '-n' soft limit to the hard limit, thus failing to run.
|
||||
ulimit -n 65536
|
||||
# allow to catch coredumps
|
||||
ulimit -c unlimited
|
||||
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Run Unit tests
|
||||
id: unittests
|
||||
run: |
|
||||
make unit-tests
|
||||
- name: Show VTest results
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
|
||||
printf "::group::"
|
||||
cat $folder/INFO
|
||||
cat $folder/LOG
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit 1
|
||||
- name: Show coredumps
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
failed=false
|
||||
shopt -s nullglob
|
||||
for file in /tmp/core.*; do
|
||||
failed=true
|
||||
printf "::group::"
|
||||
gdb -ex 'thread apply all bt full' ./haproxy $file
|
||||
echo "::endgroup::"
|
||||
done
|
||||
if [ "$failed" = true ]; then
|
||||
exit 1;
|
||||
fi
|
||||
- name: Show Unit-Tests results
|
||||
if: ${{ failure() && steps.unittests.outcome == 'failure' }}
|
||||
run: |
|
||||
for result in ${TMPDIR:-/tmp}/ha-unittests-*/results/res.*; do
|
||||
printf "::group::"
|
||||
cat $result
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit 1
|
||||
|
||||
|
|
|
|||
94
.github/workflows/aws-lc-template.yml
vendored
94
.github/workflows/aws-lc-template.yml
vendored
|
|
@ -1,94 +0,0 @@
|
|||
name: AWS-LC template
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
command:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Determine latest AWS-LC release
|
||||
id: get_aws_lc_release
|
||||
run: |
|
||||
result=$(cd .github && python3 -c "${{ inputs.command }}")
|
||||
echo $result
|
||||
echo "result=$result" >> $GITHUB_OUTPUT
|
||||
- name: Cache AWS-LC
|
||||
id: cache_aws_lc
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: '~/opt/'
|
||||
key: ssl-${{ steps.get_aws_lc_release.outputs.result }}-Ubuntu-latest-gcc
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
||||
sudo apt-get --no-install-recommends -y install socat gdb jose
|
||||
- name: Install AWS-LC
|
||||
if: ${{ steps.cache_ssl.outputs.cache-hit != 'true' }}
|
||||
run: env ${{ steps.get_aws_lc_release.outputs.result }} scripts/build-ssl.sh
|
||||
- name: Compile HAProxy
|
||||
run: |
|
||||
make -j$(nproc) ERR=1 CC=gcc TARGET=linux-glibc \
|
||||
USE_OPENSSL_AWSLC=1 USE_QUIC=1 \
|
||||
SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include \
|
||||
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
||||
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
||||
sudo make install
|
||||
- name: Show HAProxy version
|
||||
id: show-version
|
||||
run: |
|
||||
ldd $(which haproxy)
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
- uses: ./.github/actions/setup-vtest
|
||||
- name: Run VTest for HAProxy
|
||||
id: vtest
|
||||
run: |
|
||||
make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Run Unit tests
|
||||
id: unittests
|
||||
run: |
|
||||
make unit-tests
|
||||
- name: Show VTest results
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
|
||||
printf "::group::"
|
||||
cat $folder/INFO
|
||||
cat $folder/LOG
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit 1
|
||||
- name: Show coredumps
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
failed=false
|
||||
shopt -s nullglob
|
||||
for file in /tmp/core.*; do
|
||||
failed=true
|
||||
printf "::group::"
|
||||
gdb -ex 'thread apply all bt full' ./haproxy $file
|
||||
echo "::endgroup::"
|
||||
done
|
||||
if [ "$failed" = true ]; then
|
||||
exit 1;
|
||||
fi
|
||||
- name: Show Unit-Tests results
|
||||
if: ${{ failure() && steps.unittests.outcome == 'failure' }}
|
||||
run: |
|
||||
for result in ${TMPDIR:-/tmp}/ha-unittests-*/results/res.*; do
|
||||
printf "::group::"
|
||||
cat $result
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit 1
|
||||
|
||||
95
.github/workflows/aws-lc.yml
vendored
95
.github/workflows/aws-lc.yml
vendored
|
|
@ -5,8 +5,97 @@ on:
|
|||
- cron: "0 0 * * 4"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/aws-lc-template.yml
|
||||
with:
|
||||
command: "from matrix import determine_latest_aws_lc; print(determine_latest_aws_lc(''))"
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install VTest
|
||||
run: |
|
||||
scripts/build-vtest.sh
|
||||
- name: Determine latest AWS-LC release
|
||||
id: get_aws_lc_release
|
||||
run: |
|
||||
result=$(cd .github && python3 -c "from matrix import determine_latest_aws_lc; print(determine_latest_aws_lc(''))")
|
||||
echo $result
|
||||
echo "result=$result" >> $GITHUB_OUTPUT
|
||||
- name: Cache AWS-LC
|
||||
id: cache_aws_lc
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '~/opt/'
|
||||
key: ssl-${{ steps.get_aws_lc_release.outputs.result }}-Ubuntu-latest-gcc
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
||||
sudo apt-get --no-install-recommends -y install socat gdb jose
|
||||
- name: Install AWS-LC
|
||||
if: ${{ steps.cache_ssl.outputs.cache-hit != 'true' }}
|
||||
run: env ${{ steps.get_aws_lc_release.outputs.result }} scripts/build-ssl.sh
|
||||
- name: Compile HAProxy
|
||||
run: |
|
||||
make -j$(nproc) ERR=1 CC=gcc TARGET=linux-glibc \
|
||||
USE_OPENSSL_AWSLC=1 USE_QUIC=1 \
|
||||
SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include \
|
||||
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
||||
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
||||
sudo make install
|
||||
- name: Show HAProxy version
|
||||
id: show-version
|
||||
run: |
|
||||
ldd $(which haproxy)
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
- name: Install problem matcher for VTest
|
||||
run: echo "::add-matcher::.github/vtest.json"
|
||||
- name: Run VTest for HAProxy
|
||||
id: vtest
|
||||
run: |
|
||||
# This is required for macOS which does not actually allow to increase
|
||||
# the '-n' soft limit to the hard limit, thus failing to run.
|
||||
ulimit -n 65536
|
||||
# allow to catch coredumps
|
||||
ulimit -c unlimited
|
||||
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Run Unit tests
|
||||
id: unittests
|
||||
run: |
|
||||
make unit-tests
|
||||
- name: Show VTest results
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
|
||||
printf "::group::"
|
||||
cat $folder/INFO
|
||||
cat $folder/LOG
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit 1
|
||||
- name: Show coredumps
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
failed=false
|
||||
shopt -s nullglob
|
||||
for file in /tmp/core.*; do
|
||||
failed=true
|
||||
printf "::group::"
|
||||
gdb -ex 'thread apply all bt full' ./haproxy $file
|
||||
echo "::endgroup::"
|
||||
done
|
||||
if [ "$failed" = true ]; then
|
||||
exit 1;
|
||||
fi
|
||||
- name: Show Unit-Tests results
|
||||
if: ${{ failure() && steps.unittests.outcome == 'failure' }}
|
||||
run: |
|
||||
for result in ${TMPDIR:-/tmp}/ha-unittests-*/results/res.*; do
|
||||
printf "::group::"
|
||||
cat $result
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit 1
|
||||
|
||||
|
|
|
|||
2
.github/workflows/codespell.yml
vendored
2
.github/workflows/codespell.yml
vendored
|
|
@ -13,7 +13,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- uses: codespell-project/codespell-problem-matcher@v1.2.0
|
||||
- uses: codespell-project/actions-codespell@master
|
||||
with:
|
||||
|
|
|
|||
2
.github/workflows/compliance.yml
vendored
2
.github/workflows/compliance.yml
vendored
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install h2spec
|
||||
id: install-h2spec
|
||||
run: |
|
||||
|
|
|
|||
5
.github/workflows/contrib.yml
vendored
5
.github/workflows/contrib.yml
vendored
|
|
@ -10,7 +10,10 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Compile admin/halog/halog
|
||||
run: |
|
||||
make admin/halog/halog
|
||||
- name: Compile dev/flags/flags
|
||||
run: |
|
||||
make dev/flags/flags
|
||||
|
|
|
|||
6
.github/workflows/coverity.yml
vendored
6
.github/workflows/coverity.yml
vendored
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
||||
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
libsystemd-dev
|
||||
- name: Install QUICTLS
|
||||
run: |
|
||||
QUICTLS_VERSION=OpenSSL_1_1_1w-quic1 scripts/build-ssl.sh
|
||||
QUICTLS=yes scripts/build-ssl.sh
|
||||
- name: Download Coverity build tool
|
||||
run: |
|
||||
wget -c -N https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=Haproxy" -O coverity_tool.tar.gz
|
||||
|
|
@ -38,7 +38,7 @@ jobs:
|
|||
- name: Build with Coverity build tool
|
||||
run: |
|
||||
export PATH=`pwd`/coverity_tool/bin:$PATH
|
||||
cov-build --dir cov-int make CC=clang TARGET=linux-glibc USE_ZLIB=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_QUIC=1 USE_WURFL=1 WURFL_INC=addons/wurfl/dummy WURFL_LIB=addons/wurfl/dummy USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_51DEGREES=1 51DEGREES_SRC=addons/51degrees/dummy/pattern ADDLIB=\"-Wl,-rpath,$HOME/opt/lib/\" SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include DEBUG+=-DDEBUG_STRICT=2 DEBUG+=-DDEBUG_USE_ABORT=1
|
||||
cov-build --dir cov-int make CC=clang TARGET=linux-glibc USE_ZLIB=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_QUIC=1 USE_WURFL=1 WURFL_INC=addons/wurfl/dummy WURFL_LIB=addons/wurfl/dummy USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_51DEGREES=1 51DEGREES_SRC=addons/51degrees/dummy/pattern ADDLIB=\"-Wl,-rpath,$HOME/opt/lib/\" SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include DEBUG+=-DDEBUG_STRICT=1 DEBUG+=-DDEBUG_USE_ABORT=1
|
||||
- name: Submit build result to Coverity Scan
|
||||
run: |
|
||||
tar czvf cov.tar.gz cov-int
|
||||
|
|
|
|||
4
.github/workflows/cross-zoo.yml
vendored
4
.github/workflows/cross-zoo.yml
vendored
|
|
@ -99,12 +99,12 @@ jobs:
|
|||
sudo apt-get -yq --force-yes install \
|
||||
gcc-${{ matrix.platform.arch }} \
|
||||
${{ matrix.platform.libs }}
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
- name: install quictls
|
||||
run: |
|
||||
QUICTLS_EXTRA_ARGS="--cross-compile-prefix=${{ matrix.platform.arch }}- ${{ matrix.platform.target }}" QUICTLS_VERSION=OpenSSL_1_1_1w-quic1 scripts/build-ssl.sh
|
||||
QUICTLS_EXTRA_ARGS="--cross-compile-prefix=${{ matrix.platform.arch }}- ${{ matrix.platform.target }}" QUICTLS=yes scripts/build-ssl.sh
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
|
|
|||
35
.github/workflows/fedora-rawhide.yml
vendored
35
.github/workflows/fedora-rawhide.yml
vendored
|
|
@ -1,4 +1,4 @@
|
|||
name: Fedora/Rawhide/OpenSSL
|
||||
name: Fedora/Rawhide/QuicTLS
|
||||
|
||||
on:
|
||||
schedule:
|
||||
|
|
@ -13,24 +13,26 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
platform: [
|
||||
{ name: x64, cc: gcc, ADDLIB_ATOMIC: "", ARCH_FLAGS: "" },
|
||||
{ name: x64, cc: clang, ADDLIB_ATOMIC: "", ARCH_FLAGS: "" },
|
||||
{ name: x86, cc: gcc, ADDLIB_ATOMIC: "-latomic", ARCH_FLAGS: "-m32" },
|
||||
{ name: x86, cc: clang, ADDLIB_ATOMIC: "-latomic", ARCH_FLAGS: "-m32" }
|
||||
{ name: x64, cc: gcc, QUICTLS_EXTRA_ARGS: "", ADDLIB_ATOMIC: "", ARCH_FLAGS: "" },
|
||||
{ name: x64, cc: clang, QUICTLS_EXTRA_ARGS: "", ADDLIB_ATOMIC: "", ARCH_FLAGS: "" },
|
||||
{ name: x86, cc: gcc, QUICTLS_EXTRA_ARGS: "-m32 linux-generic32", ADDLIB_ATOMIC: "-latomic", ARCH_FLAGS: "-m32" },
|
||||
{ name: x86, cc: clang, QUICTLS_EXTRA_ARGS: "-m32 linux-generic32", ADDLIB_ATOMIC: "-latomic", ARCH_FLAGS: "-m32" }
|
||||
]
|
||||
fail-fast: false
|
||||
name: ${{ matrix.platform.cc }}.${{ matrix.platform.name }}
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
container:
|
||||
image: fedora:rawhide
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
dnf -y install awk diffutils git pcre-devel zlib-devel pcre2-devel 'perl(FindBin)' perl-IPC-Cmd 'perl(File::Copy)' 'perl(File::Compare)' lua-devel socat findutils systemd-devel clang openssl-devel.x86_64
|
||||
dnf -y install 'perl(FindBin)' 'perl(File::Compare)' perl-IPC-Cmd 'perl(File::Copy)' glibc-devel.i686 lua-devel.i686 lua-devel.x86_64 systemd-devel.i686 zlib-ng-compat-devel.i686 pcre-devel.i686 libatomic.i686 openssl-devel.i686
|
||||
- uses: ./.github/actions/setup-vtest
|
||||
dnf -y install awk diffutils git pcre-devel zlib-devel pcre2-devel 'perl(FindBin)' perl-IPC-Cmd 'perl(File::Copy)' 'perl(File::Compare)' lua-devel socat findutils systemd-devel clang
|
||||
dnf -y install 'perl(FindBin)' 'perl(File::Compare)' perl-IPC-Cmd 'perl(File::Copy)' glibc-devel.i686 lua-devel.i686 lua-devel.x86_64 systemd-devel.i686 zlib-ng-compat-devel.i686 pcre-devel.i686 libatomic.i686
|
||||
- name: Install VTest
|
||||
run: scripts/build-vtest.sh
|
||||
- name: Install QuicTLS
|
||||
run: QUICTLS=yes QUICTLS_EXTRA_ARGS="${{ matrix.platform.QUICTLS_EXTRA_ARGS }}" scripts/build-ssl.sh
|
||||
- name: Build contrib tools
|
||||
run: |
|
||||
make admin/halog/halog
|
||||
|
|
@ -39,7 +41,7 @@ jobs:
|
|||
make dev/hpack/decode dev/hpack/gen-enc dev/hpack/gen-rht
|
||||
- name: Compile HAProxy with ${{ matrix.platform.cc }}
|
||||
run: |
|
||||
make -j3 CC=${{ matrix.platform.cc }} V=1 ERR=1 TARGET=linux-glibc DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" USE_PROMEX=1 USE_OPENSSL=1 USE_QUIC=1 USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 ADDLIB="${{ matrix.platform.ADDLIB_ATOMIC }}" ARCH_FLAGS="${{ matrix.platform.ARCH_FLAGS }}"
|
||||
make -j3 CC=${{ matrix.platform.cc }} V=1 ERR=1 TARGET=linux-glibc DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" USE_OPENSSL=1 USE_QUIC=1 USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 ADDLIB="${{ matrix.platform.ADDLIB_ATOMIC }} -Wl,-rpath,${HOME}/opt/lib" SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include ARCH_FLAGS="${{ matrix.platform.ARCH_FLAGS }}"
|
||||
make install
|
||||
- name: Show HAProxy version
|
||||
id: show-version
|
||||
|
|
@ -49,17 +51,10 @@ jobs:
|
|||
echo "::endgroup::"
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
#
|
||||
# TODO: review this workaround later
|
||||
- name: relax crypto policies
|
||||
run: |
|
||||
dnf -y install crypto-policies-scripts
|
||||
echo LEGACY > /etc/crypto-policies/config
|
||||
update-crypto-policies
|
||||
- name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
|
||||
id: vtest
|
||||
run: |
|
||||
make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Show VTest results
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
|
|
@ -72,4 +67,4 @@ jobs:
|
|||
- name: Run Unit tests
|
||||
id: unittests
|
||||
run: |
|
||||
make unit-tests
|
||||
make unit-tests
|
||||
2
.github/workflows/illumos.yml
vendored
2
.github/workflows/illumos.yml
vendored
|
|
@ -13,7 +13,7 @@ jobs:
|
|||
contents: read
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Build on VM"
|
||||
uses: vmactions/solaris-vm@v1
|
||||
|
|
|
|||
6
.github/workflows/musl.yml
vendored
6
.github/workflows/musl.yml
vendored
|
|
@ -20,11 +20,11 @@ jobs:
|
|||
run: |
|
||||
ulimit -c unlimited
|
||||
echo '/tmp/core/core.%h.%e.%t' > /proc/sys/kernel/core_pattern
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: apk add gcc gdb make tar git python3 libc-dev linux-headers pcre-dev pcre2-dev openssl-dev lua5.3-dev grep socat curl musl-dbg lua5.3-dbg jose
|
||||
- name: Install VTest
|
||||
run: DESTDIR=${{ github.workspace }}/vtest scripts/build-vtest.sh
|
||||
run: scripts/build-vtest.sh
|
||||
- name: Build
|
||||
run: make -j$(nproc) TARGET=linux-musl DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" ARCH_FLAGS='-ggdb3' CC=cc V=1 USE_LUA=1 LUA_INC=/usr/include/lua5.3 LUA_LIB=/usr/lib/lua5.3 USE_OPENSSL=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_PROMEX=1
|
||||
- name: Show version
|
||||
|
|
@ -36,7 +36,7 @@ jobs:
|
|||
run: echo "::add-matcher::.github/vtest.json"
|
||||
- name: Run VTest
|
||||
id: vtest
|
||||
run: make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
run: make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Run Unit tests
|
||||
id: unittests
|
||||
run: |
|
||||
|
|
|
|||
2
.github/workflows/netbsd.yml
vendored
2
.github/workflows/netbsd.yml
vendored
|
|
@ -13,7 +13,7 @@ jobs:
|
|||
contents: read
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Build on VM"
|
||||
uses: vmactions/netbsd-vm@v1
|
||||
|
|
|
|||
82
.github/workflows/openssl-ech.yml
vendored
82
.github/workflows/openssl-ech.yml
vendored
|
|
@ -1,82 +0,0 @@
|
|||
name: openssl ECH
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 3 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Install VTest
|
||||
run: |
|
||||
DESTDIR=${{ github.workspace }}/vtest scripts/build-vtest.sh
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
||||
sudo apt-get --no-install-recommends -y install socat gdb
|
||||
sudo apt-get --no-install-recommends -y install libpsl-dev
|
||||
- name: Install OpenSSL+ECH
|
||||
run: env OPENSSL_VERSION="git-feature/ech" GIT_TYPE="branch" scripts/build-ssl.sh
|
||||
- name: Install curl+ECH
|
||||
run: env SSL_LIB=${HOME}/opt/ scripts/build-curl.sh
|
||||
- name: Compile HAProxy
|
||||
run: |
|
||||
make -j$(nproc) CC=gcc TARGET=linux-glibc \
|
||||
USE_QUIC=1 USE_OPENSSL=1 USE_ECH=1 \
|
||||
SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include \
|
||||
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
||||
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/" \
|
||||
ARCH_FLAGS="-ggdb3 -fsanitize=address"
|
||||
sudo make install
|
||||
- name: Show HAProxy version
|
||||
id: show-version
|
||||
run: |
|
||||
ldd $(which haproxy)
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
- name: Install problem matcher for VTest
|
||||
run: echo "::add-matcher::.github/vtest.json"
|
||||
- name: Run VTest for HAProxy
|
||||
id: vtest
|
||||
run: |
|
||||
# This is required for macOS which does not actually allow to increase
|
||||
# the '-n' soft limit to the hard limit, thus failing to run.
|
||||
ulimit -n 65536
|
||||
# allow to catch coredumps
|
||||
ulimit -c unlimited
|
||||
make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Show VTest results
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
|
||||
printf "::group::"
|
||||
cat $folder/INFO
|
||||
cat $folder/LOG
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit 1
|
||||
- name: Run Unit tests
|
||||
id: unittests
|
||||
run: |
|
||||
make unit-tests
|
||||
- name: Show coredumps
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
failed=false
|
||||
shopt -s nullglob
|
||||
for file in /tmp/core.*; do
|
||||
failed=true
|
||||
printf "::group::"
|
||||
gdb -ex 'thread apply all bt full' ./haproxy $file
|
||||
echo "::endgroup::"
|
||||
done
|
||||
if [ "$failed" = true ]; then
|
||||
exit 1;
|
||||
fi
|
||||
77
.github/workflows/openssl-master.yml
vendored
77
.github/workflows/openssl-master.yml
vendored
|
|
@ -1,77 +0,0 @@
|
|||
name: openssl master
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 3 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
||||
sudo apt-get --no-install-recommends -y install socat gdb
|
||||
sudo apt-get --no-install-recommends -y install libpsl-dev
|
||||
- uses: ./.github/actions/setup-vtest
|
||||
- name: Install OpenSSL master
|
||||
run: env OPENSSL_VERSION="git-master" GIT_TYPE="branch" scripts/build-ssl.sh
|
||||
- name: Compile HAProxy
|
||||
run: |
|
||||
make -j$(nproc) ERR=1 CC=gcc TARGET=linux-glibc \
|
||||
USE_QUIC=1 USE_OPENSSL=1 \
|
||||
SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include \
|
||||
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
||||
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
||||
sudo make install
|
||||
- name: Show HAProxy version
|
||||
id: show-version
|
||||
run: |
|
||||
ldd $(which haproxy)
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
- name: Install problem matcher for VTest
|
||||
run: echo "::add-matcher::.github/vtest.json"
|
||||
- name: Run VTest for HAProxy
|
||||
id: vtest
|
||||
run: |
|
||||
# This is required for macOS which does not actually allow to increase
|
||||
# the '-n' soft limit to the hard limit, thus failing to run.
|
||||
ulimit -n 65536
|
||||
# allow to catch coredumps
|
||||
ulimit -c unlimited
|
||||
make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Show VTest results
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
|
||||
printf "::group::"
|
||||
cat $folder/INFO
|
||||
cat $folder/LOG
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit 1
|
||||
- name: Run Unit tests
|
||||
id: unittests
|
||||
run: |
|
||||
make unit-tests
|
||||
- name: Show coredumps
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
failed=false
|
||||
shopt -s nullglob
|
||||
for file in /tmp/core.*; do
|
||||
failed=true
|
||||
printf "::group::"
|
||||
gdb -ex 'thread apply all bt full' ./haproxy $file
|
||||
echo "::endgroup::"
|
||||
done
|
||||
if [ "$failed" = true ]; then
|
||||
exit 1;
|
||||
fi
|
||||
34
.github/workflows/openssl-nodeprecated.yml
vendored
Normal file
34
.github/workflows/openssl-nodeprecated.yml
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#
|
||||
# special purpose CI: test against OpenSSL built in "no-deprecated" mode
|
||||
# let us run those builds weekly
|
||||
#
|
||||
# for example, OpenWRT uses such OpenSSL builds (those builds are smaller)
|
||||
#
|
||||
#
|
||||
# some details might be found at NL: https://www.mail-archive.com/haproxy@formilux.org/msg35759.html
|
||||
# GH: https://github.com/haproxy/haproxy/issues/367
|
||||
|
||||
name: openssl no-deprecated
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 4"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install VTest
|
||||
run: |
|
||||
scripts/build-vtest.sh
|
||||
- name: Compile HAProxy
|
||||
run: |
|
||||
make DEFINE="-DOPENSSL_API_COMPAT=0x10100000L -DOPENSSL_NO_DEPRECATED" -j3 CC=gcc ERR=1 TARGET=linux-glibc USE_OPENSSL=1
|
||||
- name: Run VTest
|
||||
run: |
|
||||
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
77
.github/workflows/quic-interop-aws-lc.yml
vendored
77
.github/workflows/quic-interop-aws-lc.yml
vendored
|
|
@ -11,7 +11,7 @@ on:
|
|||
|
||||
|
||||
jobs:
|
||||
combined-build-and-run:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
permissions:
|
||||
|
|
@ -19,49 +19,86 @@ jobs:
|
|||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Update Docker to the latest
|
||||
uses: docker/setup-docker-action@v4
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Docker image
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: https://github.com/haproxytech/haproxy-qns.git
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
build-args: |
|
||||
SSLLIB=AWS-LC
|
||||
tags: local:aws-lc
|
||||
SSLLIB: AWS-LC
|
||||
tags: ghcr.io/${{ github.repository }}:aws-lc
|
||||
|
||||
- name: Cleanup registry
|
||||
uses: actions/delete-package-versions@v5
|
||||
with:
|
||||
owner: ${{ github.repository_owner }}
|
||||
package-name: 'haproxy'
|
||||
package-type: container
|
||||
min-versions-to-keep: 1
|
||||
delete-only-untagged-versions: 'true'
|
||||
|
||||
run:
|
||||
needs: build
|
||||
strategy:
|
||||
matrix:
|
||||
suite: [
|
||||
{ client: chrome, tests: "http3" },
|
||||
{ client: picoquic, tests: "handshake,transfer,longrtt,chacha20,multiplexing,retry,resumption,zerortt,http3,blackhole,keyupdate,ecn,amplificationlimit,handshakeloss,transferloss,handshakecorruption,transfercorruption,ipv6,v2" },
|
||||
{ client: quic-go, tests: "handshake,transfer,longrtt,chacha20,multiplexing,retry,resumption,zerortt,http3,blackhole,keyupdate,ecn,amplificationlimit,handshakeloss,transferloss,handshakecorruption,transfercorruption,ipv6,v2" },
|
||||
{ client: ngtcp2, tests: "handshake,transfer,longrtt,chacha20,multiplexing,retry,resumption,zerortt,http3,blackhole,keyupdate,ecn,amplificationlimit,handshakeloss,transferloss,handshakecorruption,transfercorruption,ipv6,v2" }
|
||||
]
|
||||
fail-fast: false
|
||||
|
||||
name: ${{ matrix.suite.client }}
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install tshark
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install tshark
|
||||
|
||||
- name: Pull image
|
||||
run: |
|
||||
docker pull ghcr.io/${{ github.repository }}:aws-lc
|
||||
|
||||
- name: Run
|
||||
run: |
|
||||
git clone https://github.com/quic-interop/quic-interop-runner
|
||||
cd quic-interop-runner
|
||||
pip install -r requirements.txt --break-system-packages
|
||||
python run.py -j result.json -l logs-chrome -r haproxy=local:aws-lc -t "http3" -c chrome -s haproxy
|
||||
python run.py -j result.json -l logs-picoquic -r haproxy=local:aws-lc -t "handshake,transfer,longrtt,chacha20,multiplexing,retry,resumption,zerortt,http3,blackhole,keyupdate,ecn,amplificationlimit,handshakeloss,transferloss,handshakecorruption,transfercorruption,ipv6,v2" -c picoquic -s haproxy
|
||||
python run.py -j result.json -l logs-quic-go -r haproxy=local:aws-lc -t "handshake,transfer,longrtt,chacha20,multiplexing,retry,resumption,zerortt,http3,blackhole,keyupdate,ecn,amplificationlimit,handshakeloss,transferloss,handshakecorruption,transfercorruption,ipv6,v2" -c quic-go -s haproxy
|
||||
python run.py -j result.json -l logs-ngtcp2 -r haproxy=local:aws-lc -t "handshake,transfer,longrtt,chacha20,multiplexing,retry,resumption,zerortt,http3,blackhole,keyupdate,ecn,amplificationlimit,handshakeloss,transferloss,handshakecorruption,transfercorruption,ipv6,v2" -c ngtcp2 -s haproxy
|
||||
python run.py -j result.json -l logs -r haproxy=ghcr.io/${{ github.repository }}:aws-lc -t ${{ matrix.suite.tests }} -c ${{ matrix.suite.client }} -s haproxy
|
||||
|
||||
- name: Delete succeeded logs
|
||||
if: failure()
|
||||
run: |
|
||||
for client in chrome picoquic quic-go ngtcp2; do
|
||||
pushd quic-interop-runner/logs-${client}/haproxy_${client}
|
||||
cat ../../result.json | jq -r '.results[][] | select(.result=="succeeded") | .name' | xargs rm -rf
|
||||
popd
|
||||
done
|
||||
cd quic-interop-runner/logs/haproxy_${{ matrix.suite.client }}
|
||||
cat ../../result.json | jq -r '.results[][] | select(.result=="succeeded") | .name' | xargs rm -rf
|
||||
|
||||
- name: Logs upload
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: logs
|
||||
path: quic-interop-runner/logs*/
|
||||
name: logs-${{ matrix.suite.client }}
|
||||
path: quic-interop-runner/logs/
|
||||
retention-days: 6
|
||||
|
|
|
|||
73
.github/workflows/quic-interop-libressl.yml
vendored
73
.github/workflows/quic-interop-libressl.yml
vendored
|
|
@ -11,7 +11,7 @@ on:
|
|||
|
||||
|
||||
jobs:
|
||||
combined-build-and-run:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
permissions:
|
||||
|
|
@ -19,47 +19,84 @@ jobs:
|
|||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Update Docker to the latest
|
||||
uses: docker/setup-docker-action@v4
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Docker image
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: https://github.com/haproxytech/haproxy-qns.git
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
build-args: |
|
||||
SSLLIB=LibreSSL
|
||||
tags: local:libressl
|
||||
SSLLIB: LibreSSL
|
||||
tags: ghcr.io/${{ github.repository }}:libressl
|
||||
|
||||
- name: Cleanup registry
|
||||
uses: actions/delete-package-versions@v5
|
||||
with:
|
||||
owner: ${{ github.repository_owner }}
|
||||
package-name: 'haproxy'
|
||||
package-type: container
|
||||
min-versions-to-keep: 1
|
||||
delete-only-untagged-versions: 'true'
|
||||
|
||||
run:
|
||||
needs: build
|
||||
strategy:
|
||||
matrix:
|
||||
suite: [
|
||||
{ client: picoquic, tests: "handshake,transfer,longrtt,chacha20,multiplexing,retry,http3,blackhole,amplificationlimit,handshakeloss,transferloss,handshakecorruption,transfercorruption,v2" },
|
||||
{ client: quic-go, tests: "handshake,transfer,longrtt,chacha20,multiplexing,retry,http3,blackhole,amplificationlimit,transferloss,transfercorruption,v2" }
|
||||
]
|
||||
fail-fast: false
|
||||
|
||||
name: ${{ matrix.suite.client }}
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install tshark
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install tshark
|
||||
|
||||
- name: Pull image
|
||||
run: |
|
||||
docker pull ghcr.io/${{ github.repository }}:libressl
|
||||
|
||||
- name: Run
|
||||
run: |
|
||||
git clone https://github.com/quic-interop/quic-interop-runner
|
||||
cd quic-interop-runner
|
||||
pip install -r requirements.txt --break-system-packages
|
||||
python run.py -j result.json -l logs-picoquic -r haproxy=local:libressl -t "handshake,transfer,longrtt,chacha20,multiplexing,retry,http3,blackhole,amplificationlimit,handshakeloss,transferloss,handshakecorruption,transfercorruption,v2" -c picoquic -s haproxy
|
||||
python run.py -j result.json -l logs-quic-go -r haproxy=local:libressl -t "handshake,transfer,longrtt,chacha20,multiplexing,retry,http3,blackhole,amplificationlimit,transferloss,transfercorruption,v2" -c quic-go -s haproxy
|
||||
python run.py -j result.json -l logs -r haproxy=ghcr.io/${{ github.repository }}:libressl -t ${{ matrix.suite.tests }} -c ${{ matrix.suite.client }} -s haproxy
|
||||
|
||||
- name: Delete succeeded logs
|
||||
if: failure()
|
||||
run: |
|
||||
for client in picoquic quic-go; do
|
||||
pushd quic-interop-runner/logs-${client}/haproxy_${client}
|
||||
cat ../../result.json | jq -r '.results[][] | select(.result=="succeeded") | .name' | xargs rm -rf
|
||||
popd
|
||||
done
|
||||
cd quic-interop-runner/logs/haproxy_${{ matrix.suite.client }}
|
||||
cat ../../result.json | jq -r '.results[][] | select(.result=="succeeded") | .name' | xargs rm -rf
|
||||
|
||||
- name: Logs upload
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: logs
|
||||
path: quic-interop-runner/logs*/
|
||||
name: logs-${{ matrix.suite.client }}
|
||||
path: quic-interop-runner/logs/
|
||||
retention-days: 6
|
||||
|
|
|
|||
17
.github/workflows/quictls.yml
vendored
17
.github/workflows/quictls.yml
vendored
|
|
@ -17,13 +17,16 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install VTest
|
||||
run: |
|
||||
scripts/build-vtest.sh
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
||||
sudo apt-get --no-install-recommends -y install socat gdb
|
||||
- name: Install QuicTLS
|
||||
run: env QUICTLS_VERSION=main QUICTLS_URL=https://github.com/quictls/quictls scripts/build-ssl.sh
|
||||
run: env QUICTLS=yes QUICTLS_URL=https://github.com/quictls/quictls scripts/build-ssl.sh
|
||||
- name: Compile HAProxy
|
||||
run: |
|
||||
make -j$(nproc) ERR=1 CC=gcc TARGET=linux-glibc \
|
||||
|
|
@ -39,11 +42,17 @@ jobs:
|
|||
ldd $(which haproxy)
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
- uses: ./.github/actions/setup-vtest
|
||||
- name: Install problem matcher for VTest
|
||||
run: echo "::add-matcher::.github/vtest.json"
|
||||
- name: Run VTest for HAProxy
|
||||
id: vtest
|
||||
run: |
|
||||
make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
# This is required for macOS which does not actually allow to increase
|
||||
# the '-n' soft limit to the hard limit, thus failing to run.
|
||||
ulimit -n 65536
|
||||
# allow to catch coredumps
|
||||
ulimit -c unlimited
|
||||
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Show VTest results
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
|
|
|
|||
42
.github/workflows/vtest.yml
vendored
42
.github/workflows/vtest.yml
vendored
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Generate Build Matrix
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
@ -44,10 +44,16 @@ jobs:
|
|||
TMPDIR: /tmp
|
||||
OT_CPP_VERSION: 1.6.0
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 100
|
||||
|
||||
- name: Setup coredumps
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||
run: |
|
||||
sudo sysctl -w fs.suid_dumpable=1
|
||||
sudo sysctl kernel.core_pattern=/tmp/core.%h.%e.%t
|
||||
|
||||
#
|
||||
# Github Action cache key cannot contain comma, so we calculate it based on job name
|
||||
#
|
||||
|
|
@ -57,9 +63,9 @@ jobs:
|
|||
echo "key=$(echo ${{ matrix.name }} | sha256sum | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache SSL libs
|
||||
if: ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && !contains(matrix.ssl, 'QUICTLS') }}
|
||||
if: ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && matrix.ssl != 'QUICTLS=yes' }}
|
||||
id: cache_ssl
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '~/opt/'
|
||||
key: ssl-${{ steps.generate-cache-key.outputs.key }}
|
||||
|
|
@ -67,10 +73,10 @@ jobs:
|
|||
- name: Cache OpenTracing
|
||||
if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
|
||||
id: cache_ot
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '~/opt-ot/'
|
||||
key: ${{ matrix.os }}-ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
|
||||
key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
|
||||
- name: Install apt dependencies
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||
run: |
|
||||
|
|
@ -87,7 +93,9 @@ jobs:
|
|||
run: |
|
||||
brew install socat
|
||||
brew install lua
|
||||
- uses: ./.github/actions/setup-vtest
|
||||
- name: Install VTest
|
||||
run: |
|
||||
scripts/build-vtest.sh
|
||||
- name: Install SSL ${{ matrix.ssl }}
|
||||
if: ${{ matrix.ssl && matrix.ssl != 'stock' && steps.cache_ssl.outputs.cache-hit != 'true' }}
|
||||
run: env ${{ matrix.ssl }} scripts/build-ssl.sh
|
||||
|
|
@ -113,16 +121,7 @@ jobs:
|
|||
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
||||
${{ join(matrix.FLAGS, ' ') }} \
|
||||
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
||||
sudo make install-bin
|
||||
- name: Compile admin/halog/halog
|
||||
run: |
|
||||
make -j$(nproc) admin/halog/halog \
|
||||
ERR=1 \
|
||||
TARGET=${{ matrix.TARGET }} \
|
||||
CC=${{ matrix.CC }} \
|
||||
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
||||
${{ join(matrix.FLAGS, ' ') }} \
|
||||
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
||||
sudo make install
|
||||
- name: Show HAProxy version
|
||||
id: show-version
|
||||
run: |
|
||||
|
|
@ -137,10 +136,17 @@ jobs:
|
|||
echo "::endgroup::"
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
- name: Install problem matcher for VTest
|
||||
# This allows one to more easily see which tests fail.
|
||||
run: echo "::add-matcher::.github/vtest.json"
|
||||
- name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
|
||||
id: vtest
|
||||
run: |
|
||||
make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
# This is required for macOS which does not actually allow to increase
|
||||
# the '-n' soft limit to the hard limit, thus failing to run.
|
||||
ulimit -n 65536
|
||||
ulimit -c unlimited
|
||||
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Show VTest results
|
||||
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
||||
run: |
|
||||
|
|
|
|||
3
.github/workflows/windows.yml
vendored
3
.github/workflows/windows.yml
vendored
|
|
@ -18,7 +18,6 @@ jobs:
|
|||
msys2:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
|
|
@ -36,7 +35,7 @@ jobs:
|
|||
- USE_THREAD=1
|
||||
- USE_ZLIB=1
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
install: >-
|
||||
|
|
|
|||
15
.github/workflows/wolfssl.yml
vendored
15
.github/workflows/wolfssl.yml
vendored
|
|
@ -13,7 +13,10 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'haproxy' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install VTest
|
||||
run: |
|
||||
scripts/build-vtest.sh
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
||||
|
|
@ -35,11 +38,17 @@ jobs:
|
|||
ldd $(which haproxy)
|
||||
haproxy -vv
|
||||
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
||||
- uses: ./.github/actions/setup-vtest
|
||||
- name: Install problem matcher for VTest
|
||||
run: echo "::add-matcher::.github/vtest.json"
|
||||
- name: Run VTest for HAProxy
|
||||
id: vtest
|
||||
run: |
|
||||
make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
# This is required for macOS which does not actually allow to increase
|
||||
# the '-n' soft limit to the hard limit, thus failing to run.
|
||||
ulimit -n 65536
|
||||
# allow to catch coredumps
|
||||
ulimit -c unlimited
|
||||
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
||||
- name: Run Unit tests
|
||||
id: unittests
|
||||
run: |
|
||||
|
|
|
|||
12
BRANCHES
12
BRANCHES
|
|
@ -171,17 +171,7 @@ feedback for developers:
|
|||
as the previous releases that had 6 months to stabilize. In terms of
|
||||
stability it really means that the point zero version already accumulated
|
||||
6 months of fixes and that it is much safer to use even just after it is
|
||||
released. There is one exception though, features marked as "experimental"
|
||||
are not guaranteed to be maintained beyond the release of the next LTS
|
||||
branch. The rationale here is that the experimental status is made to
|
||||
expose an early preview of a feature, that is often incomplete, not always
|
||||
in its definitive form regarding configuration, and for which developers
|
||||
are seeking feedback from the users. It is even possible that changes will
|
||||
be brought within the stable branch and it may happen that the feature
|
||||
breaks. It is not imaginable to always be able to backport bug fixes too
|
||||
far in this context since the code and configuration may change quite a
|
||||
bit. Users who want to try experimental features are expected to upgrade
|
||||
quickly to benefit from the improvements made to that feature.
|
||||
released.
|
||||
|
||||
- for developers, given that the odd versions are solely used by highly
|
||||
skilled users, it's easier to get advanced traces and captures, and there
|
||||
|
|
|
|||
45
INSTALL
45
INSTALL
|
|
@ -111,7 +111,7 @@ HAProxy requires a working GCC or Clang toolchain and GNU make :
|
|||
may want to retry with "gmake" which is the name commonly used for GNU make
|
||||
on BSD systems.
|
||||
|
||||
- GCC >= 4.7 (up to 15 tested). Older versions are no longer supported due to
|
||||
- GCC >= 4.7 (up to 14 tested). Older versions are no longer supported due to
|
||||
the latest mt_list update which only uses c11-like atomics. Newer versions
|
||||
may sometimes break due to compiler regressions or behaviour changes. The
|
||||
version shipped with your operating system is very likely to work with no
|
||||
|
|
@ -237,7 +237,7 @@ to forcefully enable it using "USE_LIBCRYPT=1".
|
|||
-----------------
|
||||
For SSL/TLS, it is necessary to use a cryptography library. HAProxy currently
|
||||
supports the OpenSSL library, and is known to build and work with branches
|
||||
1.0.0, 1.0.1, 1.0.2, 1.1.0, 1.1.1, and 3.0 to 3.6. It is recommended to use
|
||||
1.0.0, 1.0.1, 1.0.2, 1.1.0, 1.1.1, and 3.0 to 3.4. It is recommended to use
|
||||
at least OpenSSL 1.1.1 to have support for all SSL keywords and configuration
|
||||
in HAProxy. OpenSSL follows a long-term support cycle similar to HAProxy's,
|
||||
and each of the branches above receives its own fixes, without forcing you to
|
||||
|
|
@ -259,15 +259,11 @@ reported to work as well. While there are some efforts from the community to
|
|||
ensure they work well, OpenSSL remains the primary target and this means that
|
||||
in case of conflicting choices, OpenSSL support will be favored over other
|
||||
options. Note that QUIC is not fully supported when haproxy is built with
|
||||
OpenSSL < 3.5.2 version. In this case, QUICTLS or AWS-LC are the preferred
|
||||
alternatives. As of writing this, the QuicTLS project follows OpenSSL very
|
||||
closely and provides update simultaneously, but being a volunteer-driven
|
||||
project, its long-term future does not look certain enough to convince
|
||||
operating systems to package it, so it needs to be build locally. Recent
|
||||
versions of AWS-LC (>= 1.22 and the FIPS branches) are pretty complete and
|
||||
generally more performant than other OpenSSL derivatives, but may behave
|
||||
slightly differently, particularly when dealing with outdated setups. See
|
||||
the section about QUIC in this document.
|
||||
OpenSSL. In this case, QUICTLS is the preferred alternative. As of writing
|
||||
this, the QuicTLS project follows OpenSSL very closely and provides update
|
||||
simultaneously, but being a volunteer-driven project, its long-term future does
|
||||
not look certain enough to convince operating systems to package it, so it
|
||||
needs to be build locally. See the section about QUIC in this document.
|
||||
|
||||
A fifth option is wolfSSL (https://github.com/wolfSSL/wolfssl). It is the only
|
||||
supported alternative stack not based on OpenSSL, yet which implements almost
|
||||
|
|
@ -504,11 +500,10 @@ QUIC is the new transport layer protocol and is required for HTTP/3. This
|
|||
protocol stack is currently supported as an experimental feature in haproxy on
|
||||
the frontend side. In order to enable it, use "USE_QUIC=1 USE_OPENSSL=1".
|
||||
|
||||
Note that QUIC is not always fully supported by the OpenSSL library depending on
|
||||
its version. Indeed QUIC 0-RTT cannot be supported by OpenSSL for versions before
|
||||
3.5 contrary to others libraries with full QUIC support. The preferred option is
|
||||
to use QUICTLS. This is a fork of OpenSSL with a QUIC-compatible API. Its
|
||||
repository is available at this location:
|
||||
Note that QUIC is not fully supported by the OpenSSL library. Indeed QUIC 0-RTT
|
||||
cannot be supported by OpenSSL contrary to others libraries with full QUIC
|
||||
support. The preferred option is to use QUICTLS. This is a fork of OpenSSL with
|
||||
a QUIC-compatible API. Its repository is available at this location:
|
||||
|
||||
https://github.com/quictls/openssl
|
||||
|
||||
|
|
@ -536,18 +531,14 @@ way assuming that wolfSSL was installed in /opt/wolfssl-5.6.0 as shown in 4.5:
|
|||
SSL_INC=/opt/wolfssl-5.6.0/include SSL_LIB=/opt/wolfssl-5.6.0/lib
|
||||
LDFLAGS="-Wl,-rpath,/opt/wolfssl-5.6.0/lib"
|
||||
|
||||
As last resort, haproxy may be compiled against OpenSSL as follows from 3.5
|
||||
version with 0-RTT support:
|
||||
|
||||
$ make TARGET=generic USE_OPENSSL=1 USE_QUIC=1
|
||||
|
||||
or as follows for all OpenSSL versions but without O-RTT support:
|
||||
As last resort, haproxy may be compiled against OpenSSL as follows:
|
||||
|
||||
$ make TARGET=generic USE_OPENSSL=1 USE_QUIC=1 USE_QUIC_OPENSSL_COMPAT=1
|
||||
|
||||
In addition to this requirements, the QUIC listener bindings must be explicitly
|
||||
enabled with a specific QUIC tuning parameter. (see "limited-quic" global
|
||||
parameter of haproxy Configuration Manual).
|
||||
Note that QUIC 0-RTT is not supported by haproxy QUIC stack when built against
|
||||
OpenSSL. In addition to this compilation requirements, the QUIC listener
|
||||
bindings must be explicitly enabled with a specific QUIC tuning parameter.
|
||||
(see "limited-quic" global parameter of haproxy Configuration Manual).
|
||||
|
||||
|
||||
5) How to build HAProxy
|
||||
|
|
@ -563,9 +554,9 @@ It goes into more details with the main options.
|
|||
To build haproxy, you have to choose your target OS amongst the following ones
|
||||
and assign it to the TARGET variable :
|
||||
|
||||
- linux-glibc for Linux kernel 4.17 and above
|
||||
- linux-glibc for Linux kernel 2.6.28 and above
|
||||
- linux-glibc-legacy for Linux kernel 2.6.28 and above without new features
|
||||
- linux-musl for Linux kernel 4.17 and above with musl libc
|
||||
- linux-musl for Linux kernel 2.6.28 and above with musl libc
|
||||
- solaris for Solaris 10 and above
|
||||
- freebsd for FreeBSD 10 and above
|
||||
- dragonfly for DragonFlyBSD 4.3 and above
|
||||
|
|
|
|||
74
Makefile
74
Makefile
|
|
@ -35,7 +35,6 @@
|
|||
# USE_OPENSSL : enable use of OpenSSL. Recommended, but see below.
|
||||
# USE_OPENSSL_AWSLC : enable use of AWS-LC
|
||||
# USE_OPENSSL_WOLFSSL : enable use of wolfSSL with the OpenSSL API
|
||||
# USE_ECH : enable use of ECH with the OpenSSL API
|
||||
# USE_QUIC : enable use of QUIC with the quictls API (quictls, libressl, boringssl)
|
||||
# USE_QUIC_OPENSSL_COMPAT : enable use of QUIC with the standard openssl API (limited features)
|
||||
# USE_ENGINE : enable use of OpenSSL Engine.
|
||||
|
|
@ -63,8 +62,6 @@
|
|||
# USE_MEMORY_PROFILING : enable the memory profiler. Linux-glibc only.
|
||||
# USE_LIBATOMIC : force to link with/without libatomic. Automatic.
|
||||
# USE_PTHREAD_EMULATION : replace pthread's rwlocks with ours
|
||||
# USE_SHM_OPEN : use shm_open() for features that can make use of shared memory
|
||||
# USE_KTLS : use kTLS.(requires at least Linux 4.17).
|
||||
#
|
||||
# Options can be forced by specifying "USE_xxx=1" or can be disabled by using
|
||||
# "USE_xxx=" (empty string). The list of enabled and disabled options for a
|
||||
|
|
@ -214,8 +211,7 @@ UNIT_TEST_SCRIPT=./scripts/run-unittests.sh
|
|||
# undefined behavior to silently produce invalid code. For this reason we have
|
||||
# to use -fwrapv or -fno-strict-overflow to guarantee the intended behavior.
|
||||
# It is preferable not to change this option in order to avoid breakage.
|
||||
STD_CFLAGS := $(call cc-opt-alt,-fwrapv,-fno-strict-overflow) \
|
||||
$(call cc-opt,-fvect-cost-model=very-cheap)
|
||||
STD_CFLAGS := $(call cc-opt-alt,-fwrapv,-fno-strict-overflow)
|
||||
|
||||
#### Compiler-specific flags to enable certain classes of warnings.
|
||||
# Some are hard-coded, others are enabled only if supported.
|
||||
|
|
@ -342,16 +338,14 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER USE_POLL \
|
|||
USE_TPROXY USE_LINUX_TPROXY USE_LINUX_CAP \
|
||||
USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H USE_ENGINE \
|
||||
USE_GETADDRINFO USE_OPENSSL USE_OPENSSL_WOLFSSL USE_OPENSSL_AWSLC \
|
||||
USE_ECH \
|
||||
USE_SSL USE_LUA USE_ACCEPT4 USE_CLOSEFROM USE_ZLIB USE_SLZ \
|
||||
USE_CPU_AFFINITY USE_TFO USE_NS USE_DL USE_RT USE_LIBATOMIC \
|
||||
USE_MATH USE_DEVICEATLAS USE_51DEGREES \
|
||||
USE_WURFL USE_OBSOLETE_LINKER USE_PRCTL USE_PROCCTL \
|
||||
USE_THREAD_DUMP USE_EVPORTS USE_OT USE_QUIC USE_PROMEX \
|
||||
USE_MEMORY_PROFILING USE_SHM_OPEN \
|
||||
USE_MEMORY_PROFILING \
|
||||
USE_STATIC_PCRE USE_STATIC_PCRE2 \
|
||||
USE_PCRE USE_PCRE_JIT USE_PCRE2 USE_PCRE2_JIT \
|
||||
USE_QUIC_OPENSSL_COMPAT USE_KTLS
|
||||
USE_PCRE USE_PCRE_JIT USE_PCRE2 USE_PCRE2_JIT USE_QUIC_OPENSSL_COMPAT
|
||||
|
||||
# preset all variables for all supported build options among use_opts
|
||||
$(reset_opts_vars)
|
||||
|
|
@ -382,13 +376,13 @@ ifeq ($(TARGET),haiku)
|
|||
set_target_defaults = $(call default_opts,USE_POLL USE_TPROXY USE_OBSOLETE_LINKER)
|
||||
endif
|
||||
|
||||
# For linux >= 4.17 and glibc
|
||||
# For linux >= 2.6.28 and glibc
|
||||
ifeq ($(TARGET),linux-glibc)
|
||||
set_target_defaults = $(call default_opts, \
|
||||
USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER \
|
||||
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY USE_LINUX_CAP \
|
||||
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \
|
||||
USE_GETADDRINFO USE_BACKTRACE USE_SHM_OPEN USE_KTLS)
|
||||
USE_GETADDRINFO USE_BACKTRACE)
|
||||
INSTALL = install -v
|
||||
endif
|
||||
|
||||
|
|
@ -401,13 +395,13 @@ ifeq ($(TARGET),linux-glibc-legacy)
|
|||
INSTALL = install -v
|
||||
endif
|
||||
|
||||
# For linux >= 4.17 and musl
|
||||
# For linux >= 2.6.28 and musl
|
||||
ifeq ($(TARGET),linux-musl)
|
||||
set_target_defaults = $(call default_opts, \
|
||||
USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER \
|
||||
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY USE_LINUX_CAP \
|
||||
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \
|
||||
USE_GETADDRINFO USE_BACKTRACE USE_SHM_OPEN USE_KTLS)
|
||||
USE_GETADDRINFO USE_BACKTRACE)
|
||||
INSTALL = install -v
|
||||
endif
|
||||
|
||||
|
|
@ -601,10 +595,6 @@ ifneq ($(USE_BACKTRACE:0=),)
|
|||
BACKTRACE_CFLAGS = -fno-omit-frame-pointer
|
||||
endif
|
||||
|
||||
ifneq ($(USE_MEMORY_PROFILING:0=),)
|
||||
MEMORY_PROFILING_CFLAGS = -fno-optimize-sibling-calls
|
||||
endif
|
||||
|
||||
ifneq ($(USE_CPU_AFFINITY:0=),)
|
||||
OPTIONS_OBJS += src/cpuset.o
|
||||
OPTIONS_OBJS += src/cpu_topo.o
|
||||
|
|
@ -643,7 +633,7 @@ ifneq ($(USE_OPENSSL:0=),)
|
|||
OPTIONS_OBJS += src/ssl_sock.o src/ssl_ckch.o src/ssl_ocsp.o src/ssl_crtlist.o \
|
||||
src/ssl_sample.o src/cfgparse-ssl.o src/ssl_gencert.o \
|
||||
src/ssl_utils.o src/jwt.o src/ssl_clienthello.o src/jws.o src/acme.o \
|
||||
src/acme_resolvers.o src/ssl_trace.o src/jwe.o
|
||||
src/ssl_trace.o
|
||||
endif
|
||||
|
||||
ifneq ($(USE_ENGINE:0=),)
|
||||
|
|
@ -670,7 +660,7 @@ OPTIONS_OBJS += src/mux_quic.o src/h3.o src/quic_rx.o src/quic_tx.o \
|
|||
src/quic_cc_nocc.o src/quic_cc.o src/quic_pacing.o \
|
||||
src/h3_stats.o src/quic_stats.o src/qpack-enc.o \
|
||||
src/qpack-tbl.o src/quic_cc_drs.o src/quic_fctl.o \
|
||||
src/quic_enc.o src/mux_quic_qstrm.o src/xprt_qstrm.o
|
||||
src/cbuf.o src/quic_enc.o
|
||||
endif
|
||||
|
||||
ifneq ($(USE_QUIC_OPENSSL_COMPAT:0=),)
|
||||
|
|
@ -956,7 +946,6 @@ endif # obsolete targets
|
|||
endif # TARGET
|
||||
|
||||
OBJS =
|
||||
HATERM_OBJS =
|
||||
|
||||
ifneq ($(EXTRA_OBJS),)
|
||||
OBJS += $(EXTRA_OBJS)
|
||||
|
|
@ -970,15 +959,15 @@ OBJS += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o src/log.o \
|
|||
src/cache.o src/stconn.o src/http_htx.o src/debug.o \
|
||||
src/check.o src/stats-html.o src/haproxy.o src/listener.o \
|
||||
src/applet.o src/pattern.o src/cfgparse-listen.o \
|
||||
src/flt_spoe.o src/cebis_tree.o src/http_ext.o \
|
||||
src/http_act.o src/http_fetch.o src/cebs_tree.o \
|
||||
src/cebib_tree.o src/http_client.o src/dns.o \
|
||||
src/cebb_tree.o src/vars.o src/event_hdl.o src/tcp_rules.o \
|
||||
src/flt_spoe.o src/cebuis_tree.o src/http_ext.o \
|
||||
src/http_act.o src/http_fetch.o src/cebus_tree.o \
|
||||
src/cebuib_tree.o src/http_client.o src/dns.o \
|
||||
src/cebub_tree.o src/vars.o src/event_hdl.o src/tcp_rules.o \
|
||||
src/trace.o src/stats-proxy.o src/pool.o src/stats.o \
|
||||
src/cfgparse-global.o src/filters.o src/mux_pt.o \
|
||||
src/flt_http_comp.o src/sock.o src/h1.o src/sink.o \
|
||||
src/ceba_tree.o src/session.o src/payload.o src/htx.o \
|
||||
src/cebl_tree.o src/ceb32_tree.o src/ceb64_tree.o \
|
||||
src/cebua_tree.o src/session.o src/payload.o src/htx.o \
|
||||
src/cebul_tree.o src/cebu32_tree.o src/cebu64_tree.o \
|
||||
src/server_state.o src/proto_rhttp.o src/flt_trace.o src/fd.o \
|
||||
src/task.o src/map.o src/fcgi-app.o src/h2.o src/mworker.o \
|
||||
src/tcp_sample.o src/mjson.o src/h1_htx.o src/tcp_act.o \
|
||||
|
|
@ -993,9 +982,9 @@ OBJS += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o src/log.o \
|
|||
src/cfgcond.o src/proto_udp.o src/lb_fwlc.o src/ebmbtree.o \
|
||||
src/proto_uxdg.o src/cfgdiag.o src/sock_unix.o src/sha1.o \
|
||||
src/lb_fas.o src/clock.o src/sock_inet.o src/ev_select.o \
|
||||
src/lb_map.o src/shctx.o src/hpack-dec.o src/net_helper.o \
|
||||
src/lb_map.o src/shctx.o src/mworker-prog.o src/hpack-dec.o \
|
||||
src/arg.o src/signal.o src/fix.o src/dynbuf.o src/guid.o \
|
||||
src/cfgparse-tcp.o src/lb_ss.o src/chunk.o src/counters.o \
|
||||
src/cfgparse-tcp.o src/lb_ss.o src/chunk.o \
|
||||
src/cfgparse-unix.o src/regex.o src/fcgi.o src/uri_auth.o \
|
||||
src/eb64tree.o src/eb32tree.o src/eb32sctree.o src/lru.o \
|
||||
src/limits.o src/ebimtree.o src/wdt.o src/hpack-tbl.o \
|
||||
|
|
@ -1003,15 +992,12 @@ OBJS += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o src/log.o \
|
|||
src/ebsttree.o src/freq_ctr.o src/systemd.o src/init.o \
|
||||
src/http_acl.o src/dict.o src/dgram.o src/pipe.o \
|
||||
src/hpack-huff.o src/hpack-enc.o src/ebtree.o src/hash.o \
|
||||
src/httpclient_cli.o src/version.o src/ncbmbuf.o src/ech.o \
|
||||
src/cfgparse-peers.o src/haterm.o
|
||||
src/version.o
|
||||
|
||||
ifneq ($(TRACE),)
|
||||
OBJS += src/calltrace.o
|
||||
endif
|
||||
|
||||
HATERM_OBJS += $(OBJS) src/haterm_init.o
|
||||
|
||||
# Used only for forced dependency checking. May be cleared during development.
|
||||
INCLUDES = $(wildcard include/*/*.h)
|
||||
DEP = $(INCLUDES) .build_opts
|
||||
|
|
@ -1043,7 +1029,7 @@ IGNORE_OPTS=help install install-man install-doc install-bin \
|
|||
uninstall clean tags cscope tar git-tar version update-version \
|
||||
opts reg-tests reg-tests-help unit-tests admin/halog/halog dev/flags/flags \
|
||||
dev/haring/haring dev/ncpu/ncpu dev/poll/poll dev/tcploop/tcploop \
|
||||
dev/term_events/term_events dev/gdb/pm-from-core dev/gdb/libs-from-core
|
||||
dev/term_events/term_events
|
||||
|
||||
ifneq ($(TARGET),)
|
||||
ifeq ($(filter $(firstword $(MAKECMDGOALS)),$(IGNORE_OPTS)),)
|
||||
|
|
@ -1059,9 +1045,6 @@ endif # non-empty target
|
|||
haproxy: $(OPTIONS_OBJS) $(OBJS)
|
||||
$(cmd_LD) $(ARCH_FLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
||||
|
||||
haterm: $(OPTIONS_OBJS) $(HATERM_OBJS)
|
||||
$(cmd_LD) $(ARCH_FLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
||||
|
||||
objsize: haproxy
|
||||
$(Q)objdump -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort
|
||||
|
||||
|
|
@ -1077,12 +1060,6 @@ admin/dyncookie/dyncookie: admin/dyncookie/dyncookie.o
|
|||
dev/flags/flags: dev/flags/flags.o
|
||||
$(cmd_LD) $(ARCH_FLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
||||
|
||||
dev/gdb/libs-from-core: dev/gdb/libs-from-core.o
|
||||
$(cmd_LD) $(ARCH_FLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
||||
|
||||
dev/gdb/pm-from-core: dev/gdb/pm-from-core.o
|
||||
$(cmd_LD) $(ARCH_FLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
||||
|
||||
dev/haring/haring: dev/haring/haring.o
|
||||
$(cmd_LD) $(ARCH_FLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
||||
|
||||
|
|
@ -1136,11 +1113,6 @@ install-doc:
|
|||
$(INSTALL) -m 644 doc/$$x.txt "$(DESTDIR)$(DOCDIR)" ; \
|
||||
done
|
||||
|
||||
install-admin:
|
||||
$(Q)$(INSTALL) -d "$(DESTDIR)$(SBINDIR)"
|
||||
$(Q)$(INSTALL) admin/cli/haproxy-dump-certs "$(DESTDIR)$(SBINDIR)"
|
||||
$(Q)$(INSTALL) admin/cli/haproxy-reload "$(DESTDIR)$(SBINDIR)"
|
||||
|
||||
install-bin:
|
||||
$(Q)for i in haproxy $(EXTRA); do \
|
||||
if ! [ -e "$$i" ]; then \
|
||||
|
|
@ -1151,7 +1123,7 @@ install-bin:
|
|||
$(Q)$(INSTALL) -d "$(DESTDIR)$(SBINDIR)"
|
||||
$(Q)$(INSTALL) haproxy $(EXTRA) "$(DESTDIR)$(SBINDIR)"
|
||||
|
||||
install: install-bin install-admin install-man install-doc
|
||||
install: install-bin install-man install-doc
|
||||
|
||||
uninstall:
|
||||
$(Q)rm -f "$(DESTDIR)$(MANDIR)"/man1/haproxy.1
|
||||
|
|
@ -1181,7 +1153,7 @@ distclean: clean
|
|||
$(Q)rm -f admin/dyncookie/dyncookie
|
||||
$(Q)rm -f dev/haring/haring dev/ncpu/ncpu{,.so} dev/poll/poll dev/tcploop/tcploop
|
||||
$(Q)rm -f dev/hpack/decode dev/hpack/gen-enc dev/hpack/gen-rht
|
||||
$(Q)rm -f dev/qpack/decode dev/gdb/pm-from-core dev/gdb/libs-from-core
|
||||
$(Q)rm -f dev/qpack/decode
|
||||
|
||||
tags:
|
||||
$(Q)find src include \( -name '*.c' -o -name '*.h' \) -print0 | \
|
||||
|
|
@ -1308,8 +1280,6 @@ unit-tests:
|
|||
# options for all commits within RANGE. RANGE may be either a git range
|
||||
# such as ref1..ref2 or a single commit, in which case all commits from
|
||||
# the master branch to this one will be tested.
|
||||
# Will execute TEST_CMD for each commit if defined, and will stop in case of
|
||||
# failure.
|
||||
|
||||
range:
|
||||
$(Q)[ -d .git/. ] || { echo "## Fatal: \"make $@\" may only be used inside a Git repository."; exit 1; }
|
||||
|
|
@ -1335,8 +1305,6 @@ range:
|
|||
echo "[ $$index/$$count ] $$commit #############################"; \
|
||||
git checkout -q $$commit || die 1; \
|
||||
$(MAKE) all || die 1; \
|
||||
set -- $(TEST_CMD); \
|
||||
[ "$$#" -eq 0 ] || "$$@" || die 1; \
|
||||
index=$$((index + 1)); \
|
||||
done; \
|
||||
echo;echo "Done! $${count} commit(s) built successfully for RANGE $${RANGE}" ; \
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
[](https://github.com/haproxy/haproxy/actions/workflows/musl.yml)
|
||||
[](https://github.com/haproxy/haproxy/actions/workflows/aws-lc.yml)
|
||||
[](https://github.com/haproxy/haproxy/actions/workflows/openssl-nodeprecated.yml)
|
||||
[](https://github.com/haproxy/haproxy/actions/workflows/illumos.yml)
|
||||
[](https://github.com/haproxy/haproxy/actions/workflows/netbsd.yml)
|
||||
[](https://cirrus-ci.com/github/haproxy/haproxy/)
|
||||
|
|
|
|||
2
VERDATE
2
VERDATE
|
|
@ -1,2 +1,2 @@
|
|||
$Format:%ci$
|
||||
2026/04/03
|
||||
2025/05/14
|
||||
|
|
|
|||
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
3.4-dev8
|
||||
3.2-dev16
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ CXX := c++
|
|||
CXXLIB := -lstdc++
|
||||
|
||||
ifeq ($(DEVICEATLAS_SRC),)
|
||||
OPTIONS_CFLAGS += -I$(DEVICEATLAS_INC)
|
||||
OPTIONS_LDFLAGS += -Wl,-rpath,$(DEVICEATLAS_LIB) -L$(DEVICEATLAS_LIB) -lda
|
||||
OPTIONS_LDFLAGS += -lda
|
||||
else
|
||||
DEVICEATLAS_INC = $(DEVICEATLAS_SRC)
|
||||
DEVICEATLAS_LIB = $(DEVICEATLAS_SRC)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ static struct {
|
|||
da_atlas_t atlas;
|
||||
da_evidence_id_t useragentid;
|
||||
da_severity_t loglevel;
|
||||
size_t maxhdrlen;
|
||||
char separator;
|
||||
unsigned char daset:1;
|
||||
} global_deviceatlas = {
|
||||
|
|
@ -43,7 +42,6 @@ static struct {
|
|||
.atlasmap = NULL,
|
||||
.atlasfd = -1,
|
||||
.useragentid = 0,
|
||||
.maxhdrlen = 0,
|
||||
.daset = 0,
|
||||
.separator = '|',
|
||||
};
|
||||
|
|
@ -59,10 +57,6 @@ static int da_json_file(char **args, int section_type, struct proxy *curpx,
|
|||
return -1;
|
||||
}
|
||||
global_deviceatlas.jsonpath = strdup(args[1]);
|
||||
if (unlikely(global_deviceatlas.jsonpath == NULL)) {
|
||||
memprintf(err, "deviceatlas json file : out of memory.\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +73,6 @@ static int da_log_level(char **args, int section_type, struct proxy *curpx,
|
|||
loglevel = atol(args[1]);
|
||||
if (loglevel < 0 || loglevel > 3) {
|
||||
memprintf(err, "deviceatlas log level : expects a log level between 0 and 3, %s given.\n", args[1]);
|
||||
return -1;
|
||||
} else {
|
||||
global_deviceatlas.loglevel = (da_severity_t)loglevel;
|
||||
}
|
||||
|
|
@ -108,10 +101,6 @@ static int da_properties_cookie(char **args, int section_type, struct proxy *cur
|
|||
return -1;
|
||||
} else {
|
||||
global_deviceatlas.cookiename = strdup(args[1]);
|
||||
if (unlikely(global_deviceatlas.cookiename == NULL)) {
|
||||
memprintf(err, "deviceatlas cookie name : out of memory.\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
global_deviceatlas.cookienamelen = strlen(global_deviceatlas.cookiename);
|
||||
return 0;
|
||||
|
|
@ -130,7 +119,6 @@ static int da_cache_size(char **args, int section_type, struct proxy *curpx,
|
|||
cachesize = atol(args[1]);
|
||||
if (cachesize < 0 || cachesize > DA_CACHE_MAX) {
|
||||
memprintf(err, "deviceatlas cache size : expects a cache size between 0 and %d, %s given.\n", DA_CACHE_MAX, args[1]);
|
||||
return -1;
|
||||
} else {
|
||||
#ifdef APINOCACHE
|
||||
fprintf(stdout, "deviceatlas cache size : no-op, its support is disabled.\n");
|
||||
|
|
@ -177,7 +165,7 @@ static int init_deviceatlas(void)
|
|||
da_status_t status;
|
||||
|
||||
jsonp = fopen(global_deviceatlas.jsonpath, "r");
|
||||
if (unlikely(jsonp == 0)) {
|
||||
if (jsonp == 0) {
|
||||
ha_alert("deviceatlas : '%s' json file has invalid path or is not readable.\n",
|
||||
global_deviceatlas.jsonpath);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
|
|
@ -189,11 +177,9 @@ static int init_deviceatlas(void)
|
|||
status = da_atlas_compile(jsonp, da_haproxy_read, da_haproxy_seek,
|
||||
&global_deviceatlas.atlasimgptr, &atlasimglen);
|
||||
fclose(jsonp);
|
||||
if (unlikely(status != DA_OK)) {
|
||||
if (status != DA_OK) {
|
||||
ha_alert("deviceatlas : '%s' json file is invalid.\n",
|
||||
global_deviceatlas.jsonpath);
|
||||
free(global_deviceatlas.atlasimgptr);
|
||||
da_fini();
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -201,10 +187,8 @@ static int init_deviceatlas(void)
|
|||
status = da_atlas_open(&global_deviceatlas.atlas, extraprops,
|
||||
global_deviceatlas.atlasimgptr, atlasimglen);
|
||||
|
||||
if (unlikely(status != DA_OK)) {
|
||||
if (status != DA_OK) {
|
||||
ha_alert("deviceatlas : data could not be compiled.\n");
|
||||
free(global_deviceatlas.atlasimgptr);
|
||||
da_fini();
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -213,28 +197,11 @@ static int init_deviceatlas(void)
|
|||
|
||||
if (global_deviceatlas.cookiename == 0) {
|
||||
global_deviceatlas.cookiename = strdup(DA_COOKIENAME_DEFAULT);
|
||||
if (unlikely(global_deviceatlas.cookiename == NULL)) {
|
||||
ha_alert("deviceatlas : out of memory.\n");
|
||||
da_atlas_close(&global_deviceatlas.atlas);
|
||||
free(global_deviceatlas.atlasimgptr);
|
||||
da_fini();
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
global_deviceatlas.cookienamelen = strlen(global_deviceatlas.cookiename);
|
||||
}
|
||||
|
||||
global_deviceatlas.useragentid = da_atlas_header_evidence_id(&global_deviceatlas.atlas,
|
||||
"user-agent");
|
||||
{
|
||||
size_t hi;
|
||||
global_deviceatlas.maxhdrlen = 16;
|
||||
for (hi = 0; hi < global_deviceatlas.atlas.header_evidence_count; hi++) {
|
||||
size_t nl = strlen(global_deviceatlas.atlas.header_priorities[hi].name);
|
||||
if (nl > global_deviceatlas.maxhdrlen)
|
||||
global_deviceatlas.maxhdrlen = nl;
|
||||
}
|
||||
}
|
||||
if ((global_deviceatlas.atlasfd = shm_open(ATLASMAPNM, O_RDWR, 0660)) != -1) {
|
||||
global_deviceatlas.atlasmap = mmap(NULL, ATLASTOKSZ, PROT_READ | PROT_WRITE, MAP_SHARED, global_deviceatlas.atlasfd, 0);
|
||||
if (global_deviceatlas.atlasmap == MAP_FAILED) {
|
||||
|
|
@ -264,22 +231,24 @@ static void deinit_deviceatlas(void)
|
|||
free(global_deviceatlas.cookiename);
|
||||
da_atlas_close(&global_deviceatlas.atlas);
|
||||
free(global_deviceatlas.atlasimgptr);
|
||||
da_fini();
|
||||
}
|
||||
|
||||
if (global_deviceatlas.atlasfd != -1) {
|
||||
munmap(global_deviceatlas.atlasmap, ATLASTOKSZ);
|
||||
close(global_deviceatlas.atlasfd);
|
||||
shm_unlink(ATLASMAPNM);
|
||||
}
|
||||
|
||||
da_fini();
|
||||
}
|
||||
|
||||
static void da_haproxy_checkinst(void)
|
||||
{
|
||||
if (global_deviceatlas.atlasmap != 0) {
|
||||
char *base;
|
||||
base = (char *)global_deviceatlas.atlasmap;
|
||||
char *base;
|
||||
base = (char *)global_deviceatlas.atlasmap;
|
||||
|
||||
if (base[0] != 0) {
|
||||
if (base[0] != 0) {
|
||||
FILE *jsonp;
|
||||
void *cnew;
|
||||
da_status_t status;
|
||||
|
|
@ -289,10 +258,6 @@ static void da_haproxy_checkinst(void)
|
|||
da_property_decl_t extraprops[1] = {{NULL, 0}};
|
||||
#ifdef USE_THREAD
|
||||
HA_SPIN_LOCK(OTHER_LOCK, &dadwsch_lock);
|
||||
if (base[0] == 0) {
|
||||
HA_SPIN_UNLOCK(OTHER_LOCK, &dadwsch_lock);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
strlcpy2(atlasp, base + sizeof(char), sizeof(atlasp));
|
||||
jsonp = fopen(atlasp, "r");
|
||||
|
|
@ -310,20 +275,10 @@ static void da_haproxy_checkinst(void)
|
|||
fclose(jsonp);
|
||||
if (status == DA_OK) {
|
||||
if (da_atlas_open(&inst, extraprops, cnew, atlassz) == DA_OK) {
|
||||
inst.config.cache_size = global_deviceatlas.cachesize;
|
||||
da_atlas_close(&global_deviceatlas.atlas);
|
||||
free(global_deviceatlas.atlasimgptr);
|
||||
global_deviceatlas.atlasimgptr = cnew;
|
||||
global_deviceatlas.atlas = inst;
|
||||
{
|
||||
size_t hi;
|
||||
global_deviceatlas.maxhdrlen = 16;
|
||||
for (hi = 0; hi < inst.header_evidence_count; hi++) {
|
||||
size_t nl = strlen(inst.header_priorities[hi].name);
|
||||
if (nl > global_deviceatlas.maxhdrlen)
|
||||
global_deviceatlas.maxhdrlen = nl;
|
||||
}
|
||||
}
|
||||
base[0] = 0;
|
||||
ha_notice("deviceatlas : new instance, data file date `%s`.\n",
|
||||
da_getdatacreationiso8601(&global_deviceatlas.atlas));
|
||||
|
|
@ -331,8 +286,6 @@ static void da_haproxy_checkinst(void)
|
|||
ha_alert("deviceatlas : instance update failed.\n");
|
||||
free(cnew);
|
||||
}
|
||||
} else {
|
||||
free(cnew);
|
||||
}
|
||||
#ifdef USE_THREAD
|
||||
HA_SPIN_UNLOCK(OTHER_LOCK, &dadwsch_lock);
|
||||
|
|
@ -344,7 +297,7 @@ static void da_haproxy_checkinst(void)
|
|||
static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_t *devinfo)
|
||||
{
|
||||
struct buffer *tmp;
|
||||
da_propid_t prop;
|
||||
da_propid_t prop, *pprop;
|
||||
da_status_t status;
|
||||
da_type_t proptype;
|
||||
const char *propname;
|
||||
|
|
@ -364,15 +317,13 @@ static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_
|
|||
chunk_appendf(tmp, "%c", global_deviceatlas.separator);
|
||||
continue;
|
||||
}
|
||||
if (unlikely(da_atlas_getproptype(&global_deviceatlas.atlas, prop, &proptype) != DA_OK)) {
|
||||
chunk_appendf(tmp, "%c", global_deviceatlas.separator);
|
||||
continue;
|
||||
}
|
||||
pprop = ∝
|
||||
da_atlas_getproptype(&global_deviceatlas.atlas, *pprop, &proptype);
|
||||
|
||||
switch (proptype) {
|
||||
case DA_TYPE_BOOLEAN: {
|
||||
bool val;
|
||||
status = da_getpropboolean(devinfo, prop, &val);
|
||||
status = da_getpropboolean(devinfo, *pprop, &val);
|
||||
if (status == DA_OK) {
|
||||
chunk_appendf(tmp, "%d", val);
|
||||
}
|
||||
|
|
@ -381,7 +332,7 @@ static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_
|
|||
case DA_TYPE_INTEGER:
|
||||
case DA_TYPE_NUMBER: {
|
||||
long val;
|
||||
status = da_getpropinteger(devinfo, prop, &val);
|
||||
status = da_getpropinteger(devinfo, *pprop, &val);
|
||||
if (status == DA_OK) {
|
||||
chunk_appendf(tmp, "%ld", val);
|
||||
}
|
||||
|
|
@ -389,7 +340,7 @@ static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_
|
|||
}
|
||||
case DA_TYPE_STRING: {
|
||||
const char *val;
|
||||
status = da_getpropstring(devinfo, prop, &val);
|
||||
status = da_getpropstring(devinfo, *pprop, &val);
|
||||
if (status == DA_OK) {
|
||||
chunk_appendf(tmp, "%s", val);
|
||||
}
|
||||
|
|
@ -420,26 +371,29 @@ static int da_haproxy_conv(const struct arg *args, struct sample *smp, void *pri
|
|||
{
|
||||
da_deviceinfo_t devinfo;
|
||||
da_status_t status;
|
||||
char useragentbuf[1024];
|
||||
const char *useragent;
|
||||
char useragentbuf[1024] = { 0 };
|
||||
int i;
|
||||
|
||||
if (unlikely(global_deviceatlas.daset == 0) || smp->data.u.str.data == 0) {
|
||||
if (global_deviceatlas.daset == 0 || smp->data.u.str.data == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
da_haproxy_checkinst();
|
||||
|
||||
i = smp->data.u.str.data > sizeof(useragentbuf) - 1 ? sizeof(useragentbuf) - 1 : smp->data.u.str.data;
|
||||
memcpy(useragentbuf, smp->data.u.str.area, i);
|
||||
useragentbuf[i] = 0;
|
||||
i = smp->data.u.str.data > sizeof(useragentbuf) ? sizeof(useragentbuf) : smp->data.u.str.data;
|
||||
memcpy(useragentbuf, smp->data.u.str.area, i - 1);
|
||||
useragentbuf[i - 1] = 0;
|
||||
|
||||
useragent = (const char *)useragentbuf;
|
||||
|
||||
status = da_search(&global_deviceatlas.atlas, &devinfo,
|
||||
global_deviceatlas.useragentid, useragentbuf, 0);
|
||||
global_deviceatlas.useragentid, useragent, 0);
|
||||
|
||||
return status != DA_OK ? 0 : da_haproxy(args, smp, &devinfo);
|
||||
}
|
||||
|
||||
#define DA_MAX_HEADERS 32
|
||||
#define DA_MAX_HEADERS 24
|
||||
|
||||
static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
|
|
@ -449,10 +403,10 @@ static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const ch
|
|||
struct channel *chn;
|
||||
struct htx *htx;
|
||||
struct htx_blk *blk;
|
||||
char vbuf[DA_MAX_HEADERS][1024];
|
||||
char vbuf[DA_MAX_HEADERS][1024] = {{ 0 }};
|
||||
int i, nbh = 0;
|
||||
|
||||
if (unlikely(global_deviceatlas.daset == 0)) {
|
||||
if (global_deviceatlas.daset == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -460,17 +414,18 @@ static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const ch
|
|||
|
||||
chn = (smp->strm ? &smp->strm->req : NULL);
|
||||
htx = smp_prefetch_htx(smp, chn, NULL, 1);
|
||||
if (unlikely(!htx))
|
||||
if (!htx)
|
||||
return 0;
|
||||
|
||||
i = 0;
|
||||
for (blk = htx_get_first_blk(htx); nbh < DA_MAX_HEADERS && blk; blk = htx_get_next_blk(htx, blk)) {
|
||||
size_t vlen;
|
||||
char *pval;
|
||||
da_evidence_id_t evid;
|
||||
enum htx_blk_type type;
|
||||
struct ist n, v;
|
||||
char hbuf[64];
|
||||
char tval[1024];
|
||||
char hbuf[24] = { 0 };
|
||||
char tval[1024] = { 0 };
|
||||
|
||||
type = htx_get_blk_type(blk);
|
||||
|
||||
|
|
@ -483,18 +438,20 @@ static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const ch
|
|||
continue;
|
||||
}
|
||||
|
||||
if (n.len > global_deviceatlas.maxhdrlen || n.len >= sizeof(hbuf)) {
|
||||
/* The HTTP headers used by the DeviceAtlas API are not longer */
|
||||
if (n.len >= sizeof(hbuf)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
memcpy(hbuf, n.ptr, n.len);
|
||||
hbuf[n.len] = 0;
|
||||
pval = v.ptr;
|
||||
vlen = v.len;
|
||||
evid = -1;
|
||||
i = v.len > sizeof(tval) - 1 ? sizeof(tval) - 1 : v.len;
|
||||
memcpy(tval, v.ptr, i);
|
||||
tval[i] = 0;
|
||||
pval = tval;
|
||||
vlen = i;
|
||||
|
||||
if (strcasecmp(hbuf, "Accept-Language") == 0) {
|
||||
evid = da_atlas_accept_language_evidence_id(&global_deviceatlas.atlas);
|
||||
|
|
@ -512,7 +469,7 @@ static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const ch
|
|||
continue;
|
||||
}
|
||||
|
||||
vlen = pl;
|
||||
vlen -= global_deviceatlas.cookienamelen - 1;
|
||||
pval = p;
|
||||
evid = da_atlas_clientprop_evidence_id(&global_deviceatlas.atlas);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -141,11 +141,6 @@ enum {
|
|||
DA_INITIAL_MEMORY_ESTIMATE = 1024 * 1024 * 14
|
||||
};
|
||||
|
||||
struct header_evidence_entry {
|
||||
const char *name;
|
||||
da_evidence_id_t id;
|
||||
};
|
||||
|
||||
struct da_config {
|
||||
unsigned int cache_size;
|
||||
unsigned int __reserved[15]; /* enough reserved keywords for future use */
|
||||
|
|
|
|||
|
|
@ -389,9 +389,6 @@ listed below. Metrics from extra counters are not listed.
|
|||
| haproxy_server_max_connect_time_seconds |
|
||||
| haproxy_server_max_response_time_seconds |
|
||||
| haproxy_server_max_total_time_seconds |
|
||||
| haproxy_server_agent_status |
|
||||
| haproxy_server_agent_code |
|
||||
| haproxy_server_agent_duration_seconds |
|
||||
| haproxy_server_internal_errors_total |
|
||||
| haproxy_server_unsafe_idle_connections_current |
|
||||
| haproxy_server_safe_idle_connections_current |
|
||||
|
|
@ -407,7 +404,6 @@ listed below. Metrics from extra counters are not listed.
|
|||
+----------------------------------------------------+
|
||||
| haproxy_sticktable_size |
|
||||
| haproxy_sticktable_used |
|
||||
| haproxy_sticktable_local_updates |
|
||||
+----------------------------------------------------+
|
||||
|
||||
* Resolvers metrics
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
/* Prometheus exporter flags (ctx->flags) */
|
||||
#define PROMEX_FL_METRIC_HDR 0x00000001
|
||||
#define PROMEX_FL_BODYLESS_RESP 0x00000002
|
||||
/* unused: 0x00000002 */
|
||||
/* unused: 0x00000004 */
|
||||
/* unused: 0x00000008 */
|
||||
/* unused: 0x00000010 */
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include <haproxy/stats.h>
|
||||
#include <haproxy/stconn.h>
|
||||
#include <haproxy/stream.h>
|
||||
#include <haproxy/stress.h>
|
||||
#include <haproxy/task.h>
|
||||
#include <haproxy/tools.h>
|
||||
#include <haproxy/version.h>
|
||||
|
|
@ -83,8 +82,6 @@ struct promex_ctx {
|
|||
unsigned field_num; /* current field number (ST_I_PX_* etc) */
|
||||
unsigned mod_field_num; /* first field number of the current module (ST_I_PX_* etc) */
|
||||
int obj_state; /* current state among PROMEX_{FRONT|BACK|SRV|LI}_STATE_* */
|
||||
struct watcher px_watch; /* watcher to automatically update next pointer */
|
||||
struct watcher srv_watch; /* watcher to automatically update next pointer */
|
||||
struct list modules; /* list of promex modules to export */
|
||||
struct eb_root filters; /* list of filters to apply on metrics name */
|
||||
};
|
||||
|
|
@ -176,8 +173,6 @@ const struct ist promex_st_metric_desc[ST_I_PX_MAX] = {
|
|||
[ST_I_PX_CTIME] = IST("Avg. connect time for last 1024 successful connections."),
|
||||
[ST_I_PX_RTIME] = IST("Avg. response time for last 1024 successful connections."),
|
||||
[ST_I_PX_TTIME] = IST("Avg. total time for last 1024 successful connections."),
|
||||
[ST_I_PX_AGENT_STATUS] = IST("Status of last agent check, per state label value."),
|
||||
[ST_I_PX_AGENT_DURATION] = IST("Total duration of the latest server agent check, in seconds."),
|
||||
[ST_I_PX_QT_MAX] = IST("Maximum observed time spent in the queue"),
|
||||
[ST_I_PX_CT_MAX] = IST("Maximum observed time spent waiting for a connection to complete"),
|
||||
[ST_I_PX_RT_MAX] = IST("Maximum observed time spent waiting for a server response"),
|
||||
|
|
@ -245,8 +240,8 @@ void promex_register_module(struct promex_module *m)
|
|||
}
|
||||
|
||||
/* Pools used to allocate ref on Promex modules and filters */
|
||||
DECLARE_STATIC_TYPED_POOL(pool_head_promex_mod_ref, "promex_module_ref", struct promex_module_ref);
|
||||
DECLARE_STATIC_TYPED_POOL(pool_head_promex_metric_flt, "promex_metric_filter", struct promex_metric_filter);
|
||||
DECLARE_STATIC_POOL(pool_head_promex_mod_ref, "promex_module_ref", sizeof(struct promex_module_ref));
|
||||
DECLARE_STATIC_POOL(pool_head_promex_metric_flt, "promex_metric_filter", sizeof(struct promex_metric_filter));
|
||||
|
||||
/* Return the server status. */
|
||||
enum promex_srv_state promex_srv_status(struct server *sv)
|
||||
|
|
@ -349,10 +344,6 @@ static int promex_dump_ts(struct appctx *appctx, struct ist prefix,
|
|||
istcat(&n, prefix, PROMEX_MAX_NAME_LEN);
|
||||
istcat(&n, name, PROMEX_MAX_NAME_LEN);
|
||||
|
||||
/* In stress mode, force yielding on each metric. */
|
||||
if (STRESS_RUN1(istlen(*out), 0))
|
||||
goto full;
|
||||
|
||||
if ((ctx->flags & PROMEX_FL_METRIC_HDR) &&
|
||||
!promex_dump_ts_header(n, desc, type, out, max))
|
||||
goto full;
|
||||
|
|
@ -434,8 +425,9 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx)
|
|||
static struct ist prefix = IST("haproxy_process_");
|
||||
struct promex_ctx *ctx = appctx->svcctx;
|
||||
struct field val;
|
||||
struct channel *chn = sc_ic(appctx_sc(appctx));
|
||||
struct ist name, desc, out = ist2(trash.area, 0);
|
||||
size_t max = htx_get_max_blksz(htx, applet_htx_output_room(appctx));
|
||||
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
|
||||
int ret = 1;
|
||||
|
||||
if (!stats_fill_info(stat_line_info, ST_I_INF_MAX, 0))
|
||||
|
|
@ -501,6 +493,7 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if (out.len) {
|
||||
if (!htx_add_data_atonce(htx, out))
|
||||
return -1; /* Unexpected and unrecoverable error */
|
||||
channel_add_input(chn, out.len);
|
||||
}
|
||||
return ret;
|
||||
full:
|
||||
|
|
@ -517,8 +510,9 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
|
|||
struct proxy *px = ctx->p[0];
|
||||
struct stats_module *mod = ctx->p[1];
|
||||
struct field val;
|
||||
struct channel *chn = sc_ic(appctx_sc(appctx));
|
||||
struct ist name, desc, out = ist2(trash.area, 0);
|
||||
size_t max = htx_get_max_blksz(htx, applet_htx_output_room(appctx));
|
||||
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
|
||||
struct field *stats = stat_lines[STATS_DOMAIN_PROXY];
|
||||
int ret = 1;
|
||||
enum promex_front_state state;
|
||||
|
|
@ -632,6 +626,8 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
|
|||
}
|
||||
|
||||
list_for_each_entry_from(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
void *counters;
|
||||
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_FE))
|
||||
continue;
|
||||
|
||||
|
|
@ -668,7 +664,8 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_FE))
|
||||
goto next_px2;
|
||||
|
||||
if (!mod->fill_stats(mod, px->extra_counters_fe, stats + ctx->field_num, &ctx->mod_field_num))
|
||||
counters = EXTRA_COUNTERS_GET(px->extra_counters_fe, mod);
|
||||
if (!mod->fill_stats(counters, stats + ctx->field_num, &ctx->mod_field_num))
|
||||
return -1;
|
||||
|
||||
val = stats[ctx->field_num + ctx->mod_field_num];
|
||||
|
|
@ -695,6 +692,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if (out.len) {
|
||||
if (!htx_add_data_atonce(htx, out))
|
||||
return -1; /* Unexpected and unrecoverable error */
|
||||
channel_add_input(chn, out.len);
|
||||
}
|
||||
|
||||
/* Save pointers (0=current proxy, 1=current stats module) of the current context */
|
||||
|
|
@ -716,8 +714,9 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
|
|||
struct listener *li = ctx->p[1];
|
||||
struct stats_module *mod = ctx->p[2];
|
||||
struct field val;
|
||||
struct channel *chn = sc_ic(appctx_sc(appctx));
|
||||
struct ist name, desc, out = ist2(trash.area, 0);
|
||||
size_t max = htx_get_max_blksz(htx, applet_htx_output_room(appctx));
|
||||
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
|
||||
struct field *stats = stat_lines[STATS_DOMAIN_PROXY];
|
||||
int ret = 1;
|
||||
enum li_status status;
|
||||
|
|
@ -820,6 +819,8 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
|
|||
}
|
||||
|
||||
list_for_each_entry_from(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
void *counters;
|
||||
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_LI))
|
||||
continue;
|
||||
|
||||
|
|
@ -865,7 +866,8 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
|
|||
labels[lb_idx+1].name = ist("mod");
|
||||
labels[lb_idx+1].value = ist2(mod->name, strlen(mod->name));
|
||||
|
||||
if (!mod->fill_stats(mod, li->extra_counters, stats + ctx->field_num, &ctx->mod_field_num))
|
||||
counters = EXTRA_COUNTERS_GET(li->extra_counters, mod);
|
||||
if (!mod->fill_stats(counters, stats + ctx->field_num, &ctx->mod_field_num))
|
||||
return -1;
|
||||
|
||||
val = stats[ctx->field_num + ctx->mod_field_num];
|
||||
|
|
@ -895,6 +897,7 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if (out.len) {
|
||||
if (!htx_add_data_atonce(htx, out))
|
||||
return -1; /* Unexpected and unrecoverable error */
|
||||
channel_add_input(chn, out.len);
|
||||
}
|
||||
/* Save pointers (0=current proxy, 1=current listener, 2=current stats module) of the current context */
|
||||
ctx->p[0] = px;
|
||||
|
|
@ -916,8 +919,9 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
|||
struct stats_module *mod = ctx->p[1];
|
||||
struct server *sv;
|
||||
struct field val;
|
||||
struct channel *chn = sc_ic(appctx_sc(appctx));
|
||||
struct ist name, desc, out = ist2(trash.area, 0);
|
||||
size_t max = htx_get_max_blksz(htx, applet_htx_output_room(appctx));
|
||||
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
|
||||
struct field *stats = stat_lines[STATS_DOMAIN_PROXY];
|
||||
int ret = 1;
|
||||
double secs;
|
||||
|
|
@ -941,6 +945,9 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if (promex_filter_metric(appctx, prefix, name))
|
||||
continue;
|
||||
|
||||
if (!px)
|
||||
px = proxies_list;
|
||||
|
||||
while (px) {
|
||||
struct promex_label labels[PROMEX_MAX_LABELS-1] = {};
|
||||
unsigned int srv_state_count[PROMEX_SRV_STATE_COUNT] = { 0 };
|
||||
|
|
@ -1095,16 +1102,9 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
|||
&val, labels, &out, max))
|
||||
goto full;
|
||||
next_px:
|
||||
px = watcher_next(&ctx->px_watch, px->next);
|
||||
px = px->next;
|
||||
}
|
||||
watcher_detach(&ctx->px_watch);
|
||||
ctx->flags |= PROMEX_FL_METRIC_HDR;
|
||||
|
||||
/* Prepare a new iteration for the next stat column.
|
||||
* Update ctx.p[0] via watcher.
|
||||
*/
|
||||
watcher_attach(&ctx->px_watch, proxies_list);
|
||||
px = proxies_list;
|
||||
}
|
||||
|
||||
/* Skip extra counters */
|
||||
|
|
@ -1117,6 +1117,8 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
|||
}
|
||||
|
||||
list_for_each_entry_from(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
void *counters;
|
||||
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_BE))
|
||||
continue;
|
||||
|
||||
|
|
@ -1127,6 +1129,9 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if (promex_filter_metric(appctx, prefix, name))
|
||||
continue;
|
||||
|
||||
if (!px)
|
||||
px = proxies_list;
|
||||
|
||||
while (px) {
|
||||
struct promex_label labels[PROMEX_MAX_LABELS-1] = {};
|
||||
struct promex_metric metric;
|
||||
|
|
@ -1150,7 +1155,8 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_BE))
|
||||
goto next_px2;
|
||||
|
||||
if (!mod->fill_stats(mod, px->extra_counters_be, stats + ctx->field_num, &ctx->mod_field_num))
|
||||
counters = EXTRA_COUNTERS_GET(px->extra_counters_be, mod);
|
||||
if (!mod->fill_stats(counters, stats + ctx->field_num, &ctx->mod_field_num))
|
||||
return -1;
|
||||
|
||||
val = stats[ctx->field_num + ctx->mod_field_num];
|
||||
|
|
@ -1161,39 +1167,26 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
|||
goto full;
|
||||
|
||||
next_px2:
|
||||
px = watcher_next(&ctx->px_watch, px->next);
|
||||
px = px->next;
|
||||
}
|
||||
watcher_detach(&ctx->px_watch);
|
||||
ctx->flags |= PROMEX_FL_METRIC_HDR;
|
||||
|
||||
/* Prepare a new iteration for the next stat column.
|
||||
* Update ctx.p[0] via watcher.
|
||||
*/
|
||||
watcher_attach(&ctx->px_watch, proxies_list);
|
||||
px = proxies_list;
|
||||
}
|
||||
|
||||
ctx->field_num += mod->stats_count;
|
||||
ctx->mod_field_num = 0;
|
||||
}
|
||||
|
||||
px = NULL;
|
||||
mod = NULL;
|
||||
|
||||
end:
|
||||
if (ret) {
|
||||
watcher_detach(&ctx->px_watch);
|
||||
mod = NULL;
|
||||
}
|
||||
|
||||
if (out.len) {
|
||||
if (!htx_add_data_atonce(htx, out)) {
|
||||
watcher_detach(&ctx->px_watch);
|
||||
if (!htx_add_data_atonce(htx, out))
|
||||
return -1; /* Unexpected and unrecoverable error */
|
||||
}
|
||||
channel_add_input(chn, out.len);
|
||||
}
|
||||
|
||||
/* Save pointers of the current context for dump resumption :
|
||||
* 0=current proxy, 1=current stats module
|
||||
* Note that p[0] is already automatically updated via px_watch.
|
||||
*/
|
||||
/* Save pointers (0=current proxy, 1=current stats module) of the current context */
|
||||
ctx->p[0] = px;
|
||||
ctx->p[1] = mod;
|
||||
return ret;
|
||||
full:
|
||||
|
|
@ -1211,8 +1204,9 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
struct server *sv = ctx->p[1];
|
||||
struct stats_module *mod = ctx->p[2];
|
||||
struct field val;
|
||||
struct channel *chn = sc_ic(appctx_sc(appctx));
|
||||
struct ist name, desc, out = ist2(trash.area, 0);
|
||||
size_t max = htx_get_max_blksz(htx, applet_htx_output_room(appctx));
|
||||
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
|
||||
struct field *stats = stat_lines[STATS_DOMAIN_PROXY];
|
||||
int ret = 1;
|
||||
double secs;
|
||||
|
|
@ -1235,6 +1229,9 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if (promex_filter_metric(appctx, prefix, name))
|
||||
continue;
|
||||
|
||||
if (!px)
|
||||
px = proxies_list;
|
||||
|
||||
while (px) {
|
||||
struct promex_label labels[PROMEX_MAX_LABELS-1] = {};
|
||||
enum promex_mt_type type;
|
||||
|
|
@ -1254,12 +1251,15 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_BE))
|
||||
goto next_px;
|
||||
|
||||
if (!sv)
|
||||
sv = px->srv;
|
||||
|
||||
while (sv) {
|
||||
labels[lb_idx].name = ist("server");
|
||||
labels[lb_idx].value = ist2(sv->id, strlen(sv->id));
|
||||
|
||||
if (!stats_fill_sv_line(px, sv, 0, stats, ST_I_PX_MAX, &(ctx->field_num)))
|
||||
goto error;
|
||||
return -1;
|
||||
|
||||
if ((ctx->flags & PROMEX_FL_NO_MAINT_SRV) && (sv->cur_admin & SRV_ADMF_MAINT))
|
||||
goto next_sv;
|
||||
|
|
@ -1342,7 +1342,6 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
secs = (double)sv->check.duration / 1000.0;
|
||||
val = mkf_flt(FN_DURATION, secs);
|
||||
break;
|
||||
|
||||
case ST_I_PX_REQ_TOT:
|
||||
if (px->mode != PR_MODE_HTTP) {
|
||||
sv = NULL;
|
||||
|
|
@ -1365,36 +1364,6 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
labels[lb_idx+1].value = promex_hrsp_code[ctx->field_num - ST_I_PX_HRSP_1XX];
|
||||
break;
|
||||
|
||||
case ST_I_PX_AGENT_STATUS:
|
||||
if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) != CHK_ST_ENABLED)
|
||||
goto next_sv;
|
||||
|
||||
for (; ctx->obj_state < HCHK_STATUS_SIZE; ctx->obj_state++) {
|
||||
if (get_check_status_result(ctx->obj_state) < CHK_RES_FAILED)
|
||||
continue;
|
||||
val = mkf_u32(FO_STATUS, sv->agent.status == ctx->obj_state);
|
||||
check_state = get_check_status_info(ctx->obj_state);
|
||||
labels[lb_idx+1].name = ist("state");
|
||||
labels[lb_idx+1].value = ist(check_state);
|
||||
if (!promex_dump_ts(appctx, prefix, name, desc,
|
||||
type,
|
||||
&val, labels, &out, max))
|
||||
goto full;
|
||||
}
|
||||
ctx->obj_state = 0;
|
||||
goto next_sv;
|
||||
case ST_I_PX_AGENT_CODE:
|
||||
if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) != CHK_ST_ENABLED)
|
||||
goto next_sv;
|
||||
val = mkf_u32(FN_OUTPUT, (sv->agent.status < HCHK_STATUS_L57DATA) ? 0 : sv->agent.code);
|
||||
break;
|
||||
case ST_I_PX_AGENT_DURATION:
|
||||
if (sv->agent.status < HCHK_STATUS_CHECKED)
|
||||
goto next_sv;
|
||||
secs = (double)sv->agent.duration / 1000.0;
|
||||
val = mkf_flt(FN_DURATION, secs);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1404,30 +1373,13 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
&val, labels, &out, max))
|
||||
goto full;
|
||||
next_sv:
|
||||
sv = watcher_next(&ctx->srv_watch, sv->next);
|
||||
sv = sv->next;
|
||||
}
|
||||
|
||||
next_px:
|
||||
watcher_detach(&ctx->srv_watch);
|
||||
px = watcher_next(&ctx->px_watch, px->next);
|
||||
if (px) {
|
||||
/* Update ctx.p[1] via watcher. */
|
||||
watcher_attach(&ctx->srv_watch, px->srv);
|
||||
sv = ctx->p[1];
|
||||
}
|
||||
px = px->next;
|
||||
}
|
||||
watcher_detach(&ctx->px_watch);
|
||||
ctx->flags |= PROMEX_FL_METRIC_HDR;
|
||||
|
||||
/* Prepare a new iteration for the next stat column.
|
||||
* Update ctx.p[0]/p[1] via px_watch/srv_watch.
|
||||
*/
|
||||
watcher_attach(&ctx->px_watch, proxies_list);
|
||||
px = proxies_list;
|
||||
if (likely(px)) {
|
||||
watcher_attach(&ctx->srv_watch, px->srv);
|
||||
sv = ctx->p[1];
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip extra counters */
|
||||
|
|
@ -1440,6 +1392,8 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
}
|
||||
|
||||
list_for_each_entry_from(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
void *counters;
|
||||
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_SRV))
|
||||
continue;
|
||||
|
||||
|
|
@ -1450,6 +1404,9 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if (promex_filter_metric(appctx, prefix, name))
|
||||
continue;
|
||||
|
||||
if (!px)
|
||||
px = proxies_list;
|
||||
|
||||
while (px) {
|
||||
struct promex_label labels[PROMEX_MAX_LABELS-1] = {};
|
||||
struct promex_metric metric;
|
||||
|
|
@ -1470,6 +1427,9 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_BE))
|
||||
goto next_px2;
|
||||
|
||||
if (!sv)
|
||||
sv = px->srv;
|
||||
|
||||
while (sv) {
|
||||
labels[lb_idx].name = ist("server");
|
||||
labels[lb_idx].value = ist2(sv->id, strlen(sv->id));
|
||||
|
|
@ -1481,8 +1441,9 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
goto next_sv2;
|
||||
|
||||
|
||||
if (!mod->fill_stats(mod, sv->extra_counters, stats + ctx->field_num, &ctx->mod_field_num))
|
||||
goto error;
|
||||
counters = EXTRA_COUNTERS_GET(sv->extra_counters, mod);
|
||||
if (!mod->fill_stats(counters, stats + ctx->field_num, &ctx->mod_field_num))
|
||||
return -1;
|
||||
|
||||
val = stats[ctx->field_num + ctx->mod_field_num];
|
||||
metric.type = ((val.type == FN_GAUGE) ? PROMEX_MT_GAUGE : PROMEX_MT_COUNTER);
|
||||
|
|
@ -1492,62 +1453,43 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
goto full;
|
||||
|
||||
next_sv2:
|
||||
sv = watcher_next(&ctx->srv_watch, sv->next);
|
||||
sv = sv->next;
|
||||
}
|
||||
|
||||
next_px2:
|
||||
watcher_detach(&ctx->srv_watch);
|
||||
px = watcher_next(&ctx->px_watch, px->next);
|
||||
if (px) {
|
||||
/* Update ctx.p[1] via watcher. */
|
||||
watcher_attach(&ctx->srv_watch, px->srv);
|
||||
sv = ctx->p[1];
|
||||
}
|
||||
px = px->next;
|
||||
}
|
||||
watcher_detach(&ctx->px_watch);
|
||||
ctx->flags |= PROMEX_FL_METRIC_HDR;
|
||||
|
||||
/* Prepare a new iteration for the next stat column.
|
||||
* Update ctx.p[0]/p[1] via px_watch/srv_watch.
|
||||
*/
|
||||
watcher_attach(&ctx->px_watch, proxies_list);
|
||||
px = proxies_list;
|
||||
if (likely(px)) {
|
||||
watcher_attach(&ctx->srv_watch, px->srv);
|
||||
sv = ctx->p[1];
|
||||
}
|
||||
}
|
||||
|
||||
ctx->field_num += mod->stats_count;
|
||||
ctx->mod_field_num = 0;
|
||||
}
|
||||
|
||||
end:
|
||||
if (ret) {
|
||||
watcher_detach(&ctx->px_watch);
|
||||
watcher_detach(&ctx->srv_watch);
|
||||
mod = NULL;
|
||||
}
|
||||
px = NULL;
|
||||
sv = NULL;
|
||||
mod = NULL;
|
||||
|
||||
end:
|
||||
if (out.len) {
|
||||
if (!htx_add_data_atonce(htx, out))
|
||||
return -1; /* Unexpected and unrecoverable error */
|
||||
channel_add_input(chn, out.len);
|
||||
}
|
||||
|
||||
/* Save pointers of the current context for dump resumption :
|
||||
* 0=current proxy, 1=current server, 2=current stats module
|
||||
* Note that p[0]/p[1] are already automatically updated via px_watch/srv_watch.
|
||||
*/
|
||||
/* Decrement server refcount if it was saved through ctx.p[1]. */
|
||||
srv_drop(ctx->p[1]);
|
||||
if (sv)
|
||||
srv_take(sv);
|
||||
|
||||
/* Save pointers (0=current proxy, 1=current server, 2=current stats module) of the current context */
|
||||
ctx->p[0] = px;
|
||||
ctx->p[1] = sv;
|
||||
ctx->p[2] = mod;
|
||||
return ret;
|
||||
full:
|
||||
ret = 0;
|
||||
goto end;
|
||||
|
||||
error:
|
||||
watcher_detach(&ctx->px_watch);
|
||||
watcher_detach(&ctx->srv_watch);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Dump metrics of module <mod>. It returns 1 on success, 0 if <out> is full and
|
||||
|
|
@ -1628,8 +1570,9 @@ static int promex_dump_ref_modules_metrics(struct appctx *appctx, struct htx *ht
|
|||
{
|
||||
struct promex_ctx *ctx = appctx->svcctx;
|
||||
struct promex_module_ref *ref = ctx->p[0];
|
||||
struct channel *chn = sc_ic(appctx_sc(appctx));
|
||||
struct ist out = ist2(trash.area, 0);
|
||||
size_t max = htx_get_max_blksz(htx, applet_htx_output_room(appctx));
|
||||
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
|
||||
int ret = 1;
|
||||
|
||||
if (!ref) {
|
||||
|
|
@ -1653,6 +1596,7 @@ static int promex_dump_ref_modules_metrics(struct appctx *appctx, struct htx *ht
|
|||
if (out.len) {
|
||||
if (!htx_add_data_atonce(htx, out))
|
||||
return -1; /* Unexpected and unrecoverable error */
|
||||
channel_add_input(chn, out.len);
|
||||
}
|
||||
ctx->p[0] = ref;
|
||||
return ret;
|
||||
|
|
@ -1667,8 +1611,9 @@ static int promex_dump_all_modules_metrics(struct appctx *appctx, struct htx *ht
|
|||
{
|
||||
struct promex_ctx *ctx = appctx->svcctx;
|
||||
struct promex_module *mod = ctx->p[0];
|
||||
struct channel *chn = sc_ic(appctx_sc(appctx));
|
||||
struct ist out = ist2(trash.area, 0);
|
||||
size_t max = htx_get_max_blksz(htx, applet_htx_output_room(appctx));
|
||||
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
|
||||
int ret = 1;
|
||||
|
||||
if (!mod) {
|
||||
|
|
@ -1692,6 +1637,7 @@ static int promex_dump_all_modules_metrics(struct appctx *appctx, struct htx *ht
|
|||
if (out.len) {
|
||||
if (!htx_add_data_atonce(htx, out))
|
||||
return -1; /* Unexpected and unrecoverable error */
|
||||
channel_add_input(chn, out.len);
|
||||
}
|
||||
ctx->p[0] = mod;
|
||||
return ret;
|
||||
|
|
@ -1706,7 +1652,7 @@ static int promex_dump_all_modules_metrics(struct appctx *appctx, struct htx *ht
|
|||
* Uses <appctx.ctx.stats.px> as a pointer to the current proxy and <sv>/<li>
|
||||
* as pointers to the current server/listener respectively.
|
||||
*/
|
||||
static int promex_dump_metrics(struct appctx *appctx, struct htx *htx)
|
||||
static int promex_dump_metrics(struct appctx *appctx, struct stconn *sc, struct htx *htx)
|
||||
{
|
||||
struct promex_ctx *ctx = appctx->svcctx;
|
||||
int ret;
|
||||
|
|
@ -1768,11 +1714,6 @@ static int promex_dump_metrics(struct appctx *appctx, struct htx *htx)
|
|||
ctx->field_num = ST_I_PX_PXNAME;
|
||||
ctx->mod_field_num = 0;
|
||||
appctx->st1 = PROMEX_DUMPER_BACK;
|
||||
|
||||
if (ctx->flags & PROMEX_FL_SCOPE_BACK) {
|
||||
/* Update ctx.p[0] via watcher. */
|
||||
watcher_attach(&ctx->px_watch, proxies_list);
|
||||
}
|
||||
__fallthrough;
|
||||
|
||||
case PROMEX_DUMPER_BACK:
|
||||
|
|
@ -1790,15 +1731,6 @@ static int promex_dump_metrics(struct appctx *appctx, struct htx *htx)
|
|||
ctx->field_num = ST_I_PX_PXNAME;
|
||||
ctx->mod_field_num = 0;
|
||||
appctx->st1 = PROMEX_DUMPER_SRV;
|
||||
|
||||
if (ctx->flags & PROMEX_FL_SCOPE_SERVER) {
|
||||
/* Update ctx.p[0] via watcher. */
|
||||
watcher_attach(&ctx->px_watch, proxies_list);
|
||||
if (likely(proxies_list)) {
|
||||
/* Update ctx.p[1] via watcher. */
|
||||
watcher_attach(&ctx->srv_watch, proxies_list->srv);
|
||||
}
|
||||
}
|
||||
__fallthrough;
|
||||
|
||||
case PROMEX_DUMPER_SRV:
|
||||
|
|
@ -1844,7 +1776,7 @@ static int promex_dump_metrics(struct appctx *appctx, struct htx *htx)
|
|||
return 1;
|
||||
|
||||
full:
|
||||
applet_have_more_data(appctx);
|
||||
sc_need_room(sc, channel_htx_recv_max(sc_ic(appctx_sc(appctx)), htx) + 1);
|
||||
return 0;
|
||||
error:
|
||||
/* unrecoverable error */
|
||||
|
|
@ -1857,11 +1789,12 @@ static int promex_dump_metrics(struct appctx *appctx, struct htx *htx)
|
|||
|
||||
/* Parse the query string of request URI to filter the metrics. It returns 1 on
|
||||
* success and -1 on error. */
|
||||
static int promex_parse_uri(struct appctx *appctx)
|
||||
static int promex_parse_uri(struct appctx *appctx, struct stconn *sc)
|
||||
{
|
||||
struct promex_ctx *ctx = appctx->svcctx;
|
||||
struct buffer *outbuf;
|
||||
struct htx *req_htx;
|
||||
struct channel *req = sc_oc(sc);
|
||||
struct channel *res = sc_ic(sc);
|
||||
struct htx *req_htx, *res_htx;
|
||||
struct htx_sl *sl;
|
||||
char *p, *key, *value;
|
||||
const char *end;
|
||||
|
|
@ -1871,13 +1804,10 @@ static int promex_parse_uri(struct appctx *appctx)
|
|||
int len;
|
||||
|
||||
/* Get the query-string */
|
||||
req_htx = htxbuf(DISGUISE(applet_get_inbuf(appctx)));
|
||||
req_htx = htxbuf(&req->buf);
|
||||
sl = http_get_stline(req_htx);
|
||||
if (!sl)
|
||||
goto bad_req_error;
|
||||
if (sl->info.req.meth == HTTP_METH_HEAD)
|
||||
ctx->flags |= PROMEX_FL_BODYLESS_RESP;
|
||||
|
||||
goto error;
|
||||
p = http_find_param_list(HTX_SL_REQ_UPTR(sl), HTX_SL_REQ_ULEN(sl), '?');
|
||||
if (!p)
|
||||
goto end;
|
||||
|
|
@ -1910,27 +1840,27 @@ static int promex_parse_uri(struct appctx *appctx)
|
|||
*p = 0;
|
||||
len = url_decode(key, 1);
|
||||
if (len == -1)
|
||||
goto bad_req_error;
|
||||
goto error;
|
||||
|
||||
/* decode value */
|
||||
if (value) {
|
||||
while (p < end && *p != '=' && *p != '&' && *p != '#')
|
||||
++p;
|
||||
if (*p == '=')
|
||||
goto bad_req_error;
|
||||
goto error;
|
||||
if (*p == '&')
|
||||
*(p++) = 0;
|
||||
else if (*p == '#')
|
||||
*p = 0;
|
||||
len = url_decode(value, 1);
|
||||
if (len == -1)
|
||||
goto bad_req_error;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (strcmp(key, "scope") == 0) {
|
||||
default_scopes = 0; /* at least a scope defined, unset default scopes */
|
||||
if (!value)
|
||||
goto bad_req_error;
|
||||
goto error;
|
||||
else if (*value == 0)
|
||||
ctx->flags &= ~PROMEX_FL_SCOPE_ALL;
|
||||
else if (*value == '*' && *(value+1) == 0)
|
||||
|
|
@ -1961,14 +1891,14 @@ static int promex_parse_uri(struct appctx *appctx)
|
|||
}
|
||||
}
|
||||
if (!(ctx->flags & PROMEX_FL_SCOPE_MODULE))
|
||||
goto bad_req_error;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else if (strcmp(key, "metrics") == 0) {
|
||||
struct ist args;
|
||||
|
||||
if (!value)
|
||||
goto bad_req_error;
|
||||
goto error;
|
||||
|
||||
for (args = ist(value); istlen(args); args = istadv(istfind(args, ','), 1)) {
|
||||
struct eb32_node *node;
|
||||
|
|
@ -2019,28 +1949,30 @@ static int promex_parse_uri(struct appctx *appctx)
|
|||
ctx->flags |= (default_scopes | default_metrics_filter);
|
||||
return 1;
|
||||
|
||||
bad_req_error:
|
||||
error:
|
||||
err = &http_err_chunks[HTTP_ERR_400];
|
||||
goto error;
|
||||
channel_erase(res);
|
||||
res->buf.data = b_data(err);
|
||||
memcpy(res->buf.area, b_head(err), b_data(err));
|
||||
res_htx = htx_from_buf(&res->buf);
|
||||
channel_add_input(res, res_htx->data);
|
||||
return -1;
|
||||
|
||||
internal_error:
|
||||
err = &http_err_chunks[HTTP_ERR_500];
|
||||
goto error;
|
||||
|
||||
error:
|
||||
outbuf = DISGUISE(applet_get_outbuf(appctx));
|
||||
b_reset(outbuf);
|
||||
outbuf->data = b_data(err);
|
||||
memcpy(outbuf->area, b_head(err), b_data(err));
|
||||
applet_set_eoi(appctx);
|
||||
applet_set_eos(appctx);
|
||||
err = &http_err_chunks[HTTP_ERR_400];
|
||||
channel_erase(res);
|
||||
res->buf.data = b_data(err);
|
||||
memcpy(res->buf.area, b_head(err), b_data(err));
|
||||
res_htx = htx_from_buf(&res->buf);
|
||||
channel_add_input(res, res_htx->data);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Send HTTP headers of the response. It returns 1 on success and 0 if <htx> is
|
||||
* full. */
|
||||
static int promex_send_headers(struct appctx *appctx, struct htx *htx)
|
||||
static int promex_send_headers(struct appctx *appctx, struct stconn *sc, struct htx *htx)
|
||||
{
|
||||
struct channel *chn = sc_ic(sc);
|
||||
struct htx_sl *sl;
|
||||
unsigned int flags;
|
||||
|
||||
|
|
@ -2055,10 +1987,11 @@ static int promex_send_headers(struct appctx *appctx, struct htx *htx)
|
|||
!htx_add_endof(htx, HTX_BLK_EOH))
|
||||
goto full;
|
||||
|
||||
channel_add_input(chn, htx->data);
|
||||
return 1;
|
||||
full:
|
||||
htx_reset(htx);
|
||||
applet_have_more_data(appctx);
|
||||
sc_need_room(sc, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2076,8 +2009,6 @@ static int promex_appctx_init(struct appctx *appctx)
|
|||
LIST_INIT(&ctx->modules);
|
||||
ctx->filters = EB_ROOT;
|
||||
appctx->st0 = PROMEX_ST_INIT;
|
||||
watcher_init(&ctx->px_watch, &ctx->p[0], offsetof(struct proxy, watcher_list));
|
||||
watcher_init(&ctx->srv_watch, &ctx->p[1], offsetof(struct server, watcher_list));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2091,14 +2022,11 @@ static void promex_appctx_release(struct appctx *appctx)
|
|||
struct promex_metric_filter *flt;
|
||||
struct eb32_node *node, *next;
|
||||
|
||||
if (appctx->st1 == PROMEX_DUMPER_BACK ||
|
||||
appctx->st1 == PROMEX_DUMPER_SRV) {
|
||||
watcher_detach(&ctx->px_watch);
|
||||
if (appctx->st1 == PROMEX_DUMPER_SRV) {
|
||||
struct server *srv = objt_server(ctx->p[1]);
|
||||
srv_drop(srv);
|
||||
}
|
||||
|
||||
if (appctx->st1 == PROMEX_DUMPER_SRV)
|
||||
watcher_detach(&ctx->srv_watch);
|
||||
|
||||
list_for_each_entry_safe(ref, back, &ctx->modules, list) {
|
||||
LIST_DELETE(&ref->list);
|
||||
pool_free(pool_head_promex_mod_ref, ref);
|
||||
|
|
@ -2117,51 +2045,52 @@ static void promex_appctx_release(struct appctx *appctx)
|
|||
/* The main I/O handler for the promex applet. */
|
||||
static void promex_appctx_handle_io(struct appctx *appctx)
|
||||
{
|
||||
struct promex_ctx *ctx = appctx->svcctx;
|
||||
struct buffer *outbuf;
|
||||
struct htx *res_htx;
|
||||
struct stconn *sc = appctx_sc(appctx);
|
||||
struct stream *s = __sc_strm(sc);
|
||||
struct channel *req = sc_oc(sc);
|
||||
struct channel *res = sc_ic(sc);
|
||||
struct htx *req_htx, *res_htx;
|
||||
int ret;
|
||||
|
||||
if (unlikely(applet_fl_test(appctx, APPCTX_FL_EOS|APPCTX_FL_ERROR)))
|
||||
res_htx = htx_from_buf(&res->buf);
|
||||
|
||||
if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW))))
|
||||
goto out;
|
||||
|
||||
/* Check if the input buffer is available. */
|
||||
outbuf = applet_get_outbuf(appctx);
|
||||
if (outbuf == NULL) {
|
||||
applet_have_more_data(appctx);
|
||||
if (!b_size(&res->buf)) {
|
||||
sc_need_room(sc, 0);
|
||||
goto out;
|
||||
}
|
||||
res_htx = htx_from_buf(outbuf);
|
||||
|
||||
switch (appctx->st0) {
|
||||
case PROMEX_ST_INIT:
|
||||
if (!applet_get_inbuf(appctx) || !applet_htx_input_data(appctx)) {
|
||||
if (!co_data(req)) {
|
||||
applet_need_more_data(appctx);
|
||||
break;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = promex_parse_uri(appctx);
|
||||
ret = promex_parse_uri(appctx, sc);
|
||||
if (ret <= 0) {
|
||||
if (ret == -1)
|
||||
applet_set_error(appctx);
|
||||
break;
|
||||
goto error;
|
||||
goto out;
|
||||
}
|
||||
appctx->st0 = PROMEX_ST_HEAD;
|
||||
appctx->st1 = PROMEX_DUMPER_INIT;
|
||||
__fallthrough;
|
||||
|
||||
case PROMEX_ST_HEAD:
|
||||
if (!promex_send_headers(appctx, res_htx))
|
||||
break;
|
||||
appctx->st0 = ((ctx->flags & PROMEX_FL_BODYLESS_RESP) ? PROMEX_ST_DONE : PROMEX_ST_DUMP);
|
||||
if (!promex_send_headers(appctx, sc, res_htx))
|
||||
goto out;
|
||||
appctx->st0 = ((s->txn->meth == HTTP_METH_HEAD) ? PROMEX_ST_DONE : PROMEX_ST_DUMP);
|
||||
__fallthrough;
|
||||
|
||||
case PROMEX_ST_DUMP:
|
||||
ret = promex_dump_metrics(appctx, res_htx);
|
||||
ret = promex_dump_metrics(appctx, sc, res_htx);
|
||||
if (ret <= 0) {
|
||||
if (ret == -1)
|
||||
applet_set_error(appctx);
|
||||
break;
|
||||
goto error;
|
||||
goto out;
|
||||
}
|
||||
appctx->st0 = PROMEX_ST_DONE;
|
||||
__fallthrough;
|
||||
|
|
@ -2175,36 +2104,41 @@ static void promex_appctx_handle_io(struct appctx *appctx)
|
|||
*/
|
||||
if (htx_is_empty(res_htx)) {
|
||||
if (!htx_add_endof(res_htx, HTX_BLK_EOT)) {
|
||||
applet_have_more_data(appctx);
|
||||
break;
|
||||
sc_need_room(sc, sizeof(struct htx_blk) + 1);
|
||||
goto out;
|
||||
}
|
||||
channel_add_input(res, 1);
|
||||
}
|
||||
res_htx->flags |= HTX_FL_EOM;
|
||||
applet_set_eoi(appctx);
|
||||
se_fl_set(appctx->sedesc, SE_FL_EOI);
|
||||
appctx->st0 = PROMEX_ST_END;
|
||||
__fallthrough;
|
||||
|
||||
case PROMEX_ST_END:
|
||||
applet_set_eos(appctx);
|
||||
se_fl_set(appctx->sedesc, SE_FL_EOS);
|
||||
}
|
||||
|
||||
htx_to_buf(res_htx, outbuf);
|
||||
|
||||
out:
|
||||
htx_to_buf(res_htx, &res->buf);
|
||||
|
||||
/* eat the whole request */
|
||||
applet_reset_input(appctx);
|
||||
if (co_data(req)) {
|
||||
req_htx = htx_from_buf(&req->buf);
|
||||
co_htx_skip(req, req_htx, co_data(req));
|
||||
}
|
||||
return;
|
||||
|
||||
error:
|
||||
se_fl_set(appctx->sedesc, SE_FL_ERROR);
|
||||
goto out;
|
||||
}
|
||||
|
||||
struct applet promex_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API|APPLET_FL_HTX,
|
||||
.name = "<PROMEX>", /* used for logging */
|
||||
.init = promex_appctx_init,
|
||||
.release = promex_appctx_release,
|
||||
.fct = promex_appctx_handle_io,
|
||||
.rcv_buf = appctx_htx_rcv_buf,
|
||||
.snd_buf = appctx_htx_snd_buf,
|
||||
};
|
||||
|
||||
static enum act_parse_ret service_parse_prometheus_exporter(const char **args, int *cur_arg, struct proxy *px,
|
||||
|
|
|
|||
|
|
@ -1,235 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Dump certificates from the HAProxy stats or master socket to the filesystem
|
||||
# Experimental script
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
export BASEPATH=${BASEPATH:-/etc/haproxy}/
|
||||
export SOCKET=${SOCKET:-/var/run/haproxy-master.sock}
|
||||
export DRY_RUN=0
|
||||
export DEBUG=
|
||||
export VERBOSE=
|
||||
export M="@1 "
|
||||
export TMP
|
||||
|
||||
vecho() {
|
||||
|
||||
[ -n "$VERBOSE" ] && echo "$@"
|
||||
return 0
|
||||
}
|
||||
|
||||
read_certificate() {
|
||||
name=$1
|
||||
crt_filename=
|
||||
key_filename=
|
||||
|
||||
OFS=$IFS
|
||||
IFS=":"
|
||||
|
||||
while read -r key value; do
|
||||
case "$key" in
|
||||
"Crt filename")
|
||||
crt_filename="${value# }"
|
||||
key_filename="${value# }"
|
||||
;;
|
||||
"Key filename")
|
||||
key_filename="${value# }"
|
||||
;;
|
||||
esac
|
||||
done < <(echo "${M}show ssl cert ${name}" | socat "${SOCKET}" -)
|
||||
IFS=$OFS
|
||||
|
||||
if [ -z "$crt_filename" ] || [ -z "$key_filename" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# handle fields without a crt-base/key-base
|
||||
[ "${crt_filename:0:1}" != "/" ] && crt_filename="${BASEPATH}${crt_filename}"
|
||||
[ "${key_filename:0:1}" != "/" ] && key_filename="${BASEPATH}${key_filename}"
|
||||
|
||||
vecho "name:$name"
|
||||
vecho "crt:$crt_filename"
|
||||
vecho "key:$key_filename"
|
||||
|
||||
export NAME="$name"
|
||||
export CRT_FILENAME="$crt_filename"
|
||||
export KEY_FILENAME="$key_filename"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
cmp_certkey() {
|
||||
prev=$1
|
||||
new=$2
|
||||
|
||||
if [ ! -f "$prev" ]; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if ! cmp -s <(openssl x509 -in "$prev" -noout -fingerprint -sha256) <(openssl x509 -in "$new" -noout -fingerprint -sha256); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
dump_certificate() {
|
||||
name=$1
|
||||
prev_crt=$2
|
||||
prev_key=$3
|
||||
r="tmp.${RANDOM}"
|
||||
d="old.$(date +%s)"
|
||||
new_crt="$TMP/$(basename "$prev_crt").${r}"
|
||||
new_key="$TMP/$(basename "$prev_key").${r}"
|
||||
|
||||
if ! touch "${new_crt}" || ! touch "${new_key}"; then
|
||||
echo "[ALERT] ($$) : can't dump \"$name\", can't create tmp files" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "${M}dump ssl cert ${name}" | socat "${SOCKET}" - | openssl pkey >> "${new_key}"
|
||||
# use crl2pkcs7 as a way to dump multiple x509, storeutl could be used in modern versions of openssl
|
||||
echo "${M}dump ssl cert ${name}" | socat "${SOCKET}" - | openssl crl2pkcs7 -nocrl -certfile /dev/stdin | openssl pkcs7 -print_certs >> "${new_crt}"
|
||||
|
||||
if ! cmp -s <(openssl x509 -in "${new_crt}" -pubkey -noout) <(openssl pkey -in "${new_key}" -pubout); then
|
||||
echo "[ALERT] ($$) : Private key \"${new_key}\" and public key \"${new_crt}\" don't match" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if cmp_certkey "${prev_crt}" "${new_crt}"; then
|
||||
echo "[NOTICE] ($$) : ${crt_filename} is already up to date" >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
# dry run will just return before trying to move the files
|
||||
if [ "${DRY_RUN}" != "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# move the current certificates to ".old.timestamp"
|
||||
if [ -f "${prev_crt}" ] && [ -f "${prev_key}" ]; then
|
||||
mv "${prev_crt}" "${prev_crt}.${d}"
|
||||
[ "${prev_crt}" != "${prev_key}" ] && mv "${prev_key}" "${prev_key}.${d}"
|
||||
fi
|
||||
|
||||
# move the new certificates to old place
|
||||
mv "${new_crt}" "${prev_crt}"
|
||||
[ "${prev_crt}" != "${prev_key}" ] && mv "${new_key}" "${prev_key}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
dump_all_certificates() {
|
||||
echo "${M}show ssl cert" | socat "${SOCKET}" - | grep -v '^#' | grep -v '^$' | while read -r line; do
|
||||
export NAME
|
||||
export CRT_FILENAME
|
||||
export KEY_FILENAME
|
||||
|
||||
if read_certificate "$line"; then
|
||||
dump_certificate "$NAME" "$CRT_FILENAME" "$KEY_FILENAME"
|
||||
else
|
||||
echo "[WARNING] ($$) : can't dump \"$name\", crt/key filename details not found in \"show ssl cert\"" >&2
|
||||
fi
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Usage:"
|
||||
echo " $0 [options]* [cert]*"
|
||||
echo ""
|
||||
echo " Dump certificates from the HAProxy stats or master socket to the filesystem"
|
||||
echo " Require socat and openssl"
|
||||
echo " EXPERIMENTAL script, backup your files!"
|
||||
echo " The script will move your previous files to FILE.old.unixtimestamp (ex: foo.com.pem.old.1759044998)"
|
||||
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -S, --master-socket <path> Use the master socket at <path> (default: ${SOCKET})"
|
||||
echo " -s, --socket <path> Use the stats socket at <path>"
|
||||
echo " -p, --path <path> Specify a base path for relative files (default: ${BASEPATH})"
|
||||
echo " -n, --dry-run Read certificates on the socket but don't dump them"
|
||||
echo " -d, --debug Debug mode, set -x"
|
||||
echo " -v, --verbose Verbose mode"
|
||||
echo " -h, --help This help"
|
||||
echo " -- End of options"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 -v -p ${BASEPATH} -S ${SOCKET}"
|
||||
echo " $0 -v -p ${BASEPATH} -S ${SOCKET} bar.com.rsa.pem"
|
||||
echo " $0 -v -p ${BASEPATH} -S ${SOCKET} -- foo.com.ecdsa.pem bar.com.rsa.pem"
|
||||
}
|
||||
|
||||
main() {
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-S|--master-socket)
|
||||
SOCKET="$2"
|
||||
M="@1 "
|
||||
shift 2
|
||||
;;
|
||||
-s|--socket)
|
||||
SOCKET="$2"
|
||||
M=
|
||||
shift 2
|
||||
;;
|
||||
-p|--path)
|
||||
BASEPATH="$2/"
|
||||
shift 2
|
||||
;;
|
||||
-n|--dry-run)
|
||||
DRY_RUN=1
|
||||
shift
|
||||
;;
|
||||
-d|--debug)
|
||||
DEBUG=1
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage "$@"
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echo "[ALERT] ($$) : Unknown option '$1'" >&2
|
||||
usage "$@"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
TMP=${TMP:-$(mktemp -d)}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
dump_all_certificates
|
||||
else
|
||||
# compute the certificates names at the end of the command
|
||||
while [ -n "$1" ]; do
|
||||
if ! read_certificate "$1"; then
|
||||
echo "[ALERT] ($$) : can't dump \"$1\", crt/key filename details not found in \"show ssl cert\"" >&2
|
||||
exit 1
|
||||
fi
|
||||
[ "${DRY_RUN}" = "0" ] && dump_certificate "$NAME" "$CRT_FILENAME" "$KEY_FILENAME"
|
||||
shift
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
trap 'rm -rf -- "$TMP"' EXIT
|
||||
main "$@"
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
export VERBOSE=1
|
||||
export TIMEOUT=90
|
||||
export MASTER_SOCKET="${MASTER_SOCKET:-/var/run/haproxy-master.sock}"
|
||||
|
||||
alert() {
|
||||
if [ "$VERBOSE" -ge "1" ]; then
|
||||
echo "[ALERT] $*" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
reload() {
|
||||
if [ -S "$MASTER_SOCKET" ]; then
|
||||
socat_addr="UNIX-CONNECT:${MASTER_SOCKET}"
|
||||
else
|
||||
case "$MASTER_SOCKET" in
|
||||
*:[0-9]*)
|
||||
socat_addr="TCP:${MASTER_SOCKET}"
|
||||
;;
|
||||
*)
|
||||
alert "Invalid master socket address '${MASTER_SOCKET}': expected a UNIX socket file or <host>:<port>"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "reload" | socat -t"${TIMEOUT}" "$socat_addr" - | {
|
||||
read -r status || { alert "No status received (connection error or timeout after ${TIMEOUT}s)."; exit 1; }
|
||||
case "$status" in
|
||||
"Success=1") ret=0 ;;
|
||||
"Success=0") ret=1 ;;
|
||||
*) alert "Unexpected response: '$status'"; exit 1 ;;
|
||||
esac
|
||||
|
||||
read -r _ # consume "--"
|
||||
|
||||
if [ "$VERBOSE" -ge 3 ] || { [ "$ret" = 1 ] && [ "$VERBOSE" -ge 2 ]; }; then
|
||||
cat >&2
|
||||
else
|
||||
cat >/dev/null
|
||||
fi
|
||||
|
||||
exit "$ret"
|
||||
}
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Usage:"
|
||||
echo " $0 [options]*"
|
||||
echo ""
|
||||
echo " Trigger a reload from the master socket"
|
||||
echo " Require socat"
|
||||
echo " EXPERIMENTAL script!"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -S, --master-socket <addr> Unix socket path or <host>:<port> (default: ${MASTER_SOCKET})"
|
||||
echo " -d, --debug Debug mode, set -x"
|
||||
echo " -t, --timeout Timeout (socat -t) (default: ${TIMEOUT})"
|
||||
echo " -s, --silent Silent mode (no output)"
|
||||
echo " -v, --verbose Verbose output (output from haproxy on failure)"
|
||||
echo " -vv --verbose=all Very verbose output (output from haproxy on success and failure)"
|
||||
echo " -h, --help This help"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 -S ${MASTER_SOCKET} -d ${TIMEOUT}"
|
||||
}
|
||||
|
||||
|
||||
main() {
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-S|--master-socket)
|
||||
MASTER_SOCKET="$2"
|
||||
shift 2
|
||||
;;
|
||||
-t|--timeout)
|
||||
TIMEOUT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-s|--silent)
|
||||
VERBOSE=0
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE=2
|
||||
shift
|
||||
;;
|
||||
-vv|--verbose=all)
|
||||
VERBOSE=3
|
||||
shift
|
||||
;;
|
||||
-d|--debug)
|
||||
DEBUG=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage "$@"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "[ALERT] ($$) : Unknown option '$1'" >&2
|
||||
usage "$@"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
reload
|
||||
|
|
@ -123,22 +123,6 @@ struct url_stat {
|
|||
#define FILT2_PRESERVE_QUERY 0x02
|
||||
#define FILT2_EXTRACT_CAPTURE 0x04
|
||||
|
||||
#define FILT_OUTPUT_FMT (FILT_COUNT_ONLY| \
|
||||
FILT_COUNT_STATUS| \
|
||||
FILT_COUNT_SRV_STATUS| \
|
||||
FILT_COUNT_COOK_CODES| \
|
||||
FILT_COUNT_TERM_CODES| \
|
||||
FILT_COUNT_URL_ONLY| \
|
||||
FILT_COUNT_URL_COUNT| \
|
||||
FILT_COUNT_URL_ERR| \
|
||||
FILT_COUNT_URL_TAVG| \
|
||||
FILT_COUNT_URL_TTOT| \
|
||||
FILT_COUNT_URL_TAVGO| \
|
||||
FILT_COUNT_URL_TTOTO| \
|
||||
FILT_COUNT_URL_BAVG| \
|
||||
FILT_COUNT_URL_BTOT| \
|
||||
FILT_COUNT_IP_COUNT)
|
||||
|
||||
unsigned int filter = 0;
|
||||
unsigned int filter2 = 0;
|
||||
unsigned int filter_invert = 0;
|
||||
|
|
@ -208,7 +192,7 @@ void help()
|
|||
" you can also use -n to start from earlier then field %d\n"
|
||||
" -query preserve the query string for per-URL (-u*) statistics\n"
|
||||
"\n"
|
||||
"Output format - **only one** may be used at a time\n"
|
||||
"Output format - only one may be used at a time\n"
|
||||
" -c only report the number of lines that would have been printed\n"
|
||||
" -pct output connect and response times percentiles\n"
|
||||
" -st output number of requests per HTTP status code\n"
|
||||
|
|
@ -914,9 +898,6 @@ int main(int argc, char **argv)
|
|||
if (!filter && !filter2)
|
||||
die("No action specified.\n");
|
||||
|
||||
if ((filter & FILT_OUTPUT_FMT) & ((filter & FILT_OUTPUT_FMT) - 1))
|
||||
die("Please, set only one output filter.\n");
|
||||
|
||||
if (filter & FILT_ACC_COUNT && !filter_acc_count)
|
||||
filter_acc_count=1;
|
||||
|
||||
|
|
@ -1571,10 +1552,6 @@ void filter_count_srv_status(const char *accept_field, const char *time_field, s
|
|||
if (!srv_node) {
|
||||
/* server not yet in the tree, let's create it */
|
||||
srv = (void *)calloc(1, sizeof(struct srv_st) + e - b + 1);
|
||||
if (unlikely(!srv)) {
|
||||
fprintf(stderr, "%s: not enough memory\n", __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
srv_node = &srv->node;
|
||||
memcpy(&srv_node->key, b, e - b);
|
||||
srv_node->key[e - b] = '\0';
|
||||
|
|
@ -1684,10 +1661,6 @@ void filter_count_url(const char *accept_field, const char *time_field, struct t
|
|||
*/
|
||||
if (unlikely(!ustat))
|
||||
ustat = calloc(1, sizeof(*ustat));
|
||||
if (unlikely(!ustat)) {
|
||||
fprintf(stderr, "%s: not enough memory\n", __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ustat->nb_err = err;
|
||||
ustat->nb_req = 1;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ Wants=network-online.target
|
|||
[Service]
|
||||
EnvironmentFile=-/etc/default/haproxy
|
||||
EnvironmentFile=-/etc/sysconfig/haproxy
|
||||
Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid" "CFGDIR=/etc/haproxy/conf.d" "EXTRAOPTS=-S /run/haproxy-master.sock"
|
||||
ExecStart=@SBINDIR@/haproxy -Ws -f $CONFIG -f $CFGDIR -p $PIDFILE $EXTRAOPTS
|
||||
ExecReload=@SBINDIR@/haproxy -Ws -f $CONFIG -f $CFGDIR -c $EXTRAOPTS
|
||||
Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid" "EXTRAOPTS=-S /run/haproxy-master.sock"
|
||||
ExecStart=@SBINDIR@/haproxy -Ws -f $CONFIG -p $PIDFILE $EXTRAOPTS
|
||||
ExecReload=@SBINDIR@/haproxy -Ws -f $CONFIG -c $EXTRAOPTS
|
||||
ExecReload=/bin/kill -USR2 $MAINPID
|
||||
KillMode=mixed
|
||||
Restart=always
|
||||
|
|
|
|||
|
|
@ -1,162 +0,0 @@
|
|||
/*
|
||||
* Extracts the libs archives from a core dump
|
||||
*
|
||||
* Copyright (C) 2026 Willy Tarreau <w@1wt.eu>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Note: builds with no option under glibc, and can be built as a minimal
|
||||
* uploadable static executable using nolibc as well:
|
||||
gcc -o libs-from-core -nostdinc -nostdlib -s -Os -static -fno-ident \
|
||||
-fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables \
|
||||
-Wl,--gc-sections,--orphan-handling=discard,-znoseparate-code \
|
||||
-I /path/to/nolibc-sysroot/include libs-from-core.c
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <elf.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void usage(const char *progname)
|
||||
{
|
||||
const char *slash = strrchr(progname, '/');
|
||||
|
||||
if (slash)
|
||||
progname = slash + 1;
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-q] <core_file>\n"
|
||||
"Locate a libs archive from an haproxy core dump and dump it to stdout.\n"
|
||||
"Arguments:\n"
|
||||
" -q Query mode: only report offset and length, do not dump\n"
|
||||
" core_file Core dump produced by haproxy\n",
|
||||
progname);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Elf64_Ehdr *ehdr;
|
||||
Elf64_Phdr *phdr;
|
||||
struct stat st;
|
||||
uint8_t *mem;
|
||||
int i, fd;
|
||||
const char *fname;
|
||||
int quiet = 0;
|
||||
int arg;
|
||||
|
||||
for (arg = 1; arg < argc; arg++) {
|
||||
if (*argv[arg] != '-')
|
||||
break;
|
||||
|
||||
if (strcmp(argv[arg], "-q") == 0)
|
||||
quiet = 1;
|
||||
else if (strcmp(argv[arg], "--") == 0) {
|
||||
arg++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (arg < argc) {
|
||||
fname = argv[arg];
|
||||
} else {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fd = open(fname, O_RDONLY);
|
||||
|
||||
/* Let's just map the core dump as an ELF header */
|
||||
fstat(fd, &st);
|
||||
mem = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (mem == MAP_FAILED) {
|
||||
perror("mmap()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* get the program headers */
|
||||
ehdr = (Elf64_Ehdr *)mem;
|
||||
|
||||
/* check that it's really a core. Should be "\x7fELF" */
|
||||
if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) {
|
||||
fprintf(stderr, "ELF magic not found.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ehdr->e_ident[EI_CLASS] != ELFCLASS64) {
|
||||
fprintf(stderr, "Only 64-bit ELF supported.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ehdr->e_type != ET_CORE) {
|
||||
fprintf(stderr, "ELF type %d, not a core dump.\n", ehdr->e_type);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* OK we can safely go with program headers */
|
||||
phdr = (Elf64_Phdr *)(mem + ehdr->e_phoff);
|
||||
|
||||
for (i = 0; i < ehdr->e_phnum; i++) {
|
||||
uint64_t size = phdr[i].p_filesz;
|
||||
uint64_t offset = phdr[i].p_offset;
|
||||
int ret = 0;
|
||||
|
||||
if (phdr[i].p_type != PT_LOAD)
|
||||
continue;
|
||||
|
||||
//fprintf(stderr, "Scanning segment %d...\n", ehdr->e_phnum);
|
||||
//fprintf(stderr, "\r%-5d: off=%lx va=%lx sz=%lx ", i, (long)offset, (long)phdr[i].p_vaddr, (long)size);
|
||||
if (!size)
|
||||
continue;
|
||||
|
||||
if (size < 512) // minimum for a tar header
|
||||
continue;
|
||||
|
||||
/* tar magic */
|
||||
if (memcmp(mem + offset + 257, "ustar\0""00", 8) != 0)
|
||||
continue;
|
||||
|
||||
/* uid, gid */
|
||||
if (memcmp(mem + offset + 108, "0000000\0""0000000\0", 16) != 0)
|
||||
continue;
|
||||
|
||||
/* link name */
|
||||
if (memcmp(mem + offset + 157, "haproxy-libs-dump\0", 18) != 0)
|
||||
continue;
|
||||
|
||||
/* OK that's really it */
|
||||
|
||||
if (quiet)
|
||||
printf("offset=%#lx size=%#lx\n", offset, size);
|
||||
else
|
||||
ret = (write(1, mem + offset, size) == size) ? 0 : 1;
|
||||
return ret;
|
||||
}
|
||||
//fprintf(stderr, "\r%75s\n", "\r");
|
||||
fprintf(stderr, "libs archive not found. Was 'set-dumpable' set to 'libs' ?\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# show non-null memprofile entries with method, alloc/free counts/tot and caller
|
||||
|
||||
define memprof_dump
|
||||
set $i = 0
|
||||
set $meth={ "UNKN", "MALL", "CALL", "REAL", "STRD", "FREE", "P_AL", "P_FR", "STND", "VALL", "ALAL", "PALG", "MALG", "PVAL" }
|
||||
while $i < sizeof(memprof_stats) / sizeof(memprof_stats[0])
|
||||
if memprof_stats[$i].alloc_calls || memprof_stats[$i].free_calls
|
||||
set $m = memprof_stats[$i].method
|
||||
printf "m:%s ac:%u fc:%u at:%u ft:%u ", $meth[$m], \
|
||||
memprof_stats[$i].alloc_calls, memprof_stats[$i].free_calls, \
|
||||
memprof_stats[$i].alloc_tot, memprof_stats[$i].free_tot
|
||||
output/a memprof_stats[$i].caller
|
||||
printf "\n"
|
||||
end
|
||||
set $i = $i + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
* Find the post-mortem offset from a core dump
|
||||
*
|
||||
* Copyright (C) 2026 Willy Tarreau <w@1wt.eu>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Note: builds with no option under glibc, and can be built as a minimal
|
||||
* uploadable static executable using nolibc as well:
|
||||
gcc -o pm-from-core -nostdinc -nostdlib -s -Os -static -fno-ident \
|
||||
-fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables \
|
||||
-Wl,--gc-sections,--orphan-handling=discard,-znoseparate-code \
|
||||
-I /path/to/nolibc-sysroot/include pm-from-core.c
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <elf.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__GLIBC__)
|
||||
# define my_memmem memmem
|
||||
#else
|
||||
void *my_memmem(const void *haystack, size_t haystacklen,
|
||||
const void *needle, size_t needlelen)
|
||||
{
|
||||
while (haystacklen >= needlelen) {
|
||||
if (!memcmp(haystack, needle, needlelen))
|
||||
return (void*)haystack;
|
||||
haystack++;
|
||||
haystacklen--;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define MAGIC "POST-MORTEM STARTS HERE+7654321\0"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Elf64_Ehdr *ehdr;
|
||||
Elf64_Phdr *phdr;
|
||||
struct stat st;
|
||||
uint8_t *mem;
|
||||
int i, fd;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s <core_file>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_RDONLY);
|
||||
|
||||
/* Let's just map the core dump as an ELF header */
|
||||
fstat(fd, &st);
|
||||
mem = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (mem == MAP_FAILED) {
|
||||
perror("mmap()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* get the program headers */
|
||||
ehdr = (Elf64_Ehdr *)mem;
|
||||
|
||||
/* check that it's really a core. Should be "\x7fELF" */
|
||||
if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) {
|
||||
fprintf(stderr, "ELF magic not found.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ehdr->e_ident[EI_CLASS] != ELFCLASS64) {
|
||||
fprintf(stderr, "Only 64-bit ELF supported.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ehdr->e_type != ET_CORE) {
|
||||
fprintf(stderr, "ELF type %d, not a core dump.\n", ehdr->e_type);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* OK we can safely go with program headers */
|
||||
phdr = (Elf64_Phdr *)(mem + ehdr->e_phoff);
|
||||
|
||||
for (i = 0; i < ehdr->e_phnum; i++) {
|
||||
uint64_t size = phdr[i].p_filesz;
|
||||
uint64_t offset = phdr[i].p_offset;
|
||||
uint64_t vaddr = phdr[i].p_vaddr;
|
||||
uint64_t found_ofs;
|
||||
uint8_t *found;
|
||||
|
||||
if (phdr[i].p_type != PT_LOAD)
|
||||
continue;
|
||||
|
||||
//printf("Scanning segment %d...\n", ehdr->e_phnum);
|
||||
//printf("\r%-5d: off=%lx va=%lx sz=%lx ", i, (long)offset, (long)vaddr, (long)size);
|
||||
if (!size)
|
||||
continue;
|
||||
|
||||
if (size >= 1048576) // don't scan large segments
|
||||
continue;
|
||||
|
||||
found = my_memmem(mem + offset, size, MAGIC, sizeof(MAGIC) - 1);
|
||||
if (!found)
|
||||
continue;
|
||||
|
||||
found_ofs = found - (mem + offset);
|
||||
|
||||
printf("Found post-mortem magic in segment %d:\n", i);
|
||||
printf(" Core File Offset: 0x%lx (0x%lx + 0x%lx)\n", offset + found_ofs, offset, found_ofs);
|
||||
printf(" Runtime VAddr: 0x%lx (0x%lx + 0x%lx)\n", vaddr + found_ofs, vaddr, found_ofs);
|
||||
printf(" Segment Size: 0x%lx\n", size);
|
||||
printf("\nIn gdb, copy-paste this line:\n\n pm_init 0x%lx\n\n", vaddr + found_ofs);
|
||||
return 0;
|
||||
}
|
||||
//printf("\r%75s\n", "\r");
|
||||
printf("post-mortem magic not found\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -14,8 +14,8 @@ define pools_dump
|
|||
set $idx=$idx + 1
|
||||
end
|
||||
|
||||
set $mem = (unsigned long)$total * $e->size
|
||||
printf "list=%#lx pool_head=%p name=%s size=%u alloc=%u used=%u mem=%lu\n", $p, $e, $e->name, $e->size, $total, $used, $mem
|
||||
set $mem = $total * $e->size
|
||||
printf "list=%#lx pool_head=%p name=%s size=%u alloc=%u used=%u mem=%u\n", $p, $e, $e->name, $e->size, $total, $used, $mem
|
||||
set $p = *(void **)$p
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ struct ring_v2 {
|
|||
struct ring_v2a {
|
||||
size_t size; // storage size
|
||||
size_t rsvd; // header length (used for file-backed maps)
|
||||
size_t tail ALIGNED(64); // storage tail
|
||||
size_t head ALIGNED(64); // storage head
|
||||
char area[0] ALIGNED(64); // storage area begins immediately here
|
||||
size_t tail __attribute__((aligned(64))); // storage tail
|
||||
size_t head __attribute__((aligned(64))); // storage head
|
||||
char area[0] __attribute__((aligned(64))); // storage area begins immediately here
|
||||
};
|
||||
|
||||
/* display the message and exit with the code */
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ maintenance model and what the user wants is passed, then the LLM is invited to
|
|||
provide its opinion on the need for a backport and an explanation of the reason
|
||||
for its choice. This often helps the user to find a quick summary about the
|
||||
patch. All these outputs are then converted to a long HTML page with colors and
|
||||
radio buttons, where patches are preselected based on this classification,
|
||||
radio buttons, where patches are pre-selected based on this classification,
|
||||
that the user can consult and adjust, read the commits if needed, and the
|
||||
selected patches finally provide some copy-pastable commands in a text-area to
|
||||
select commit IDs to work on, typically in a form that's suitable for a simple
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
BEGININPUT
|
||||
BEGINCONTEXT
|
||||
|
||||
HAProxy's development cycle consists in one development branch, and multiple
|
||||
maintenance branches.
|
||||
|
||||
All the development is made into the development branch exclusively. This
|
||||
includes mostly new features, doc updates, cleanups and or course, fixes.
|
||||
|
||||
The maintenance branches, also called stable branches, never see any
|
||||
development, and only receive ultra-safe fixes for bugs that affect them,
|
||||
that are picked from the development branch.
|
||||
|
||||
Branches are numbered in 0.1 increments. Every 6 months, upon a new major
|
||||
release, the development branch enters maintenance and a new development branch
|
||||
is created with a new, higher version. The current development branch is
|
||||
3.3-dev, and maintenance branches are 3.2 and below.
|
||||
|
||||
Fixes created in the development branch for issues that were introduced in an
|
||||
earlier branch are applied in descending order to each and every version till
|
||||
that branch that introduced the issue: 3.2 first, then 3.1, then 3.0, then 2.9
|
||||
and so on. This operation is called "backporting". A fix for an issue is never
|
||||
backported beyond the branch that introduced the issue. An important point is
|
||||
that the project maintainers really aim at zero regression in maintenance
|
||||
branches, so they're never willing to take any risk backporting patches that
|
||||
are not deemed strictly necessary.
|
||||
|
||||
Fixes consist of patches managed using the Git version control tool and are
|
||||
identified by a Git commit ID and a commit message. For this reason we
|
||||
indistinctly talk about backporting fixes, commits, or patches; all mean the
|
||||
same thing. When mentioning commit IDs, developers always use a short form
|
||||
made of the first 8 characters only, and expect the AI assistant to do the
|
||||
same.
|
||||
|
||||
It seldom happens that some fixes depend on changes that were brought by other
|
||||
patches that were not in some branches and that will need to be backported as
|
||||
well for the fix to work. In this case, such information is explicitly provided
|
||||
in the commit message by the patch's author in natural language.
|
||||
|
||||
Developers are serious and always indicate if a patch needs to be backported.
|
||||
Sometimes they omit the exact target branch, or they will say that the patch is
|
||||
"needed" in some older branch, but it means the same. If a commit message
|
||||
doesn't mention any backport instructions, it means that the commit does not
|
||||
have to be backported. And patches that are not strictly bug fixes nor doc
|
||||
improvements are normally not backported. For example, fixes for design
|
||||
limitations, architectural improvements and performance optimizations are
|
||||
considered too risky for a backport. Finally, all bug fixes are tagged as
|
||||
"BUG" at the beginning of their subject line. Patches that are not tagged as
|
||||
such are not bugs, and must never be backported unless their commit message
|
||||
explicitly requests so.
|
||||
|
||||
ENDCONTEXT
|
||||
|
||||
A developer is reviewing the development branch, trying to spot which commits
|
||||
need to be backported to maintenance branches. This person is already expert
|
||||
on HAProxy and everything related to Git, patch management, and the risks
|
||||
associated with backports, so he doesn't want to be told how to proceed nor to
|
||||
review the contents of the patch.
|
||||
|
||||
The goal for this developer is to get some help from the AI assistant to save
|
||||
some precious time on this tedious review work. In order to do a better job, he
|
||||
needs an accurate summary of the information and instructions found in each
|
||||
commit message. Specifically he needs to figure if the patch fixes a problem
|
||||
affecting an older branch or not, if it needs to be backported, if so to which
|
||||
branches, and if other patches need to be backported along with it.
|
||||
|
||||
The indented text block below after an "id" line and starting with a Subject line
|
||||
is a commit message from the HAProxy development branch that describes a patch
|
||||
applied to that branch, starting with its subject line, please read it carefully.
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
ENDINPUT
|
||||
BEGININSTRUCTION
|
||||
|
||||
You are an AI assistant that follows instruction extremely well. Help as much
|
||||
as you can, responding to a single question using a single response.
|
||||
|
||||
The developer wants to know if he needs to backport the patch above to fix
|
||||
maintenance branches, for which branches, and what possible dependencies might
|
||||
be mentioned in the commit message. Carefully study the commit message and its
|
||||
backporting instructions if any (otherwise it should probably not be backported),
|
||||
then provide a very concise and short summary that will help the developer decide
|
||||
to backport it, or simply to skip it.
|
||||
|
||||
Start by explaining in one or two sentences what you recommend for this one and why.
|
||||
Finally, based on your analysis, give your general conclusion as "Conclusion: X"
|
||||
where X is a single word among:
|
||||
- "yes", if you recommend to backport the patch right now either because
|
||||
it explicitly states this or because it's a fix for a bug that affects
|
||||
a maintenance branch (3.2 or lower);
|
||||
- "wait", if this patch explicitly mentions that it must be backported, but
|
||||
only after waiting some time.
|
||||
- "no", if nothing clearly indicates a necessity to backport this patch (e.g.
|
||||
lack of explicit backport instructions, or it's just an improvement);
|
||||
- "uncertain" otherwise for cases not covered above
|
||||
|
||||
ENDINSTRUCTION
|
||||
|
||||
Explanation:
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
BEGININPUT
|
||||
BEGINCONTEXT
|
||||
|
||||
HAProxy's development cycle consists in one development branch, and multiple
|
||||
maintenance branches.
|
||||
|
||||
All the development is made into the development branch exclusively. This
|
||||
includes mostly new features, doc updates, cleanups and or course, fixes.
|
||||
|
||||
The maintenance branches, also called stable branches, never see any
|
||||
development, and only receive ultra-safe fixes for bugs that affect them,
|
||||
that are picked from the development branch.
|
||||
|
||||
Branches are numbered in 0.1 increments. Every 6 months, upon a new major
|
||||
release, the development branch enters maintenance and a new development branch
|
||||
is created with a new, higher version. The current development branch is
|
||||
3.4-dev, and maintenance branches are 3.3 and below.
|
||||
|
||||
Fixes created in the development branch for issues that were introduced in an
|
||||
earlier branch are applied in descending order to each and every version till
|
||||
that branch that introduced the issue: 3.3 first, then 3.2, then 3.1, then 3.0
|
||||
and so on. This operation is called "backporting". A fix for an issue is never
|
||||
backported beyond the branch that introduced the issue. An important point is
|
||||
that the project maintainers really aim at zero regression in maintenance
|
||||
branches, so they're never willing to take any risk backporting patches that
|
||||
are not deemed strictly necessary.
|
||||
|
||||
Fixes consist of patches managed using the Git version control tool and are
|
||||
identified by a Git commit ID and a commit message. For this reason we
|
||||
indistinctly talk about backporting fixes, commits, or patches; all mean the
|
||||
same thing. When mentioning commit IDs, developers always use a short form
|
||||
made of the first 8 characters only, and expect the AI assistant to do the
|
||||
same.
|
||||
|
||||
It seldom happens that some fixes depend on changes that were brought by other
|
||||
patches that were not in some branches and that will need to be backported as
|
||||
well for the fix to work. In this case, such information is explicitly provided
|
||||
in the commit message by the patch's author in natural language.
|
||||
|
||||
Developers are serious and always indicate if a patch needs to be backported.
|
||||
Sometimes they omit the exact target branch, or they will say that the patch is
|
||||
"needed" in some older branch, but it means the same. If a commit message
|
||||
doesn't mention any backport instructions, it means that the commit does not
|
||||
have to be backported. And patches that are not strictly bug fixes nor doc
|
||||
improvements are normally not backported. For example, fixes for design
|
||||
limitations, architectural improvements and performance optimizations are
|
||||
considered too risky for a backport. Finally, all bug fixes are tagged as
|
||||
"BUG" at the beginning of their subject line. Patches that are not tagged as
|
||||
such are not bugs, and must never be backported unless their commit message
|
||||
explicitly requests so.
|
||||
|
||||
ENDCONTEXT
|
||||
|
||||
A developer is reviewing the development branch, trying to spot which commits
|
||||
need to be backported to maintenance branches. This person is already expert
|
||||
on HAProxy and everything related to Git, patch management, and the risks
|
||||
associated with backports, so he doesn't want to be told how to proceed nor to
|
||||
review the contents of the patch.
|
||||
|
||||
The goal for this developer is to get some help from the AI assistant to save
|
||||
some precious time on this tedious review work. In order to do a better job, he
|
||||
needs an accurate summary of the information and instructions found in each
|
||||
commit message. Specifically he needs to figure if the patch fixes a problem
|
||||
affecting an older branch or not, if it needs to be backported, if so to which
|
||||
branches, and if other patches need to be backported along with it.
|
||||
|
||||
The indented text block below after an "id" line and starting with a Subject line
|
||||
is a commit message from the HAProxy development branch that describes a patch
|
||||
applied to that branch, starting with its subject line, please read it carefully.
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
ENDINPUT
|
||||
BEGININSTRUCTION
|
||||
|
||||
You are an AI assistant that follows instruction extremely well. Help as much
|
||||
as you can, responding to a single question using a single response.
|
||||
|
||||
The developer wants to know if he needs to backport the patch above to fix
|
||||
maintenance branches, for which branches, and what possible dependencies might
|
||||
be mentioned in the commit message. Carefully study the commit message and its
|
||||
backporting instructions if any (otherwise it should probably not be backported),
|
||||
then provide a very concise and short summary that will help the developer decide
|
||||
to backport it, or simply to skip it.
|
||||
|
||||
Start by explaining in one or two sentences what you recommend for this one and why.
|
||||
Finally, based on your analysis, give your general conclusion as "Conclusion: X"
|
||||
where X is a single word among:
|
||||
- "yes", if you recommend to backport the patch right now either because
|
||||
it explicitly states this or because it's a fix for a bug that affects
|
||||
a maintenance branch (3.3 or lower);
|
||||
- "wait", if this patch explicitly mentions that it must be backported, but
|
||||
only after waiting some time.
|
||||
- "no", if nothing clearly indicates a necessity to backport this patch (e.g.
|
||||
lack of explicit backport instructions, or it's just an improvement);
|
||||
- "uncertain" otherwise for cases not covered above
|
||||
|
||||
ENDINSTRUCTION
|
||||
|
||||
Explanation:
|
||||
|
|
@ -22,8 +22,7 @@ STABLE=$(cd "$HAPROXY_DIR" && git describe --tags "v${BRANCH}-dev0^" |cut -f1,2
|
|||
PATCHES_DIR="$PATCHES_PFX"-"$BRANCH"
|
||||
|
||||
(cd "$HAPROXY_DIR"
|
||||
# avoid git pull, it chokes on forced push
|
||||
git remote update origin; git reset origin/master;git checkout -f
|
||||
git pull
|
||||
last_file=$(ls -1 "$PATCHES_DIR"/*.patch 2>/dev/null | tail -n1)
|
||||
if [ -n "$last_file" ]; then
|
||||
restart=$(head -n1 "$last_file" | cut -f2 -d' ')
|
||||
|
|
|
|||
BIN
dev/phash/a.out
Executable file
BIN
dev/phash/a.out
Executable file
Binary file not shown.
|
|
@ -30,10 +30,10 @@ static const char *tevt_fd_types[16] = {
|
|||
};
|
||||
|
||||
static const char *tevt_hs_types[16] = {
|
||||
[ 0] = "-", [ 1] = "-", [ 2] = "-", [ 3] = "-",
|
||||
[ 4] = "snd_err", [ 5] = "truncated_shutr", [ 6] = "truncated_rcv_err", [ 7] = "-",
|
||||
[ 8] = "-", [ 9] = "-", [10] = "-", [11] = "-",
|
||||
[12] = "-", [13] = "-", [14] = "-", [15] = "-",
|
||||
[ 0] = "-", [ 1] = "-", [ 2] = "-", [ 3] = "rcv_err",
|
||||
[ 4] = "snd_err", [ 5] = "-", [ 6] = "-", [ 7] = "-",
|
||||
[ 8] = "-", [ 9] = "-", [10] = "-", [11] = "-",
|
||||
[12] = "-", [13] = "-", [14] = "-", [15] = "-",
|
||||
};
|
||||
|
||||
static const char *tevt_xprt_types[16] = {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ DeviceAtlas Device Detection
|
|||
|
||||
In order to add DeviceAtlas Device Detection support, you would need to download
|
||||
the API source code from https://deviceatlas.com/deviceatlas-haproxy-module.
|
||||
Once extracted, two modes are supported :
|
||||
|
||||
1/ Build HAProxy and DeviceAtlas in one command
|
||||
Once extracted :
|
||||
|
||||
$ make TARGET=<target> USE_DEVICEATLAS=1 DEVICEATLAS_SRC=<path to the API root folder>
|
||||
|
||||
|
|
@ -16,6 +14,10 @@ directory. Also, in the case the api cache support is not needed and/or a C++ to
|
|||
|
||||
$ make TARGET=<target> USE_DEVICEATLAS=1 DEVICEATLAS_SRC=<path to the API root folder> DEVICEATLAS_NOCACHE=1
|
||||
|
||||
However, if the API had been installed beforehand, DEVICEATLAS_SRC
|
||||
can be omitted. Note that the DeviceAtlas C API version supported is from the 3.x
|
||||
releases series (3.2.1 minimum recommended).
|
||||
|
||||
For HAProxy developers who need to verify that their changes didn't accidentally
|
||||
break the DeviceAtlas code, it is possible to build a dummy library provided in
|
||||
the addons/deviceatlas/dummy directory and to use it as an alternative for the
|
||||
|
|
@ -25,29 +27,6 @@ validate API changes :
|
|||
|
||||
$ make TARGET=<target> USE_DEVICEATLAS=1 DEVICEATLAS_SRC=$PWD/addons/deviceatlas/dummy
|
||||
|
||||
2/ Build and install DeviceAtlas according to https://docs.deviceatlas.com/apis/enterprise/c/<release version>/README.html
|
||||
|
||||
For example :
|
||||
In the deviceatlas library folder :
|
||||
$ cmake .
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
In the HAProxy folder :
|
||||
$ make TARGET=<target> USE_DEVICEATLAS=1
|
||||
|
||||
Note that if the -DCMAKE_INSTALL_PREFIX cmake option had been used, it is necessary to set as well DEVICEATLAS_LIB and
|
||||
DEVICEATLAS_INC as follow :
|
||||
$ make TARGET=<target> USE_DEVICEATLAS=1 DEVICEATLAS_INC=<CMAKE_INSTALL_PREFIX value>/include DEVICEATLAS_LIB=<CMAKE_INSTALL_PREFIX value>/lib
|
||||
|
||||
For example :
|
||||
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/local
|
||||
$ make
|
||||
$ sudo make install
|
||||
$ make TARGET=<target> USE_DEVICEATLAS=1 DEVICEATLAS_INC=/opt/local/include DEVICEATLAS_LIB=/opt/local/lib
|
||||
|
||||
Note that DEVICEATLAS_SRC is omitted in this case.
|
||||
|
||||
These are supported DeviceAtlas directives (see doc/configuration.txt) :
|
||||
- deviceatlas-json-file <path to the DeviceAtlas JSON data file>.
|
||||
- deviceatlas-log-level <number> (0 to 3, level of information returned by
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
A number of contributors are often embarrassed with coding style issues, they
|
||||
don't always know if they're doing it right, especially since the coding style
|
||||
has evolved along the years. What is explained here is not necessarily what is
|
||||
has elvoved along the years. What is explained here is not necessarily what is
|
||||
applied in the code, but new code should as much as possible conform to this
|
||||
style. Coding style fixes happen when code is replaced. It is useless to send
|
||||
patches to fix coding style only, they will be rejected, unless they belong to
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
140
doc/haterm.txt
140
doc/haterm.txt
|
|
@ -1,140 +0,0 @@
|
|||
------
|
||||
HATerm
|
||||
------
|
||||
HAProxy's dummy HTTP
|
||||
server for benchmarks
|
||||
|
||||
1. Background
|
||||
-------------
|
||||
|
||||
HATerm is a dummy HTTP server that leverages the flexible and scalable
|
||||
architecture of HAProxy to ease benchmarking of HTTP agents in all versions of
|
||||
HTTP currently supported by HAProxy (HTTP/1, HTTP/2, HTTP/3), and both in clear
|
||||
and TLS / QUIC. It follows the same principle as its ancestor HTTPTerm [1],
|
||||
consisting in producing HTTP responses entirely configured by the request
|
||||
parameters (size, response time, status etc). It also preserves the spirit
|
||||
HTTPTerm which does not require any configuration beyond an optional listening
|
||||
address and a port number, though it also supports advanced configurations with
|
||||
the full spectrum of HAProxy features for specific testing. The goal remains
|
||||
to make it almost as fast as the original HTTPTerm so that it can become a
|
||||
de-facto replacement, with a compatible command line and request parameters
|
||||
that will not change users' habits.
|
||||
|
||||
[1] https://github.com/wtarreau/httpterm
|
||||
|
||||
|
||||
2. Compilation
|
||||
--------------
|
||||
|
||||
HATerm may be compiled in the same way as HAProxy but with "haterm" as Makefile
|
||||
target to provide on the "make" command line as follows:
|
||||
|
||||
$ make -j $(nproc) TARGET=linux-glibc haterm
|
||||
|
||||
HATerm supports HTTPS/SSL/TCP:
|
||||
|
||||
$ make TARGET=linux-glibc USE_OPENSSL=1
|
||||
|
||||
It also supports QUIC:
|
||||
|
||||
$ make -j $(nproc) TARGET=linux-glibc USE_OPENSSL=1 USE_QUIC=1 haterm
|
||||
|
||||
Technically speaking, it uses the regular HAProxy source and object code with a
|
||||
different command line parser. As such, all build options supported by HAProxy
|
||||
also apply to HATerm. See INSTALL for more details about how to compile them.
|
||||
|
||||
|
||||
3. Execution
|
||||
------------
|
||||
|
||||
HATerm is a very easy to use HTTP server with supports for all the HTTP
|
||||
versions. It displays its usage when run without argument or wrong arguments:
|
||||
|
||||
$ ./haterm
|
||||
Usage : haterm -L [<ip>]:<clear port>[:<TCP&QUIC SSL port>] [-L...]* [opts]
|
||||
where <opts> may be any combination of:
|
||||
-G <line> : multiple option; append <line> to the "global" section
|
||||
-F <line> : multiple option; append <line> to the "frontend" section
|
||||
-T <line> : multiple option; append <line> to the "traces" section
|
||||
-C : dump the configuration and exit
|
||||
-D : goes daemon
|
||||
-b <keysize> : RSA key size in bits (ex: "2048", "4096"...)
|
||||
-c <curves> : ECSDA curves (ex: "P-256", "P-384"...)
|
||||
-v : shows version
|
||||
-d : enable the traces for all http protocols
|
||||
--quic-bind-opts <opts> : append options to QUIC "bind" lines
|
||||
--tcp-bind-opts <opts> : append options to TCP "bind" lines
|
||||
|
||||
|
||||
Arguments -G, -F, -T permit to append one or multiple lines at the end of their
|
||||
respective sections. A tab character ('\t') is prepended at the beginning of
|
||||
the argument, and a line feed ('\n') is appended at the end. It is also
|
||||
possible to insert multiple lines at once using escape sequences '\n' and '\t'
|
||||
inside the string argument.
|
||||
|
||||
As HAProxy, HATerm may listen on several TCP/UDP addresses which can be
|
||||
provided by multiple "-L" options. To be functional, it needs at least one
|
||||
correct "-L" option to be set.
|
||||
|
||||
Examples:
|
||||
|
||||
$ ./haterm -L 127.0.0.1:8888 # listen on 127.0.0.1:8888 TCP address
|
||||
|
||||
$ ./haterm -L 127.0.0.1:8888:8889 # listen on 127.0.0.1:8888 TCP address,
|
||||
# 127.0.01:8889 SSL/TCP address,
|
||||
# and 127.0.01:8889 QUIC/UDP address
|
||||
|
||||
$ ./haterm -L 127.0.0.1:8888:8889 -L [::1]:8888:8889
|
||||
|
||||
With USE_QUIC_OPENSSL_COMPAT support, the user must configure a global
|
||||
section as for HAProxy. HATerm sets internally its configuration in.
|
||||
memory as this is done by HAProxy from configuration files:
|
||||
|
||||
$ ./haterm -L 127.0.0.1:8888:8889
|
||||
[NOTICE] (1371578) : haproxy version is 3.4-dev4-ba5eab-28
|
||||
[NOTICE] (1371578) : path to executable is ./haterm
|
||||
[ALERT] (1371578) : Binding [haterm cfgfile:12] for frontend
|
||||
___haterm_frontend___: this SSL library does not
|
||||
support the QUIC protocol. A limited compatibility
|
||||
layer may be enabled using the "limited-quic" global
|
||||
option if desired.
|
||||
|
||||
Such an alert may be fixed with "-G' option:
|
||||
|
||||
$ ./haterm -L 127.0.0.1:8888:8889 -G "limited-quic"
|
||||
|
||||
|
||||
When the SSL support is not compiled in, the second port is ignored. This is
|
||||
also the case for the QUIC support.
|
||||
|
||||
HATerm adjusts its responses depending on the requests it receives. An empty
|
||||
query string provides the information about how the URIs are understood by
|
||||
HATerm:
|
||||
|
||||
$ curl http://127.0.0.1:8888/?
|
||||
HAProxy's dummy HTTP server for benchmarks - version 3.4-dev4.
|
||||
All integer argument values are in the form [digits]*[kmgr] (r=random(0..1))
|
||||
The following arguments are supported to override the default objects :
|
||||
- /?s=<size> return <size> bytes.
|
||||
E.g. /?s=20k
|
||||
- /?r=<retcode> present <retcode> as the HTTP return code.
|
||||
E.g. /?r=404
|
||||
- /?c=<cache> set the return as not cacheable if <1.
|
||||
E.g. /?c=0
|
||||
- /?A=<req-after> drain the request body after sending the response.
|
||||
E.g. /?A=1
|
||||
- /?C=<close> force the response to use close if >0.
|
||||
E.g. /?C=1
|
||||
- /?K=<keep-alive> force the response to use keep-alive if >0.
|
||||
E.g. /?K=1
|
||||
- /?t=<time> wait <time> milliseconds before responding.
|
||||
E.g. /?t=500
|
||||
- /?k=<enable> Enable transfer encoding chunked with only one chunk
|
||||
if >0.
|
||||
- /?R=<enable> Enable sending random data if >0.
|
||||
|
||||
Note that those arguments may be cumulated on one line separated by a set of
|
||||
delimiters among [&?,;/] :
|
||||
- GET /?s=20k&c=1&t=700&K=30r HTTP/1.0
|
||||
- GET /?r=500?s=0?c=0?t=1000 HTTP/1.0
|
||||
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
The buffer list API allows one to share a certain amount of buffers between
|
||||
multiple entities, which will each see their own as lists of buffers, while
|
||||
keeping a shared free list. The immediate use case is for muxes, which may
|
||||
keeping a sharedd free list. The immediate use case is for muxes, which may
|
||||
want to allocate up to a certain number of buffers per connection, shared
|
||||
among all streams. In this case, each stream will first request a new list
|
||||
for its own use, then may request extra entries from the free list. At any
|
||||
|
|
|
|||
|
|
@ -539,22 +539,10 @@ message. These functions are used by HTX analyzers or by multiplexers.
|
|||
with the first block not removed, or NULL if everything was removed, and
|
||||
the amount of data drained.
|
||||
|
||||
- htx_xfer() transfers HTX blocks from an HTX message to another, stopping
|
||||
when a specific amount of bytes, including meta-data, was copied. If the
|
||||
tail block is a DATA block, it may be partially copied. All other block
|
||||
are transferred at once. By default, copied blocks are removed from the
|
||||
original HTX message and headers and trailers parts cannot be partially
|
||||
copied. But flags can be set to change the default behavior:
|
||||
|
||||
- HTX_XFER_KEEP_SRC_BLKS: source blocks are not removed
|
||||
- HTX_XFER_PARTIAL_HDRS_COPY: partial headers and trailers
|
||||
part can be xferred
|
||||
- HTX_XFER_HDRS_ONLY: Only the headers part is xferred
|
||||
|
||||
- htx_xfer_blks() [DEPRECATED] transfers HTX blocks from an HTX message to
|
||||
another, stopping after the first block of a specified type is transferred
|
||||
or when a specific amount of bytes, including meta-data, was moved. If the
|
||||
tail block is a DATA block, it may be partially moved. All other block are
|
||||
- htx_xfer_blks() transfers HTX blocks from an HTX message to another,
|
||||
stopping after the first block of a specified type is transferred or when
|
||||
a specific amount of bytes, including meta-data, was moved. If the tail
|
||||
block is a DATA block, it may be partially moved. All other block are
|
||||
transferred at once or kept. This function returns a mixed value, with the
|
||||
last block moved, or NULL if nothing was moved, and the amount of data
|
||||
transferred. When HEADERS or TRAILERS blocks must be transferred, this
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
2025-08-13 - Memory allocation in HAProxy 3.3
|
||||
|
||||
The vast majority of dynamic memory allocations are performed from pools. Pools
|
||||
are optimized to store pre-calibrated objects of the right size for a given
|
||||
usage, try to favor locality and hot objects as much as possible, and are
|
||||
heavily instrumented to detect and help debug a wide class of bugs including
|
||||
buffer overflows, use-after-free, etc.
|
||||
|
||||
For objects of random sizes, or those used only at configuration time, pools
|
||||
are not suited, and the regular malloc/free family is available, in addition of
|
||||
a few others.
|
||||
|
||||
The standard allocation calls are intercepted at the code level (#define) when
|
||||
the code is compiled with -DDEBUG_MEM_STATS. For this reason, these calls are
|
||||
redefined as macros in "bug.h", and one must not try to use the pointers to
|
||||
such functions, as this may break DEBUG_MEM_STATS. This provides fine-grained
|
||||
stats about allocation/free per line of source code using locally implemented
|
||||
counters that can be consulted by "debug dev memstats". The calls are
|
||||
categorized into one of "calloc", "free", "malloc", "realloc", "strdup",
|
||||
"p_alloc", "p_free", the latter two designating pools. Extra calls such as
|
||||
memalign() and similar are also intercepted and counted as malloc.
|
||||
|
||||
Due to the nature of this replacement, DEBUG_MEM_STATS cannot see operations
|
||||
performed in libraries or dependencies.
|
||||
|
||||
In addition to DEBUG_MEM_STATS, when haproxy is built with USE_MEMORY_PROFILING
|
||||
the standard functions are wrapped by new ones defined in "activity.c", which
|
||||
also hold counters by call place. These ones are able to trace activity in
|
||||
libraries because the functions check the return pointer to figure where the
|
||||
call was made. The approach is different and relies on a large hash table. The
|
||||
files, function names and line numbers are not know, but by passing the pointer
|
||||
to dladdr(), we can often resolve most of these symbols. These operations are
|
||||
consulted via "show profiling memory". It must first be enabled either in the
|
||||
global config "profiling.memory on" or the CLI using "set profiling memory on".
|
||||
Memory profiling can also track pool allocations and frees thanks to knowing
|
||||
the size of the element and knowing a place where to store it. Some future
|
||||
evolutions might consider making this possible as well for pure malloc/free
|
||||
too by leveraging malloc_usable_size() a bit more.
|
||||
|
||||
Finally, 3.3 brought aligned allocations. These are made available via a new
|
||||
family of functions around ha_aligned_alloc() that simply map to either
|
||||
posix_memalign(), memalign() or _aligned_malloc() for CYGWIN, depending on
|
||||
which one is available. This latter one requires to pass the pointer to
|
||||
_aligned_free() instead of free(), so for this reason, all aligned allocations
|
||||
have to be released using ha_aligned_free(). Since this mostly happens on
|
||||
configuration elements, in practice it's not as inconvenient as it can sound.
|
||||
These functions are in reality macros handled in "bug.h" like the previous
|
||||
ones in order to deal with DEBUG_MEM_STATS. All "alloc" variants are reported
|
||||
in memstats as "malloc". All "zalloc" variants are reported in memstats as
|
||||
"calloc".
|
||||
|
||||
The currently available allocators are the following:
|
||||
|
||||
- void *ha_aligned_alloc(size_t align, size_t size)
|
||||
- void *ha_aligned_zalloc(size_t align, size_t size)
|
||||
|
||||
Equivalent of malloc() but aligned to <align> bytes. The alignment MUST be
|
||||
at least as large as one word and MUST be a power of two. The "zalloc"
|
||||
variant also zeroes the area on success. Both return NULL on failure.
|
||||
|
||||
- void *ha_aligned_alloc_safe(size_t align, size_t size)
|
||||
- void *ha_aligned_zalloc_safe(size_t align, size_t size)
|
||||
|
||||
Equivalent of malloc() but aligned to <align> bytes. The alignment is
|
||||
automatically adjusted to the nearest larger power of two that is at least
|
||||
as large as a word. The "zalloc" variant also zeroes the area on
|
||||
success. Both return NULL on failure.
|
||||
|
||||
- (type *)ha_aligned_alloc_typed(size_t count, type)
|
||||
(type *)ha_aligned_zalloc_typed(size_t count, type)
|
||||
|
||||
This macro returns an area aligned to the required alignment for type
|
||||
<type>, large enough for <count> objects of this type, and the result is a
|
||||
pointer of this type. The goal is to ease allocation of known structures
|
||||
whose alignment is not necessarily known to the developer (and to avoid
|
||||
encouraging to hard-code alignment). The cast in return also provides a
|
||||
last-minute control in case a wrong type is mistakenly used due to a poor
|
||||
copy-paste or an extra "*" after the type. When DEBUG_MEM_STATS is in use,
|
||||
the type is stored as a string in the ".extra" field so that it can be
|
||||
displayed in "debug dev memstats". The "zalloc" variant also zeroes the
|
||||
area on success. Both return NULL on failure.
|
||||
|
||||
- void ha_aligned_free(void *ptr)
|
||||
|
||||
Frees the area pointed to by ptr. It is the equivalent of free() but for
|
||||
objects allocated using one of the functions above.
|
||||
|
|
@ -245,30 +245,6 @@ mt_list_pop(l)
|
|||
#=========#
|
||||
|
||||
|
||||
mt_list_pop_locked(l)
|
||||
Removes the list's first element, returns it locked. If the list was empty,
|
||||
NULL is returned. A macro MT_LIST_POP_LOCKED() is provided for a
|
||||
more convenient use; instead of returning the list element, it will return
|
||||
the structure holding the element, taking care of preserving the NULL.
|
||||
|
||||
before:
|
||||
+---+ +---+ +---+ +---+ +---+ +---+ +---+
|
||||
#=>| L |<===>| A |<===>| B |<===>| C |<===>| D |<===>| E |<===>| F |<=#
|
||||
# +---+ +---+ +---+ +---+ +---+ +---+ +---+ #
|
||||
#=====================================================================#
|
||||
|
||||
after:
|
||||
+---+ +---+ +---+ +---+ +---+ +---+
|
||||
#=>| L |<===>| B |<===>| C |<===>| D |<===>| E |<===>| F |<=#
|
||||
# +---+ +---+ +---+ +---+ +---+ +---+ #
|
||||
#===========================================================#
|
||||
|
||||
+---+
|
||||
# x| A |x #
|
||||
# +---+ #
|
||||
#=========#
|
||||
|
||||
|
||||
_mt_list_lock_next(elt)
|
||||
Locks the link that starts at the next pointer of the designated element.
|
||||
The link is replaced by two locked pointers, and a pointer to the next
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
2025-08-11 - Pools structure and API
|
||||
2022-02-24 - Pools structure and API
|
||||
|
||||
1. Background
|
||||
-------------
|
||||
|
|
@ -239,6 +239,10 @@ currently in use:
|
|||
+------------+ +------------+ / is set at build time
|
||||
or -dMtag at boot time
|
||||
|
||||
Right now no provisions are made to return objects aligned on larger boundaries
|
||||
than those currently covered by malloc() (i.e. two pointers). This need appears
|
||||
from time to time and the layout above might evolve a little bit if needed.
|
||||
|
||||
|
||||
4. Storage in the process-wide shared pool
|
||||
------------------------------------------
|
||||
|
|
@ -353,22 +357,6 @@ struct pool_head *create_pool(char *name, uint size, uint flags)
|
|||
returned pointer is the new (or reused) pool head, or NULL upon error.
|
||||
Pools created this way must be destroyed using pool_destroy().
|
||||
|
||||
struct pool_head *create_aligned_pool(char *name, uint size, uint align, uint flags)
|
||||
Create a new pool named <name> for objects of size <size> bytes and
|
||||
aligned to <align> bytes (0 meaning use the platform's default). Pool
|
||||
names are truncated to their first 11 characters. Pools of very similar
|
||||
size will usually be merged if both have set the flag MEM_F_SHARED in
|
||||
<flags>. When DEBUG_DONT_SHARE_POOLS was set at build time, or
|
||||
"-dMno-merge" is passed on the executable's command line, the pools
|
||||
also need to have the exact same name to be merged. In addition, unless
|
||||
MEM_F_EXACT is set in <flags>, the object size will usually be rounded
|
||||
up to the size of pointers (16 or 32 bytes). MEM_F_UAF may be set on a
|
||||
per-pool basis to enable the UAF detection only for this specific pool,
|
||||
saving the massive overhead of global usage. The name that will appear
|
||||
in the pool upon merging is the name of the first created pool. The
|
||||
returned pointer is the new (or reused) pool head, or NULL upon error.
|
||||
Pools created this way must be destroyed using pool_destroy().
|
||||
|
||||
void *pool_destroy(struct pool_head *pool)
|
||||
Destroy pool <pool>, that is, all of its unused objects are freed and
|
||||
the structure is freed as well if the pool didn't have any used objects
|
||||
|
|
@ -482,20 +470,6 @@ complicate maintenance.
|
|||
|
||||
A few macros exist to ease the declaration of pools:
|
||||
|
||||
DECLARE_ALIGNED_POOL(ptr, name, size, align)
|
||||
Placed at the top level of a file, this declares a global memory pool
|
||||
as variable <ptr>, name <name> and size <size> bytes per element, all
|
||||
of which will be aligned to <align> bytes. The alignment will be
|
||||
rounded up to the next power of two and will be at least as large as a
|
||||
word on the platform. This is made via a call to REGISTER_ALIGNED_POOL()
|
||||
and by assigning the resulting pointer to variable <ptr>. <ptr> will be
|
||||
created of type "struct pool_head *". If the pool needs to be visible
|
||||
outside of the function (which is likely), it will also need to be
|
||||
declared somewhere as "extern struct pool_head *<ptr>;". It is
|
||||
recommended to place such declarations very early in the source file so
|
||||
that the variable is already known to all subsequent functions which
|
||||
may use it.
|
||||
|
||||
DECLARE_POOL(ptr, name, size)
|
||||
Placed at the top level of a file, this declares a global memory pool
|
||||
as variable <ptr>, name <name> and size <size> bytes per element. This
|
||||
|
|
@ -507,17 +481,6 @@ DECLARE_POOL(ptr, name, size)
|
|||
declarations very early in the source file so that the variable is
|
||||
already known to all subsequent functions which may use it.
|
||||
|
||||
DECLARE_STATIC_ALIGNED_POOL(ptr, name, size, align)
|
||||
Placed at the top level of a file, this declares a global memory pool
|
||||
as variable <ptr>, name <name> and size <size> bytes per element, all
|
||||
of which will be aligned to <align> bytes. The alignment will be
|
||||
rounded up to the next power of two and will be at least as large as a
|
||||
word on the platform. This is made via a call to REGISTER_ALIGNED_POOL()
|
||||
and by assigning the resulting pointer to local variable <ptr>. <ptr>
|
||||
will be created of type "static struct pool_head *". It is recommended
|
||||
to place such declarations very early in the source file so that the
|
||||
variable is already known to all subsequent functions which may use it.
|
||||
|
||||
DECLARE_STATIC_POOL(ptr, name, size)
|
||||
Placed at the top level of a file, this declares a static memory pool
|
||||
as variable <ptr>, name <name> and size <size> bytes per element. This
|
||||
|
|
@ -527,42 +490,6 @@ DECLARE_STATIC_POOL(ptr, name, size)
|
|||
early in the source file so that the variable is already known to all
|
||||
subsequent functions which may use it.
|
||||
|
||||
DECLARE_STATIC_TYPED_POOL(ptr, name, type[, extra[, align]])
|
||||
Placed at the top level of a file, this declares a global memory pool
|
||||
as variable <ptr>, name <name>, and configured to allocate objects of
|
||||
type <type>. It is optionally possible to grow these objects by <extra>
|
||||
bytes (e.g. if they contain some variable length data at the end), and
|
||||
to force them to be aligned to <align> bytes. If only alignment is
|
||||
desired without extra data, pass 0 as <extra>. Alignment must be at
|
||||
least as large as the type's, and a control is enforced at declaration
|
||||
time so that objects cannot be less aligned than what is promised to
|
||||
the compiler. The default alignment of zero indicates that the default
|
||||
one (from the type) should be used. This is made via a call to
|
||||
REGISTER_ALIGNED_POOL() and by assigning the resulting pointer to local
|
||||
variable <ptr>. <ptr> will be created of type "static struct pool_head
|
||||
*". It is recommended to place such declarations very early in the
|
||||
source file so that the variable is already known to all subsequent
|
||||
functions which may use it.
|
||||
|
||||
DECLARE_TYPED_POOL(ptr, name, type[, extra[, align]])
|
||||
Placed at the top level of a file, this declares a global memory pool
|
||||
as variable <ptr>, name <name>, and configured to allocate objects of
|
||||
type <type>. It is optionally possible to grow these objects by <extra>
|
||||
bytes (e.g. if they contain some variable length data at the end), and
|
||||
to force them to be aligned to <align> bytes. If only alignment is
|
||||
desired without extra data, pass 0 as <extra>. Alignment must be at
|
||||
least as large as the type's, and a control is enforced at declaration
|
||||
time so that objects cannot be less aligned than what is promised to
|
||||
the compiler. The default alignment of zero indicates that the default
|
||||
one (from the type) should be used. This is made via a call to
|
||||
REGISTER_ALIGNED_POOL() and by assigning the resulting pointer to
|
||||
variable <ptr>. <ptr> will be created of type "struct pool_head *". If
|
||||
the pool needs to be visible outside of the function (which is likely),
|
||||
it will also need to be declared somewhere as "extern struct pool_head
|
||||
*<ptr>;". It is recommended to place such declarations very early in
|
||||
the source file so that the variable is already known to all subsequent
|
||||
functions which may use it.
|
||||
|
||||
|
||||
6. Build options
|
||||
----------------
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ default init, this was controversial but fedora and archlinux already uses it.
|
|||
At this time HAProxy still had a multi-process model, and the way haproxy is
|
||||
working was incompatible with the daemon mode.
|
||||
|
||||
Systemd is compatible with traditional forking services, but somehow HAProxy
|
||||
Systemd is compatible with traditionnal forking services, but somehow HAProxy
|
||||
is different. To work correctly, systemd needs a main PID, this is the PID of
|
||||
the process that systemd will supervises.
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ However the wrapper suffered from several problems:
|
|||
|
||||
### mworker V1
|
||||
|
||||
HAProxy 1.8 got rid of the wrapper which was replaced by the master worker
|
||||
HAProxy 1.8 got ride of the wrapper which was replaced by the master worker
|
||||
mode. This first version was basically a reintegration of the wrapper features
|
||||
within HAProxy. HAProxy is launched with the -W flag, read the configuration and
|
||||
then fork. In mworker mode, the master is usually launched as a root process,
|
||||
|
|
@ -86,7 +86,7 @@ retrieved automatically.
|
|||
The master is supervising the workers, when a current worker (not a previous one
|
||||
from before the reload) is exiting without being asked for a reload, the master
|
||||
will emit an "exit-on-failure" error and will kill every workers with a SIGTERM
|
||||
and exits with the same error code than the failed worker, this behavior can be
|
||||
and exits with the same error code than the failed master, this behavior can be
|
||||
changed by using the "no exit-on-failure" option in the global section.
|
||||
|
||||
While the master is supervising the workers using the wait() function, the
|
||||
|
|
@ -186,8 +186,8 @@ number that can be found in HAPROXY_PROCESSES. With this change the stats socket
|
|||
in the configuration is less useful and everything can be done from the master
|
||||
CLI.
|
||||
|
||||
With 2.7, the reload mechanism of the master CLI evolved, with previous versions,
|
||||
this mechanism was asynchronous, so once the `reload` command was received, the
|
||||
With 2.7, the reload mecanism of the master CLI evolved, with previous versions,
|
||||
this mecanism was asynchronous, so once the `reload` command was received, the
|
||||
master would reload, the active master CLI connection was closed, and there was
|
||||
no way to return a status as a response to the `reload` command. To achieve a
|
||||
synchronous reload, a dedicated sockpair is used, one side uses a master CLI
|
||||
|
|
@ -208,38 +208,3 @@ starts with -st to achieve a hard stop on the previous worker.
|
|||
Version 3.0 got rid of the libsystemd dependencies for sd_notify() after the
|
||||
events of xz/openssh, the function is now implemented directly in haproxy in
|
||||
src/systemd.c.
|
||||
|
||||
### mworker V3
|
||||
|
||||
This version was implemented with HAProxy 3.1, the goal was to stop parsing and
|
||||
applying the configuration in the master process.
|
||||
|
||||
One of the caveats of the previous implementation was that the parser could take
|
||||
a lot of time, and the master process would be stuck in the parser instead of
|
||||
handling its polling loop, signals etc. Some parts of the configuration parsing
|
||||
could also be less reliable with third-party code (EXTRA_OBJS), it could, for
|
||||
example, allow opening FDs and not closing them before the reload which
|
||||
would crash the master after a few reloads.
|
||||
|
||||
The startup of the master-worker was reorganized this way:
|
||||
|
||||
- the "discovery" mode, which is a lighter configuration parsing step, only
|
||||
applies the configuration which need to be effective for the master process.
|
||||
For example, "master-worker", "mworker-max-reloads" and less than 20 other
|
||||
keywords that are identified by KWF_DISCOVERY in the code. It is really fast
|
||||
as it don't need all the configuration to be applied in the master process.
|
||||
|
||||
- the master will then fork a worker, with a PROC_O_INIT flag. This worker has
|
||||
a temporary sockpair connected to the master CLI. Once the worker is forked,
|
||||
the master initializes its configuration and starts its polling loop.
|
||||
|
||||
- The newly forked worker will try to parse the configuration, which could
|
||||
result in a failure (exit 1), or any bad error code. In case of success, the
|
||||
worker will send a "READY" message to the master CLI then close this FD. At
|
||||
this step everything was initialized and the worker can enter its polling
|
||||
loop.
|
||||
|
||||
- The master then waits for the worker, it could:
|
||||
* receive the READY message over the mCLI, resulting in a successful loading
|
||||
of haproxy
|
||||
* receive a SIGCHLD, meaning the worker exited and couldn't load
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ SHUT RDY ACT
|
|||
1 1 1 => shut pending
|
||||
|
||||
PB: we can land into final shut if one thread disables the FD while another
|
||||
one that was waiting on it reports it as shut. Theoretically it should be
|
||||
one that was waiting on it reports it as shut. Theorically it should be
|
||||
implicitly ready though, since reported. But if no data is reported, it
|
||||
will be reportedly shut only. And no event will be reported then. This
|
||||
might still make sense since it's not active, thus we don't want events.
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
2025/09/16 - SHM stats file storage description and hints
|
||||
|
||||
Shm stats file (used to share thread-groupable statistics over multiple
|
||||
process through the "shm-stats-file" directive) is made of:
|
||||
|
||||
- a main header which describes the file version, the processes making
|
||||
use of it, the common clock source and hints about the number of
|
||||
objects that are currently stored or provisionned in the file.
|
||||
- an indefinite number of "objects" blocks coming right after the
|
||||
main header, all blocks have the same size which is the size of the
|
||||
maximum underlying object that may be stored. The main header tells
|
||||
how many objects are stored in the file.
|
||||
|
||||
File header looks like this (32/64 bits systems):
|
||||
|
||||
0 8 16 32 48 64
|
||||
+-------+---------+----------------+-------------------+-------------------+
|
||||
| VERSION | 2 bytes | global_now_ms (global mono date in ms)|
|
||||
|MAJOR | MINOR | hole | |
|
||||
+----------------------------------+---------------------------------------+
|
||||
| global_now_ns (global mono date in ns) |
|
||||
+--------------------------------------------------------------------------+
|
||||
| now_offset (offset applied to global monotonic date |
|
||||
| on startup) |
|
||||
+--------------------------------------------------------------------------+
|
||||
| Process slot : | 1byte x 64
|
||||
| pid | heartbeat (ticks) |
|
||||
+----------------------------------+---------------------------------------+
|
||||
| objects | objects slots |
|
||||
| (used objects) | (available for use) |
|
||||
+----------------------------------+---------------------------------------+
|
||||
| padding (for future use) | 128 bytes
|
||||
+--------------------------------------------------------------------------+
|
||||
|
||||
Object block looks like this:
|
||||
|
||||
0 8 16 32 48 64
|
||||
+-------+---------+----------------+-------------------+-------------------+
|
||||
| GUID | 128 bytes
|
||||
+ (zero terminated) +
|
||||
| |
|
||||
+-------+---------+--------------------------------------------------------+
|
||||
| tgid | type | padding |
|
||||
+-------+---------+--------------------------------------------------------+
|
||||
| users (bitmask of process slots making use of the obj) |
|
||||
+--------------------------------------------------------------------------+
|
||||
| object data |
|
||||
| (version dependent) |
|
||||
| struct be_counters_shared_tg or |
|
||||
| struct fe_counters_shared_tg |
|
||||
+--------------------------------------------------------------------------+
|
||||
| padding (to anticipate evolutions) | 64 bytes
|
||||
+--------------------------------------------------------------------------+
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
2026-03-12 - thread execution context
|
||||
|
||||
Thread execution context (thread_exec_ctx) is a combination of type and pointer
|
||||
that are set in the current running thread at th_ctx->exec_ctx when entering
|
||||
certain processing (tasks, sample fetch functions, actions, CLI keywords etc).
|
||||
They're refined along execution, so that a task such as process_stream could
|
||||
temporarily switch to a converter while evaluating an expression and switch
|
||||
back to process_stream. They are reported in thread dumps and are mixed with
|
||||
caller locations for memory profiling. As such they are intentionally not too
|
||||
precise in order to avoid an explosion of the number of buckets. At the moment,
|
||||
the level of granularity it provides is sufficient to try to narrow a
|
||||
misbehaving origin down to a list of keywords. The context types can currently
|
||||
be:
|
||||
|
||||
- something registered via an initcall, with the initcall's location
|
||||
- something registered via an ha_caller, with the caller's location
|
||||
- an explicit sample fetch / converter / action / CLI keyword list
|
||||
- an explicit function (mainly used for actions without keywords)
|
||||
- a task / tasklet (no distinction is made), using the ->process pointer
|
||||
- a filter (e.g. compression), via flt_conf, reporting name
|
||||
- a mux (via the mux_ops, reporting the name)
|
||||
- an applet (e.g. cache, stats, CLI)
|
||||
|
||||
A macro EXEC_CTX_MAKE(type, pointer) makes a thread_exec_ctx from such
|
||||
values.
|
||||
|
||||
A macro EXEC_CTX_NO_RET(ctx, statement) calls a void statement under the
|
||||
specified context.
|
||||
|
||||
A macro EXEC_CTX_WITH_RET(ctx, expr) calls an expression under the specified
|
||||
context.
|
||||
|
||||
Most locations were modified to directly use these macros on the fly, by
|
||||
retrieving the context from where it was set on the element being evaluated
|
||||
(e.g. an action rule contains the context inherited by the action keyword
|
||||
that was used to create it).
|
||||
|
||||
In tools.c, chunk_append_thread_ctx() tries to decode the given exec_ctx and
|
||||
appends it into the provided buffer. It's used by ha_thread_dump_one() and
|
||||
cli_io_handler_show_activity() for memory profiling. In this latter case,
|
||||
the detected thread_ctx are reported in the output under brackets prefixed
|
||||
with "[via ...]" to distinguish call paths to the same allocators.
|
||||
|
||||
A good way to test if a context is properly reported is to place a bleeding
|
||||
malloc() call into one of the monitored functions, e.g.:
|
||||
|
||||
DISGUISE(malloc(8));
|
||||
|
||||
and issue "show profiling memory" after stressing the function. Its context
|
||||
must appear on the right with the number of calls.
|
||||
|
|
@ -21,7 +21,7 @@ falls back to CLOCK_REALTIME. The former is more accurate as it really counts
|
|||
the time spent in the process, while the latter might also account for time
|
||||
stuck on paging in etc.
|
||||
|
||||
Then wdt_ping() is called to arm the timer. It's set to trigger every
|
||||
Then wdt_ping() is called to arm the timer. t's set to trigger every
|
||||
<wdt_warn_blocked_traffic_ns> interval. It is also called by wdt_handler()
|
||||
to reprogram a new wakeup after it has ticked.
|
||||
|
||||
|
|
@ -37,18 +37,15 @@ If the thread was not marked as stuck, it's verified that no progress was made
|
|||
for at least one second, in which case the TH_FL_STUCK flag is set. The lack of
|
||||
progress is measured by the distance between the thread's current cpu_time and
|
||||
its prev_cpu_time. If the lack of progress is at least as large as the warning
|
||||
threshold, then the signal is bounced to the faulty thread if it's not the
|
||||
current one. Since this bounce is based on the time spent without update, it
|
||||
already doesn't happen often.
|
||||
threshold and no context switch happened since last call, ha_stuck_warning() is
|
||||
called to emit a warning about that thread. In any case the context switch
|
||||
counter for that thread is updated.
|
||||
|
||||
Once on the faulty thread, two checks are performed:
|
||||
1) if the thread was already marked as stuck, then the thread is considered
|
||||
as definitely stuck, and ha_panic() is called. It will not return.
|
||||
|
||||
2) a check is made to verify if the scheduler is still ticking, by reading
|
||||
and setting a variable that only the scheduler can clear when leaving a
|
||||
task. If the scheduler didn't make any progress, ha_stuck_warning() is
|
||||
called to emit a warning about that thread.
|
||||
If the thread was already marked as stuck, then the thread is considered as
|
||||
definitely stuck. Then ha_panic() is directly called if the thread is the
|
||||
current one, otherwise ha_kill() is used to resend the signal directly to the
|
||||
target thread, which will in turn go through this handler and handle the panic
|
||||
itself.
|
||||
|
||||
Most of the time there's no panic of course, and a wdt_ping() is performed
|
||||
before leaving the handler to reprogram a check for that thread.
|
||||
|
|
@ -64,12 +61,12 @@ set TAINTED_WARN_BLOCKED_TRAFFIC.
|
|||
|
||||
ha_panic() uses the current thread's trash buffer to produce the messages, as
|
||||
we don't care about its contents since that thread will never return. However
|
||||
ha_stuck_warning() instead uses a local 8kB buffer in the thread's stack.
|
||||
ha_stuck_warning() instead uses a local 4kB buffer in the thread's stack.
|
||||
ha_panic() will call ha_thread_dump_fill() for each thread, to complete the
|
||||
buffer being filled with each thread's dump messages. ha_stuck_warning() only
|
||||
calls ha_thread_dump_one(), which works on the current thread. In both cases
|
||||
the message is then directly sent to fd #2 (stderr) and ha_thread_dump_done()
|
||||
is called to release the dumped thread.
|
||||
calls the function for the current thread. In both cases the message is then
|
||||
directly sent to fd #2 (stderr) and ha_thread_dump_one() is called to release
|
||||
the dumped thread.
|
||||
|
||||
Both print a few extra messages, but ha_panic() just ends by looping on abort()
|
||||
until the process dies.
|
||||
|
|
@ -113,19 +110,13 @@ ha_dump_backtrace() before returning.
|
|||
ha_dump_backtrace() produces a backtrace into a local buffer (100 entries max),
|
||||
then dumps the code bytes nearby the crashing instrution, dumps pointers and
|
||||
tries to resolve function names, and sends all of that into the target buffer.
|
||||
On some architectures (x86_64, arm64), it will also try to detect and decode
|
||||
call instructions and resolve them to called functions.
|
||||
|
||||
3. Improvements
|
||||
---------------
|
||||
|
||||
The symbols resolution is extremely expensive, particularly for the warnings
|
||||
which should be fast. But we need it, it's just unfortunate that it strikes at
|
||||
the wrong moment. At least ha_dump_backtrace() does disable signals while it's
|
||||
resolving, in order to avoid unwanted re-entrance. In addition, the called
|
||||
function resolve_sym_name() uses some locking and refrains from calling the
|
||||
dladdr family of functions in a re-entrant way (in the worst case only well
|
||||
known symbols will be resolved)..
|
||||
the wrong moment.
|
||||
|
||||
In an ideal case, ha_dump_backtrace() would dump the pointers to a local array,
|
||||
which would then later be resolved asynchronously in a tasklet. This can work
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-----------------------
|
||||
HAProxy Starter Guide
|
||||
-----------------------
|
||||
version 3.4
|
||||
version 3.2
|
||||
|
||||
|
||||
This document is an introduction to HAProxy for all those who don't know it, as
|
||||
|
|
@ -1693,7 +1693,7 @@ A small team of trusted developers will receive it and will be able to propose
|
|||
a fix. We usually don't use embargoes and once a fix is available it gets
|
||||
merged. In some rare circumstances it can happen that a release is coordinated
|
||||
with software vendors. Please note that this process usually messes up with
|
||||
everyone's work, and that rushed up releases can sometimes introduce new bugs,
|
||||
eveyone's work, and that rushed up releases can sometimes introduce new bugs,
|
||||
so it's best avoided unless strictly necessary; as such, there is often little
|
||||
consideration for reports that needlessly cause such extra burden, and the best
|
||||
way to see your work credited usually is to provide a working fix, which will
|
||||
|
|
|
|||
|
|
@ -893,9 +893,7 @@ Core class
|
|||
|
||||
**context**: init, task, action
|
||||
|
||||
This function returns a new object of a *httpclient* class. An *httpclient*
|
||||
object must be used to process one and only one request. It must never be
|
||||
reused to process several requests.
|
||||
This function returns a new object of a *httpclient* class.
|
||||
|
||||
:returns: A :ref:`httpclient_class` object.
|
||||
|
||||
|
|
@ -935,7 +933,7 @@ Core class
|
|||
Give back the hand at the HAProxy scheduler. Unlike :js:func:`core.yield`
|
||||
the task will not be woken up automatically to resume as fast as possible.
|
||||
Instead, it will wait for an event to wake the task. If milliseconds argument
|
||||
is provided then the Lua execution will be automatically resumed passed this
|
||||
is provided then the Lua excecution will be automatically resumed passed this
|
||||
delay even if no event caused the task to wake itself up.
|
||||
|
||||
:param integer milliseconds: automatic wakeup passed this delay. (optional)
|
||||
|
|
@ -945,7 +943,7 @@ Core class
|
|||
**context**: task, action
|
||||
|
||||
Give back the hand at the HAProxy scheduler. It is used when the LUA
|
||||
processing consumes a lot of processing time. Lua execution will be resumed
|
||||
processing consumes a lot of processing time. Lua excecution will be resumed
|
||||
automatically (automatic reschedule).
|
||||
|
||||
.. js:function:: core.parse_addr(address)
|
||||
|
|
@ -1089,13 +1087,18 @@ Core class
|
|||
perform the heavy job in a dedicated task and allow remaining events to be
|
||||
processed more quickly.
|
||||
|
||||
.. js:function:: core.use_native_mailers_config()
|
||||
.. js:function:: core.disable_legacy_mailers()
|
||||
|
||||
**context**: body
|
||||
**LEGACY**
|
||||
|
||||
Inform haproxy that the script will make use of the native "mailers"
|
||||
config section (although legacy). In other words, inform haproxy that
|
||||
:js:func:`Proxy.get_mailers()` will be used later in the program.
|
||||
**context**: body, init
|
||||
|
||||
Disable the sending of email alerts through the legacy email sending
|
||||
function when mailers are used in the configuration.
|
||||
|
||||
Use this when sending email alerts directly from lua.
|
||||
|
||||
:see: :js:func:`Proxy.get_mailers()`
|
||||
|
||||
.. _proxy_class:
|
||||
|
||||
|
|
@ -1224,14 +1227,8 @@ Proxy class
|
|||
|
||||
**LEGACY**
|
||||
|
||||
Returns a table containing legacy mailers config (from haproxy configuration
|
||||
file) for the current proxy or nil if mailers are not available for the proxy.
|
||||
|
||||
.. warning::
|
||||
When relying on :js:func:`Proxy.get_mailers()` to retrieve mailers
|
||||
configuration, :js:func:`core.use_native_mailers_config()` must be called
|
||||
first from body or init context to inform haproxy that Lua makes use of the
|
||||
legacy mailers config.
|
||||
Returns a table containing mailers config for the current proxy or nil
|
||||
if mailers are not available for the proxy.
|
||||
|
||||
:param class_proxy px: A :ref:`proxy_class` which indicates the manipulated
|
||||
proxy.
|
||||
|
|
@ -1248,6 +1245,10 @@ ProxyMailers class
|
|||
|
||||
This class provides mailers config for a given proxy.
|
||||
|
||||
If sending emails directly from lua, please consider
|
||||
:js:func:`core.disable_legacy_mailers()` to disable the email sending from
|
||||
haproxy. (Or email alerts will be sent twice...)
|
||||
|
||||
.. js:attribute:: ProxyMailers.track_server_health
|
||||
|
||||
Boolean set to true if the option "log-health-checks" is configured on
|
||||
|
|
@ -2580,9 +2581,7 @@ HTTPClient class
|
|||
.. js:class:: HTTPClient
|
||||
|
||||
The httpclient class allows issue of outbound HTTP requests through a simple
|
||||
API without the knowledge of HAProxy internals. Any instance must be used to
|
||||
process one and only one request. It must never be reused to process several
|
||||
requests.
|
||||
API without the knowledge of HAProxy internals.
|
||||
|
||||
.. js:function:: HTTPClient.get(httpclient, request)
|
||||
.. js:function:: HTTPClient.head(httpclient, request)
|
||||
|
|
@ -3917,25 +3916,21 @@ AppletTCP class
|
|||
*size* is missing, the function tries to read all the content of the stream
|
||||
until the end. An optional timeout may be specified in milliseconds. In this
|
||||
case the function will return no longer than this delay, with the amount of
|
||||
available data, or nil if there is no data. An empty string is returned if the
|
||||
connection is closed.
|
||||
available data (possibly none).
|
||||
|
||||
:param class_AppletTCP applet: An :ref:`applettcp_class`
|
||||
:param integer size: the required read size.
|
||||
:returns: return nil if the timeout has expired and no data was available but
|
||||
can still be received. Otherwise, a string is returned, possibly an empty
|
||||
string if the connection is closed.
|
||||
:returns: always return a string, the string can be empty if the connection is
|
||||
closed.
|
||||
|
||||
.. js:function:: AppletTCP.try_receive(applet)
|
||||
|
||||
Reads available data from the TCP stream and returns immediately. Returns a
|
||||
string containing read bytes or nil if no bytes are available at that time. An
|
||||
empty string is returned if the connection is closed.
|
||||
string containing read bytes that may possibly be empty if no bytes are
|
||||
available at that time.
|
||||
|
||||
:param class_AppletTCP applet: An :ref:`applettcp_class`
|
||||
:returns: return nil if no data was available but can still be
|
||||
received. Otherwise, a string is returned, possibly an empty string if the
|
||||
connection is closed.
|
||||
:returns: always return a string, the string can be empty.
|
||||
|
||||
.. js:function:: AppletTCP.send(appletmsg)
|
||||
|
||||
|
|
@ -4612,27 +4607,6 @@ HTTPMessage class
|
|||
data by default.
|
||||
:returns: an integer containing the amount of bytes copied or -1.
|
||||
|
||||
.. js:function:: HTTPMessage.set_body_len(http_msg, length)
|
||||
|
||||
This function changes the expected payload length of the HTTP message
|
||||
**http_msg**. **length** can be an integer value. In that case, a
|
||||
"Content-Length" header is added with the given value. It is also possible to
|
||||
pass the **"chunked"** string instead of an integer value to force the HTTP
|
||||
message to be chunk-encoded. In that case, a "Transfer-Encoding" header is
|
||||
added with the "chunked" value. In both cases, all existing "Content-Length"
|
||||
and "Transfer-Encoding" headers are removed.
|
||||
|
||||
This function should be used in the filter context to be able to alter the
|
||||
payload of the HTTP message. The internal state of the HTTP message is updated
|
||||
accordingly. :js:func:`HTTPMessage.add_header()` or
|
||||
:js:func:`HTTPMessage.set_header()` functions must be used in that case.
|
||||
|
||||
:param class_httpmessage http_msg: The manipulated HTTP message.
|
||||
:param type length: The new payload length to set. It can be an integer or
|
||||
the string "chunked".
|
||||
:returns: true if the payload length was successfully updated, false
|
||||
otherwise.
|
||||
|
||||
.. js:function:: HTTPMessage.set_eom(http_msg)
|
||||
|
||||
This function set the end of message for the HTTP message **http_msg**.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
------------------------
|
||||
HAProxy Management Guide
|
||||
------------------------
|
||||
version 3.4
|
||||
version 3.2
|
||||
|
||||
|
||||
This document describes how to start, stop, manage, and troubleshoot HAProxy,
|
||||
|
|
@ -200,12 +200,6 @@ list of options is :
|
|||
-c : only performs a check of the configuration files and exits before trying
|
||||
to bind. The exit status is zero if everything is OK, or non-zero if an
|
||||
error is encountered. Presence of warnings will be reported if any.
|
||||
By default this option does not report a success message. Combined with
|
||||
"-V" this will print the message "Configuration file is valid" upon
|
||||
success.
|
||||
|
||||
Scripts must use the exit status to determine the success of the
|
||||
command.
|
||||
|
||||
-cc : evaluates a condition as used within a conditional block of the
|
||||
configuration. The exit status is zero if the condition is true, 1 if the
|
||||
|
|
@ -390,10 +384,6 @@ list of options is :
|
|||
using strace to see the forwarded data (which do not appear when using
|
||||
splice()).
|
||||
|
||||
-dT : disable the use of ktls. It is equivalent to the "global" section's
|
||||
keyword "noktls". It is mostly useful when suspecting a bug related to
|
||||
ktls.
|
||||
|
||||
-dV : disable SSL verify on the server side. It is equivalent to having
|
||||
"ssl-server-verify none" in the "global" section. This is useful when
|
||||
trying to reproduce production issues out of the production
|
||||
|
|
@ -900,7 +890,9 @@ If a memory allocation fails due to the memory limit being reached or because
|
|||
the system doesn't have any enough memory, then haproxy will first start to
|
||||
free all available objects from all pools before attempting to allocate memory
|
||||
again. This mechanism of releasing unused memory can be triggered by sending
|
||||
the signal SIGQUIT to the haproxy process.
|
||||
the signal SIGQUIT to the haproxy process. When doing so, the pools state prior
|
||||
to the flush will also be reported to stderr when the process runs in
|
||||
foreground.
|
||||
|
||||
During a reload operation, the process switched to the graceful stop state also
|
||||
automatically performs some flushes after releasing any connection so that all
|
||||
|
|
@ -1335,26 +1327,6 @@ Here is the list of static fields using the proxy statistics domain:
|
|||
97. used_conn_cur [...S]: current number of connections in use
|
||||
98. need_conn_est [...S]: estimated needed number of connections
|
||||
99. uweight [..BS]: total user weight (backend), server user weight (server)
|
||||
100. agg_server_status [..B.]: backend aggregated gauge of server's status
|
||||
101. agg_server_status_check [..B.]: (deprecated)
|
||||
102. agg_check_status [..B.]: backend aggregated gauge of server's state check
|
||||
status
|
||||
103. srid [...S]: server id revision
|
||||
104. sess_other [.F..]: total number of sessions other than HTTP since process
|
||||
started
|
||||
105. h1_sess [.F..]: total number of HTTP/1 sessions since process started
|
||||
106. h2_sess [.F..]: total number of HTTP/2 sessions since process started
|
||||
107. h3_sess [.F..]: total number of HTTP/3 sessions since process started
|
||||
108. req_other [.F..]: total number of sessions other than HTTP processed by
|
||||
this object since the worker process started
|
||||
109. h1req [.F..]: total number of HTTP/1 sessions processed by this object
|
||||
since the worker process started
|
||||
110. h2req [.F..]: total number of hTTP/2 sessions processed by this object
|
||||
since the worker process started
|
||||
111. h3req [.F..]: total number of HTTP/3 sessions processed by this object
|
||||
since the worker process started
|
||||
112. proto [L...]: protocol
|
||||
113. priv_idle_cur [...S]: current number of private idle connections
|
||||
|
||||
For all other statistics domains, the presence or the order of the fields are
|
||||
not guaranteed. In this case, the header line should always be used to parse
|
||||
|
|
@ -1374,10 +1346,9 @@ The first column designates the object or metric being dumped. Its format is
|
|||
specific to the command producing this output and will not be described in this
|
||||
section. Usually it will consist in a series of identifiers and field names.
|
||||
|
||||
The second column contains 4 characters respectively indicating the origin, the
|
||||
nature, the scope and the persistence state of the value being reported. The
|
||||
first character (the origin) indicates where the value was extracted from.
|
||||
Possible characters are :
|
||||
The second column contains 3 characters respectively indicating the origin, the
|
||||
nature and the scope of the value being reported. The first character (the
|
||||
origin) indicates where the value was extracted from. Possible characters are :
|
||||
|
||||
M The value is a metric. It is valid at one instant any may change depending
|
||||
on its nature .
|
||||
|
|
@ -1493,16 +1464,7 @@ characters are currently supported :
|
|||
current date or resource usage. At the moment this scope is not used by
|
||||
any metric.
|
||||
|
||||
The fourth character (persistence state) indicates that the value (the metric)
|
||||
is volatile or persistent across reloads. The following characters are expected :
|
||||
|
||||
V The metric is volatile because it is local to the current process so
|
||||
the value will be lost when reloading.
|
||||
|
||||
P The metric is persistent because it may be shared with other co-processes
|
||||
so that the value is preserved across reloads.
|
||||
|
||||
Consumers of these information will generally have enough of these 4 characters
|
||||
Consumers of these information will generally have enough of these 3 characters
|
||||
to determine how to accurately report aggregated information across multiple
|
||||
processes.
|
||||
|
||||
|
|
@ -1691,8 +1653,8 @@ abort ssl crl-file <crlfile>
|
|||
|
||||
acme renew <certificate>
|
||||
Starts an ACME certificate generation task with the given certificate name.
|
||||
The certificate must be linked to an acme section, see section 12.8 "ACME"
|
||||
of the configuration manual. See also "acme status".
|
||||
The certificate must be linked to an acme section, see section 3.13. of the
|
||||
configuration manual. See also "acme status".
|
||||
|
||||
acme status
|
||||
Show the status of every certificates that were configured with ACME.
|
||||
|
|
@ -1700,10 +1662,10 @@ acme status
|
|||
This command outputs, separated by a tab:
|
||||
- The name of the certificate configured in haproxy
|
||||
- The acme section used in the configuration
|
||||
- The state of the acme task, either "Running", "Scheduled" or "Stopped"
|
||||
- The state of the acme task, either "Running" or "Scheduled"
|
||||
- The UTC expiration date of the certificate in ISO8601 format
|
||||
- The relative expiration time (0d if expired)
|
||||
- The UTC scheduled date of the certificate in ISO8601 format
|
||||
- The UTC expiration date of the certificate in ISO8601 format
|
||||
- The relative schedule time (0d if Running)
|
||||
|
||||
Example:
|
||||
|
|
@ -1725,27 +1687,6 @@ add acl [@<ver>] <acl> <pattern>
|
|||
This command cannot be used if the reference <acl> is a name also used with
|
||||
a map. In this case, the "add map" command must be used instead.
|
||||
|
||||
add backend <name> from <defproxy> [mode <mode>] [guid <guid>] [ EXPERIMENTAL ]
|
||||
Instantiate a new backend proxy with the name <name>.
|
||||
|
||||
Only TCP or HTTP proxies can be created. All of the settings are inherited
|
||||
from <defproxy> default proxy instance. By default, it is mandatory to
|
||||
specify the backend mode via the argument of the same name, unless <defproxy>
|
||||
already defines it explicitly. It is also possible to use an optional GUID
|
||||
argument if wanted.
|
||||
|
||||
Servers can be added via the command "add server". The backend is initialized
|
||||
in the unpublished state. Once considered ready for traffic, use "publish
|
||||
backend" to expose the newly created instance.
|
||||
|
||||
All named default proxies can be used, given that they validate the same
|
||||
inheritance rules applied during configuration parsing. There is some
|
||||
exceptions though, for example when the mode is neither TCP nor HTTP.
|
||||
|
||||
This command is restricted and can only be issued on sockets configured for
|
||||
level "admin". Moreover, this feature is still considered in development so it
|
||||
also requires experimental mode (see "experimental-mode on").
|
||||
|
||||
add map [@<ver>] <map> <key> <value>
|
||||
add map [@<ver>] <map> <payload>
|
||||
Add an entry into the map <map> to associate the value <value> to the key
|
||||
|
|
@ -1783,9 +1724,8 @@ add server <backend>/<server> [args]*
|
|||
The <server> name must not be already used in the backend. A special
|
||||
restriction is put on the backend which must used a dynamic load-balancing
|
||||
algorithm. A subset of keywords from the server config file statement can be
|
||||
used to configure the server behavior (see "add server help" to list them).
|
||||
Also note that no settings will be reused from an hypothetical
|
||||
'default-server' statement in the same backend.
|
||||
used to configure the server behavior. Also note that no settings will be
|
||||
reused from an hypothetical 'default-server' statement in the same backend.
|
||||
|
||||
Currently a dynamic server is statically initialized with the "none"
|
||||
init-addr method. This means that no resolution will be undertaken if a FQDN
|
||||
|
|
@ -1815,10 +1755,78 @@ add server <backend>/<server> [args]*
|
|||
servers. Please refer to the "u-limit" global keyword documentation in this
|
||||
case.
|
||||
|
||||
add server help
|
||||
List the keywords supported for dynamic servers by the current haproxy
|
||||
version. Keyword syntax is similar to the server line from the configuration
|
||||
file, please refer to their individual documentation for details.
|
||||
Here is the list of the currently supported keywords :
|
||||
|
||||
- agent-addr
|
||||
- agent-check
|
||||
- agent-inter
|
||||
- agent-port
|
||||
- agent-send
|
||||
- allow-0rtt
|
||||
- alpn
|
||||
- addr
|
||||
- backup
|
||||
- ca-file
|
||||
- check
|
||||
- check-alpn
|
||||
- check-proto
|
||||
- check-send-proxy
|
||||
- check-sni
|
||||
- check-ssl
|
||||
- check-via-socks4
|
||||
- ciphers
|
||||
- ciphersuites
|
||||
- cookie
|
||||
- crl-file
|
||||
- crt
|
||||
- disabled
|
||||
- downinter
|
||||
- error-limit
|
||||
- fall
|
||||
- fastinter
|
||||
- force-sslv3/tlsv10/tlsv11/tlsv12/tlsv13
|
||||
- id
|
||||
- init-state
|
||||
- inter
|
||||
- maxconn
|
||||
- maxqueue
|
||||
- minconn
|
||||
- no-ssl-reuse
|
||||
- no-sslv3/tlsv10/tlsv11/tlsv12/tlsv13
|
||||
- no-tls-tickets
|
||||
- npn
|
||||
- observe
|
||||
- on-error
|
||||
- on-marked-down
|
||||
- on-marked-up
|
||||
- pool-low-conn
|
||||
- pool-max-conn
|
||||
- pool-purge-delay
|
||||
- port
|
||||
- proto
|
||||
- proxy-v2-options
|
||||
- rise
|
||||
- send-proxy
|
||||
- send-proxy-v2
|
||||
- send-proxy-v2-ssl
|
||||
- send-proxy-v2-ssl-cn
|
||||
- slowstart
|
||||
- sni
|
||||
- source
|
||||
- ssl
|
||||
- ssl-max-ver
|
||||
- ssl-min-ver
|
||||
- tfo
|
||||
- tls-tickets
|
||||
- track
|
||||
- usesrc
|
||||
- verify
|
||||
- verifyhost
|
||||
- weight
|
||||
- ws
|
||||
|
||||
Their syntax is similar to the server line from the configuration file,
|
||||
please refer to their individual documentation for details.
|
||||
|
||||
add ssl ca-file <cafile> <payload>
|
||||
Add a new certificate to a ca-file. This command is useful when you reached
|
||||
|
|
@ -1855,35 +1863,6 @@ add ssl crt-list <crtlist> <payload>
|
|||
$ echo -e 'add ssl crt-list certlist1 <<\nfoobar.pem [allow-0rtt] foo.bar.com
|
||||
!test1.com\n' | socat /tmp/sock1 -
|
||||
|
||||
add ssl ech <bind> <payload>
|
||||
Add an ECH key to a <bind> line. The payload must be in the PEM for ECH format.
|
||||
(https://datatracker.ietf.org/doc/html/draft-farrell-tls-pemesni)
|
||||
|
||||
The bind line format is <frontend>/@<filename>:<linenum> (Example:
|
||||
frontend1/@haproxy.conf:19) or <frontend>/<name> if the bind line was named
|
||||
with the "name" keyword.
|
||||
|
||||
Necessitates an OpenSSL version that supports ECH, and HAProxy must be
|
||||
compiled with USE_ECH=1. This command is only supported on a CLI connection
|
||||
running in experimental mode (see "experimental-mode on").
|
||||
|
||||
See also "show ssl ech" and "ech" in the Section 5.1 of the configuration
|
||||
manual.
|
||||
|
||||
Example:
|
||||
|
||||
$ openssl ech -public_name foobar.com -out foobar3.com.ech
|
||||
$ echo -e "experimental-mode on; add ssl ech frontend1/@haproxy.conf:19 <<%EOF%\n$(cat foobar3.com.ech)\n%EOF%\n" | \
|
||||
socat /tmp/haproxy.sock -
|
||||
added a new ECH config to frontend1
|
||||
|
||||
add ssl jwt <filename>
|
||||
Add an already loaded certificate to the list of certificates that can be
|
||||
used for JWT validation (see "jwt_verify_cert" converter). This command does
|
||||
not work on ongoing transactions.
|
||||
See also "del ssl jwt" and "show ssl jwt" commands.
|
||||
See "jwt" certificate option for more information.
|
||||
|
||||
clear counters
|
||||
Clear the max values of the statistics counters in each proxy (frontend &
|
||||
backend) and in each server. The accumulated counters are not affected. The
|
||||
|
|
@ -2121,30 +2100,6 @@ del acl <acl> [<key>|#<ref>]
|
|||
listing the content of the acl. Note that if the reference <acl> is a name and
|
||||
is shared with a map, the entry will be also deleted in the map.
|
||||
|
||||
del backend <name>
|
||||
Removes the backend proxy with the name <name>.
|
||||
|
||||
This operation is only possible for TCP or HTTP proxies. To succeed, the
|
||||
backend instance must have been first unpublished. Also, all of its servers
|
||||
must first be removed (via "del server" CLI). Finally, no stream must still
|
||||
be attached to the backend instance.
|
||||
|
||||
There is additional restrictions which prevent backend removal. First, a
|
||||
backend cannot be removed if it is explicitly referenced by config elements,
|
||||
for example via a use_backend rule or in sample expressions. Some proxies
|
||||
options are also incompatible with runtime deletion. Currently, this is the
|
||||
case when deprecated dispatch or option transparent are used. Also, a backend
|
||||
cannot be removed if there is a stick-table declared in it. Finally, it is
|
||||
impossible for now to remove a backend if QUIC servers were present in it.
|
||||
|
||||
It can be useful to use "wait be-removable" prior to this command to check
|
||||
for the aforementioned requisites. This also provides a method to wait for
|
||||
the final closure of the streams attached to the target backend.
|
||||
|
||||
This command is restricted and can only be issued on sockets configured for
|
||||
level "admin". Moreover, this feature is still considered in development so it
|
||||
also requires experimental mode (see "experimental-mode on").
|
||||
|
||||
del map <map> [<key>|#<ref>]
|
||||
Delete all the map entries from the map <map> corresponding to the key <key>.
|
||||
<map> is the #<id> or the <name> returned by "show map". If the <ref> is used,
|
||||
|
|
@ -2159,11 +2114,10 @@ del ssl ca-file <cafile>
|
|||
the "ca-file" or "ca-verify-file" directives in the configuration.
|
||||
|
||||
del ssl cert <certfile>
|
||||
Delete a certificate store from HAProxy. The certificate must be unused
|
||||
(included for JWT validation) and removed from any crt-list or directory.
|
||||
"show ssl cert" displays the status of the certificate. The deletion doesn't
|
||||
work with a certificate referenced directly with the "crt" directive in the
|
||||
configuration.
|
||||
Delete a certificate store from HAProxy. The certificate must be unused and
|
||||
removed from any crt-list or directory. "show ssl cert" displays the status
|
||||
of the certificate. The deletion doesn't work with a certificate referenced
|
||||
directly with the "crt" directive in the configuration.
|
||||
|
||||
del ssl crl-file <crlfile>
|
||||
Delete a CRL file tree entry from HAProxy. The CRL file must be unused and
|
||||
|
|
@ -2177,46 +2131,12 @@ del ssl crt-list <filename> <certfile[:line]>
|
|||
you will need to provide which line you want to delete. To display the line
|
||||
numbers, use "show ssl crt-list -n <crtlist>".
|
||||
|
||||
det ssl ech <bind>
|
||||
Delete the ECH keys of a bind line.
|
||||
|
||||
The bind line format is <frontend>/@<filename>:<linenum> (Example:
|
||||
frontend1/@haproxy.conf:19) or <frontend>/<name> if the bind line was named
|
||||
with the "name" keyword.
|
||||
|
||||
Necessitates an OpenSSL version that supports ECH, and HAProxy must be
|
||||
compiled with USE_ECH=1. This command is only supported on a CLI connection
|
||||
running in experimental mode (see "experimental-mode on").
|
||||
|
||||
See also "show ssl ech", "add ssl ech" and "ech" in the Section 5.1 of the
|
||||
configuration manual.
|
||||
|
||||
Example:
|
||||
|
||||
$ echo "experimental-mode on; del ssl ech frontend1/@haproxy.conf:19" | socat /tmp/haproxy.sock -
|
||||
deleted all ECH configs from frontend1/@haproxy.conf:19
|
||||
|
||||
del ssl jwt <filename>
|
||||
Remove an already loaded certificate to the list of certificates that can be
|
||||
used for JWT validation (see "jwt_verify_cert" converter). This command does
|
||||
not work on ongoing transactions.
|
||||
See also "add ssl jwt" and "show ssl jwt" commands.
|
||||
See "jwt" certificate option for more information.
|
||||
|
||||
del server <backend>/<server>
|
||||
Delete a removable server attached to the backend <backend>. A removable
|
||||
server is the server which satisfies all of these conditions :
|
||||
- not referenced by other configuration elements
|
||||
- must already be in maintenance (see "disable server")
|
||||
- must not have any active or idle connections
|
||||
|
||||
If any of these conditions is not met, the command will fail.
|
||||
|
||||
Active connections are those with at least one ongoing request. It is
|
||||
possible to speed up their termination using "shutdown sessions server". It
|
||||
is highly recommended to use "wait srv-removable" before "del server" to
|
||||
ensure that all active or idle connections are closed and that the command
|
||||
succeeds.
|
||||
Remove a server attached to the backend <backend>. All servers are eligible,
|
||||
except servers which are referenced by other configuration elements. The
|
||||
server must be put in maintenance mode prior to its deletion. The operation
|
||||
is cancelled if the server still has active or idle connection or its
|
||||
connection queue is not empty.
|
||||
|
||||
disable agent <backend>/<server>
|
||||
Mark the auxiliary agent check as temporarily stopped.
|
||||
|
|
@ -2446,7 +2366,7 @@ help [<command>]
|
|||
the requested one. The same help screen is also displayed for unknown
|
||||
commands.
|
||||
|
||||
httpclient [--htx] <method> <URI>
|
||||
httpclient <method> <URI>
|
||||
Launch an HTTP client request and print the response on the CLI. Only
|
||||
supported on a CLI connection running in expert mode (see "expert-mode on").
|
||||
It's only meant for debugging. The httpclient is able to resolve a server
|
||||
|
|
@ -2455,9 +2375,6 @@ httpclient [--htx] <method> <URI>
|
|||
able to resolve an host from /etc/hosts if you don't use a local dns daemon
|
||||
which can resolve those.
|
||||
|
||||
The --htx option allow to use the haproxy internal htx representation using
|
||||
the htx_dump() function, mainly used for debugging.
|
||||
|
||||
new ssl ca-file <cafile>
|
||||
Create a new empty CA file tree entry to be filled with a set of CA
|
||||
certificates and added to a crt-list. This command should be used in
|
||||
|
|
@ -2508,7 +2425,7 @@ prompt [help | n | i | p | timed]*
|
|||
|
||||
Without any option, this will cycle through prompt mode then non-interactive
|
||||
mode. In non-interactive mode, the connection is closed after the last
|
||||
command of the current line completes. In interactive mode, the connection is
|
||||
command of the current line compltes. In interactive mode, the connection is
|
||||
not closed after a command completes, so that a new one can be entered. In
|
||||
prompt mode, the interactive mode is still in use, and a prompt will appear
|
||||
at the beginning of the line, indicating to the user that the interpreter is
|
||||
|
|
@ -2519,11 +2436,6 @@ prompt [help | n | i | p | timed]*
|
|||
advanced scripts, and the non-interactive mode (default) to basic scripts.
|
||||
Note that the non-interactive mode is not available for the master socket.
|
||||
|
||||
publish backend <backend>
|
||||
Activates content switching to a backend instance. This is the reverse
|
||||
operation of "unpublish backend" command. This command is restricted and can
|
||||
only be issued on sockets configured for levels "operator" or "admin".
|
||||
|
||||
quit
|
||||
Close the connection when in interactive mode.
|
||||
|
||||
|
|
@ -2579,8 +2491,7 @@ set maxconn global <maxconn>
|
|||
delayed until the threshold is reached. A value of zero restores the initial
|
||||
setting.
|
||||
|
||||
set profiling memory { on | off }
|
||||
set profiling tasks { auto | on | off | lock | no-lock | memory | no-memory }
|
||||
set profiling { tasks | memory } { auto | on | off }
|
||||
Enables or disables CPU or memory profiling for the indicated subsystem. This
|
||||
is equivalent to setting or clearing the "profiling" settings in the "global"
|
||||
section of the configuration file. Please also see "show profiling". Note
|
||||
|
|
@ -2590,13 +2501,6 @@ set profiling tasks { auto | on | off | lock | no-lock | memory | no-memory }
|
|||
on the linux-glibc target), and requires USE_MEMORY_PROFILING to be set at
|
||||
compile time.
|
||||
|
||||
. For tasks profiling, it is possible to enable or disable the collection of
|
||||
per-task lock and memory timings at runtime, but the change is only taken
|
||||
into account next time the profiler switches from off/auto to on (either
|
||||
automatically or manually). Thus when using "no-lock" to disable per-task
|
||||
lock profiling and save CPU cycles, it is recommended to flip the task
|
||||
profiling off then on to commit the change.
|
||||
|
||||
set rate-limit connections global <value>
|
||||
Change the process-wide connection rate limit, which is set by the global
|
||||
'maxconnrate' setting. A value of zero disables the limitation. This limit
|
||||
|
|
@ -2757,28 +2661,6 @@ set ssl crl-file <crlfile> <payload>
|
|||
socat /var/run/haproxy.stat -
|
||||
echo "commit ssl crl-file crlfile.pem" | socat /var/run/haproxy.stat -
|
||||
|
||||
set ssl ech <bind> <payload>
|
||||
Replace the ECH keys of a bind line with this one. The payload must be in the
|
||||
PEM for ECH format.
|
||||
(https://datatracker.ietf.org/doc/html/draft-farrell-tls-pemesni)
|
||||
|
||||
The bind line format is <frontend>/@<filename>:<linenum> (Example:
|
||||
frontend1/@haproxy.conf:19) or <frontend>/<name> if the bind line was named
|
||||
with the "name" keyword.
|
||||
|
||||
Necessitates an OpenSSL version that supports ECH, and HAProxy must be
|
||||
compiled with USE_ECH=1. This command is only supported on a CLI connection
|
||||
running in experimental mode (see "experimental-mode on").
|
||||
|
||||
See also "show ssl ech", "add ssl ech" and "ech" in the Section 5.1 of the
|
||||
configuration manual.
|
||||
|
||||
$ openssl ech -public_name foobar.com -out foobar3.com.ech
|
||||
$ echo -e "experimental-mode on;
|
||||
set ssl ech frontend1/@haproxy.conf:19 <<%EOF%\n$(cat foobar3.com.ech)\n%EOF%\n" | \
|
||||
socat /tmp/haproxy.sock -
|
||||
set new ECH configs for frontend1/@haproxy.conf:19
|
||||
|
||||
set ssl ocsp-response <response | payload>
|
||||
This command is used to update an OCSP Response for a certificate (see "crt"
|
||||
on "bind" lines). Same controls are performed as during the initial loading of
|
||||
|
|
@ -2900,13 +2782,6 @@ operator
|
|||
increased. It also drops expert and experimental mode. See also "show cli
|
||||
level".
|
||||
|
||||
unpublish backend <backend>
|
||||
Marks the backend as unqualified for future traffic selection. In effect,
|
||||
use_backend / default_backend rules which reference it are ignored and the
|
||||
next content switching rules are evaluated. Contrary to disabled backends,
|
||||
servers health checks remain active. This command is restricted and can only
|
||||
be issued on sockets configured for levels "operator" or "admin".
|
||||
|
||||
user
|
||||
Decrease the CLI level of the current CLI session to user. It can't be
|
||||
increased. It also drops expert and experimental mode. See also "show cli
|
||||
|
|
@ -3181,19 +3056,18 @@ show info [typed|json] [desc] [float]
|
|||
(...)
|
||||
|
||||
> show info typed
|
||||
0.Name.1:POSV:str:HAProxy
|
||||
1.Version.1:POSV:str:3.1-dev0-7c653d-2466
|
||||
2.Release_date.1:POSV:str:2025/07/01
|
||||
3.Nbthread.1:CGSV:u32:1
|
||||
4.Nbproc.1:CGSV:u32:1
|
||||
5.Process_num.1:KGPV:u32:1
|
||||
6.Pid.1:SGPV:u32:638069
|
||||
7.Uptime.1:MDPV:str:0d 0h00m07s
|
||||
8.Uptime_sec.1:MDPV:u32:7
|
||||
9.Memmax_MB.1:CLPV:u32:0
|
||||
10.PoolAlloc_MB.1:MGPV:u32:0
|
||||
11.PoolUsed_MB.1:MGPV:u32:0
|
||||
12.PoolFailed.1:MCPV:u32:0
|
||||
0.Name.1:POS:str:HAProxy
|
||||
1.Version.1:POS:str:1.7-dev1-de52ea-146
|
||||
2.Release_date.1:POS:str:2016/03/11
|
||||
3.Nbproc.1:CGS:u32:1
|
||||
4.Process_num.1:KGP:u32:1
|
||||
5.Pid.1:SGP:u32:28105
|
||||
6.Uptime.1:MDP:str:0d 0h00m08s
|
||||
7.Uptime_sec.1:MDP:u32:8
|
||||
8.Memmax_MB.1:CLP:u32:0
|
||||
9.PoolAlloc_MB.1:MGP:u32:0
|
||||
10.PoolUsed_MB.1:MGP:u32:0
|
||||
11.PoolFailed.1:MCP:u32:0
|
||||
(...)
|
||||
|
||||
In the typed format, the presence of the process ID at the end of the
|
||||
|
|
@ -3356,7 +3230,7 @@ show pools [byname|bysize|byusage] [detailed] [match <pfx>] [<nb>]
|
|||
- Pool quic_conn_c (152 bytes) : 1337 allocated (203224 bytes), ...
|
||||
Total: 15 pools, 109578176 bytes allocated, 109578176 used ...
|
||||
|
||||
show profiling [{all | status | tasks | memory}] [byaddr|bytime|byctx|aggr|<max_lines>]*
|
||||
show profiling [{all | status | tasks | memory}] [byaddr|bytime|aggr|<max_lines>]*
|
||||
Dumps the current profiling settings, one per line, as well as the command
|
||||
needed to change them. When tasks profiling is enabled, some per-function
|
||||
statistics collected by the scheduler will also be emitted, with a summary
|
||||
|
|
@ -3365,15 +3239,14 @@ show profiling [{all | status | tasks | memory}] [byaddr|bytime|byctx|aggr|<max_
|
|||
allocations/releases and their sizes will be reported. It is possible to
|
||||
limit the dump to only the profiling status, the tasks, or the memory
|
||||
profiling by specifying the respective keywords; by default all profiling
|
||||
information are dumped. It is also possible to limit the number of lines of
|
||||
information are dumped. It is also possible to limit the number of lines
|
||||
of output of each category by specifying a numeric limit. If is possible to
|
||||
request that the output is sorted by address, by total execution time, or by
|
||||
calling context instead of usage, e.g. to ease comparisons between subsequent
|
||||
calls or to check what needs to be optimized, and to aggregate task activity
|
||||
by called function instead of seeing the details. Please note that profiling
|
||||
is essentially aimed at developers since it gives hints about where CPU
|
||||
cycles or memory are wasted in the code. There is nothing useful to monitor
|
||||
there.
|
||||
request that the output is sorted by address or by total execution time
|
||||
instead of usage, e.g. to ease comparisons between subsequent calls or to
|
||||
check what needs to be optimized, and to aggregate task activity by called
|
||||
function instead of seeing the details. Please note that profiling is
|
||||
essentially aimed at developers since it gives hints about where CPU cycles
|
||||
or memory are wasted in the code. There is nothing useful to monitor there.
|
||||
|
||||
show resolvers [<resolvers section id>]
|
||||
Dump statistics for the given resolvers section, or all resolvers sections
|
||||
|
|
@ -3408,10 +3281,9 @@ show quic [<format>] [<filter>]
|
|||
in the format will instead show a more detailed help message.
|
||||
|
||||
The final argument is used to restrict or extend the connection list. By
|
||||
default, active frontend connections only are displayed. Use the extra
|
||||
argument "clo" to list instead closing frontend connections, "be" for backend
|
||||
connections or "all" for every categories. It's also possible to restrict to
|
||||
a single connection by specifying its hexadecimal address.
|
||||
default, connections on closing or draining state are not displayed. Use the
|
||||
extra argument "all" to include them in the output. It's also possible to
|
||||
restrict to a single connection by specifying its hexadecimal address.
|
||||
|
||||
show servers conn [<backend>]
|
||||
Dump the current and idle connections state of the servers belonging to the
|
||||
|
|
@ -3421,32 +3293,7 @@ show servers conn [<backend>]
|
|||
The output consists in a header line showing the fields titles, then one
|
||||
server per line with for each, the backend name and ID, server name and ID,
|
||||
the address, port and a series or values. The number of fields varies
|
||||
depending on thread count. The exact format of the output may vary slightly
|
||||
across versions and depending on the number of threads. One needs to pay
|
||||
attention to the header line to match columns when extracting output values,
|
||||
and to the number of threads as the last columns are per-thread:
|
||||
|
||||
bkname/svname Backend name '/' server name
|
||||
bkid/svid Backend ID '/' server ID
|
||||
addr Server's IP address
|
||||
port Server's port (or zero if none)
|
||||
- Unused field, serves as a visual delimiter
|
||||
purge_delay Interval between connection purges, in milliseconds
|
||||
served Number of connections currently in use
|
||||
used_cur Number of connections currently in use
|
||||
note that this excludes conns attached to a session
|
||||
used_max Highest value of used_cur since the process started
|
||||
need_est Floating estimate of total needed connections
|
||||
idle_sess Number of idle connections flagged as private
|
||||
unsafe_nb Number of idle connections considered as "unsafe"
|
||||
safe_nb Number of idle connections considered as "safe"
|
||||
idle_lim Configured maximum number of idle connections
|
||||
idle_cur Total of the per-thread currently idle connections
|
||||
idle_per_thr[NB] Idle conns per thread for each one of the NB threads
|
||||
|
||||
HAProxy will kill a portion of <idle_cur> every <purge_delay> when the total
|
||||
of <idle_cur> + <used_cur> exceeds the estimate <need_est>. This estimate
|
||||
varies based on connection activity.
|
||||
depending on thread count.
|
||||
|
||||
Given the threaded nature of idle connections, it's important to understand
|
||||
that some values may change once read, and that as such, consistency within a
|
||||
|
|
@ -3679,11 +3526,10 @@ show stat [domain <resolvers|proxy>] [{<iid>|<proxy>} <type> <sid>] \
|
|||
|
||||
The rest of the line starting after the first colon follows the "typed output
|
||||
format" described in the section above. In short, the second column (after the
|
||||
first ':') indicates the origin, nature, scope and persistence state of the
|
||||
variable. The third column indicates the field type, among "s32", "s64",
|
||||
"u32", "u64", "flt" and "str". Then the fourth column is the value itself,
|
||||
which the consumer knows how to parse thanks to column 3 and how to process
|
||||
thanks to column 2.
|
||||
first ':') indicates the origin, nature and scope of the variable. The third
|
||||
column indicates the field type, among "s32", "s64", "u32", "u64", "flt' and
|
||||
"str". Then the fourth column is the value itself, which the consumer knows
|
||||
how to parse thanks to column 3 and how to process thanks to column 2.
|
||||
|
||||
When "desc" is appended to the command, one extra colon followed by a quoted
|
||||
string is appended with a description for the metric. At the time of writing,
|
||||
|
|
@ -3696,32 +3542,37 @@ show stat [domain <resolvers|proxy>] [{<iid>|<proxy>} <type> <sid>] \
|
|||
Here's an example of typed output format :
|
||||
|
||||
$ echo "show stat typed" | socat stdio unix-connect:/tmp/sock1
|
||||
F.2.0.0.pxname.1:KNSV:str:dummy
|
||||
F.2.0.1.svname.1:KNSV:str:FRONTEND
|
||||
F.2.0.4.scur.1:MGPV:u32:0
|
||||
F.2.0.5.smax.1:MMPV:u32:0
|
||||
F.2.0.6.slim.1:CLPV:u32:524269
|
||||
F.2.0.7.stot.1:MCPP:u64:0
|
||||
F.2.0.8.bin.1:MCPP:u64:0
|
||||
F.2.0.9.bout.1:MCPP:u64:0
|
||||
F.2.0.10.dreq.1:MCPP:u64:0
|
||||
F.2.0.11.dresp.1:MCPP:u64:0
|
||||
F.2.0.12.ereq.1:MCPP:u64:0
|
||||
F.2.0.17.status.1:SGPV:str:OPEN
|
||||
F.2.0.26.pid.1:KGPV:u32:1
|
||||
F.2.0.27.iid.1:KGSV:u32:2
|
||||
F.2.0.28.sid.1:KGSV:u32:0
|
||||
F.2.0.32.type.1:CGSV:u32:0
|
||||
F.2.0.33.rate.1:MRPP:u32:0
|
||||
F.2.0.34.rate_lim.1:CLPV:u32:0
|
||||
F.2.0.35.rate_max.1:MMPV:u32:0
|
||||
F.2.0.46.req_rate.1:MRPP:u32:0
|
||||
F.2.0.47.req_rate_max.1:MMPV:u32:0
|
||||
F.2.0.48.req_tot.1:MCPP:u64:0
|
||||
F.2.0.51.comp_in.1:MCPP:u64:0
|
||||
F.2.0.52.comp_out.1:MCPP:u64:0
|
||||
F.2.0.53.comp_byp.1:MCPP:u64:0
|
||||
F.2.0.54.comp_rsp.1:MCPP:u64:0
|
||||
F.2.0.0.pxname.1:MGP:str:private-frontend
|
||||
F.2.0.1.svname.1:MGP:str:FRONTEND
|
||||
F.2.0.8.bin.1:MGP:u64:0
|
||||
F.2.0.9.bout.1:MGP:u64:0
|
||||
F.2.0.40.hrsp_2xx.1:MGP:u64:0
|
||||
L.2.1.0.pxname.1:MGP:str:private-frontend
|
||||
L.2.1.1.svname.1:MGP:str:sock-1
|
||||
L.2.1.17.status.1:MGP:str:OPEN
|
||||
L.2.1.73.addr.1:MGP:str:0.0.0.0:8001
|
||||
S.3.13.60.rtime.1:MCP:u32:0
|
||||
S.3.13.61.ttime.1:MCP:u32:0
|
||||
S.3.13.62.agent_status.1:MGP:str:L4TOUT
|
||||
S.3.13.64.agent_duration.1:MGP:u64:2001
|
||||
S.3.13.65.check_desc.1:MCP:str:Layer4 timeout
|
||||
S.3.13.66.agent_desc.1:MCP:str:Layer4 timeout
|
||||
S.3.13.67.check_rise.1:MCP:u32:2
|
||||
S.3.13.68.check_fall.1:MCP:u32:3
|
||||
S.3.13.69.check_health.1:SGP:u32:0
|
||||
S.3.13.70.agent_rise.1:MaP:u32:1
|
||||
S.3.13.71.agent_fall.1:SGP:u32:1
|
||||
S.3.13.72.agent_health.1:SGP:u32:1
|
||||
S.3.13.73.addr.1:MCP:str:1.255.255.255:8888
|
||||
S.3.13.75.mode.1:MAP:str:http
|
||||
B.3.0.0.pxname.1:MGP:str:private-backend
|
||||
B.3.0.1.svname.1:MGP:str:BACKEND
|
||||
B.3.0.2.qcur.1:MGP:u32:0
|
||||
B.3.0.3.qmax.1:MGP:u32:0
|
||||
B.3.0.4.scur.1:MGP:u32:0
|
||||
B.3.0.5.smax.1:MGP:u32:0
|
||||
B.3.0.6.slim.1:MGP:u32:1000
|
||||
B.3.0.55.lastsess.1:MMP:s32:-1
|
||||
(...)
|
||||
|
||||
In the typed format, the presence of the process ID at the end of the
|
||||
|
|
@ -3732,20 +3583,20 @@ show stat [domain <resolvers|proxy>] [{<iid>|<proxy>} <type> <sid>] \
|
|||
$ ( echo show stat typed | socat /var/run/haproxy.sock1 - ; \
|
||||
echo show stat typed | socat /var/run/haproxy.sock2 - ) | \
|
||||
sort -t . -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5 -k 6,6n
|
||||
B.3.0.0.pxname.1:KNSV:str:private-backend
|
||||
B.3.0.0.pxname.2:KNSV:str:private-backend
|
||||
B.3.0.1.svname.1:KNSV:str:BACKEND
|
||||
B.3.0.1.svname.2:KNSV:str:BACKEND
|
||||
B.3.0.2.qcur.1:MGPV:u32:0
|
||||
B.3.0.2.qcur.2:MGPV:u32:0
|
||||
B.3.0.3.qmax.1:MMPV:u32:0
|
||||
B.3.0.3.qmax.2:MMPV:u32:0
|
||||
B.3.0.4.scur.1:MGPV:u32:0
|
||||
B.3.0.4.scur.2:MGPV:u32:0
|
||||
B.3.0.5.smax.1:MMPV:u32:0
|
||||
B.3.0.5.smax.2:MMPV:u32:0
|
||||
B.3.0.6.slim.1:CLPV:u32:1000
|
||||
B.3.0.6.slim.2:CLPV:u32:1000
|
||||
B.3.0.0.pxname.1:MGP:str:private-backend
|
||||
B.3.0.0.pxname.2:MGP:str:private-backend
|
||||
B.3.0.1.svname.1:MGP:str:BACKEND
|
||||
B.3.0.1.svname.2:MGP:str:BACKEND
|
||||
B.3.0.2.qcur.1:MGP:u32:0
|
||||
B.3.0.2.qcur.2:MGP:u32:0
|
||||
B.3.0.3.qmax.1:MGP:u32:0
|
||||
B.3.0.3.qmax.2:MGP:u32:0
|
||||
B.3.0.4.scur.1:MGP:u32:0
|
||||
B.3.0.4.scur.2:MGP:u32:0
|
||||
B.3.0.5.smax.1:MGP:u32:0
|
||||
B.3.0.5.smax.2:MGP:u32:0
|
||||
B.3.0.6.slim.1:MGP:u32:1000
|
||||
B.3.0.6.slim.2:MGP:u32:1000
|
||||
(...)
|
||||
|
||||
The format of JSON output is described in a schema which may be output
|
||||
|
|
@ -3923,66 +3774,6 @@ show ssl crt-list [-n] [<filename>]
|
|||
ecdsa.pem:3 [verify none allow-0rtt ssl-min-ver TLSv1.0 ssl-max-ver TLSv1.3] localhost !www.test1.com
|
||||
ecdsa.pem:4 [verify none allow-0rtt ssl-min-ver TLSv1.0 ssl-max-ver TLSv1.3]
|
||||
|
||||
show ssl ech [<name>]
|
||||
Display the list of ECH keys loaded in the HAProxy process.
|
||||
|
||||
When <name> is specified, displays the keys for a specific bind line. The
|
||||
bind line format is <frontend>/@<filename>:<linenum> (Example:
|
||||
frontend1/@haproxy.conf:19) or <frontend>/<name> if the bind line was named
|
||||
with the "name" keyword.
|
||||
|
||||
The 'age' entry represents the time, in seconds, since the key was loaded in
|
||||
the bind line. This value is reset when HAProxy is started, reloaded, or
|
||||
restarted.
|
||||
|
||||
Necessitates an OpenSSL version that supports ECH, and HAProxy must be
|
||||
compiled with USE_ECH=1.
|
||||
This command is only supported on a CLI connection running in experimental
|
||||
mode (see "experimental-mode on").
|
||||
|
||||
See also "ech" in the Section 5.1 of the configuration manual.
|
||||
|
||||
Example:
|
||||
|
||||
$ echo "experimental-mode on; show ssl ech" | socat /tmp/haproxy.sock -
|
||||
***
|
||||
frontend: frontend1
|
||||
|
||||
bind: frontend1/@haproxy.conf:19
|
||||
|
||||
ECH entry: 0 public_name: example.com age: 557 (has private key)
|
||||
[fe0d,94,example.com,[0020,0001,0001],c39285b774bf61c071864181c5292a012b30adaf767e39369a566af05573ef2b,00,00]
|
||||
|
||||
ECH entry: 1 public_name: example.com age: 557 (has private key)
|
||||
[fe0d,ee,example.com,[0020,0001,0001],6572191131b5cabba819f8cacf2d2e06fa0b87b30d9b793644daba7b8866d511,00,00]
|
||||
|
||||
bind: frontend1/@haproxy.conf:20
|
||||
|
||||
ECH entry: 0 public_name: example.com age: 557 (has private key)
|
||||
[fe0d,94,example.com,[0020,0001,0001],c39285b774bf61c071864181c5292a012b30adaf767e39369a566af05573ef2b,00,00]
|
||||
|
||||
ECH entry: 1 public_name: example.com age: 557 (has private key)
|
||||
[fe0d,ee,example.com,[0020,0001,0001],6572191131b5cabba819f8cacf2d2e06fa0b87b30d9b793644daba7b8866d511,00,00]
|
||||
|
||||
$ echo "experimental-mode on; show ssl ech frontend1/@haproxy.conf:19" | socat /tmp/haproxy.sock -
|
||||
***
|
||||
ECH for frontend1/@haproxy.conf:19
|
||||
ECH entry: 0 public_name: example.com age: 786 (has private key)
|
||||
[fe0d,94,example.com,[0020,0001,0001],c39285b774bf61c071864181c5292a012b30adaf767e39369a566af05573ef2b,00,00]
|
||||
|
||||
ECH entry: 1 public_name: example.com age: 786 (has private key)
|
||||
[fe0d,ee,example.com,[0020,0001,0001],6572191131b5cabba819f8cacf2d2e06fa0b87b30d9b793644daba7b8866d511,00,00]
|
||||
|
||||
show ssl jwt
|
||||
Display the list of certificates that can be used for JWT validation.
|
||||
See also "add ssl jwt" and "del ssl jwt" commands.
|
||||
See "jwt" certificate option for more information.
|
||||
|
||||
Example:
|
||||
echo "show ssl jwt" | socat /tmp/sock1 -
|
||||
#filename
|
||||
jwt.pem
|
||||
|
||||
show ssl ocsp-response [[text|base64] <id|path>]
|
||||
Display the IDs of the OCSP tree entries corresponding to all the OCSP
|
||||
responses used in HAProxy, as well as the corresponding frontend
|
||||
|
|
@ -4331,10 +4122,6 @@ shutdown sessions server <backend>/<server>
|
|||
maintenance mode, for instance. Such terminated streams are reported with a
|
||||
'K' flag in the logs.
|
||||
|
||||
Backend connections are left in idle state, unless the server is already in
|
||||
maintenance mode, in which case they will be immediately scheduled for
|
||||
deletion.
|
||||
|
||||
trace
|
||||
The "trace" command alone lists the trace sources, their current status, and
|
||||
their brief descriptions. It is only meant as a menu to enter next levels,
|
||||
|
|
@ -4548,21 +4335,13 @@ wait { -h | <delay> } [<condition> [<args>...]]
|
|||
specified condition to be satisfied, to unrecoverably fail, or to remain
|
||||
unsatisfied for the whole <delay> duration. The supported conditions are:
|
||||
|
||||
- be-removable <proxy> : this will wait for the specified proxy backend to be
|
||||
removable by the "del backend" command. Some conditions will never be
|
||||
accepted (e.g. backend not yet unpublished or with servers in it) and will
|
||||
cause the report of a specific error message indicating what condition is
|
||||
not met. If everything is OK before the delay, a success is returned and
|
||||
the operation is terminated.
|
||||
|
||||
- srv-removable <proxy>/<server> : this will wait for the specified server to
|
||||
be removable by the "del server" command, i.e. be in maintenance and no
|
||||
longer have any connection on it (neither active or idle). Some conditions
|
||||
will never be accepted (e.g. not in maintenance) and will cause the report
|
||||
of a specific error message indicating what condition is not met. The
|
||||
server might even have been removed in parallel and no longer exit. If
|
||||
everything is OK before the delay, a success is returned and the operation
|
||||
is terminated.
|
||||
be removable, i.e. be in maintenance and no longer have any connection on
|
||||
it. Some conditions will never be accepted (e.g. not in maintenance) and
|
||||
will cause the report of a specific error message indicating what condition
|
||||
is not met. The server might even have been removed in parallel and no
|
||||
longer exit. If everything is OK before the delay, a success is returned
|
||||
and the operation is terminated.
|
||||
|
||||
The default unit for the delay is milliseconds, though other units are
|
||||
accepted if suffixed with the usual timer units (us, ms, s, m, h, d). When
|
||||
|
|
@ -4613,11 +4392,6 @@ Example:
|
|||
case the full command ends at the end of line or semi-colon like any regular
|
||||
command.
|
||||
|
||||
Bugs: the sockpair@ protocol used to implement communication between the
|
||||
master and the worker is known to not be reliable on macOS because of an
|
||||
issue in the macOS sendmsg(2) implementation. A command might end up without
|
||||
response because of that.
|
||||
|
||||
Examples:
|
||||
|
||||
$ socat /var/run/haproxy-master.sock readline
|
||||
|
|
@ -4684,11 +4458,6 @@ Example:
|
|||
command). In this case, the prompt mode of the master socket (interactive,
|
||||
prompt, timed) is propagated into the worker process.
|
||||
|
||||
Bugs: the sockpair@ protocol used to implement communication between the
|
||||
master and the worker is known to not be reliable on macOS because of an
|
||||
issue in the macOS sendmsg(2) implementation. A command might end up without
|
||||
response because of that.
|
||||
|
||||
Examples:
|
||||
# gracefully close connections and delete a server once idle (wait max 10s)
|
||||
$ socat -t 11 /var/run/haproxy-master.sock - <<< \
|
||||
|
|
@ -4812,6 +4581,9 @@ show proc [debug]
|
|||
1271 worker 1 0d00h00m00s 2.5-dev13
|
||||
# old workers
|
||||
1233 worker 3 0d00h00m43s 2.0-dev3-6019f6-289
|
||||
# programs
|
||||
1244 foo 0 0d00h00m00s -
|
||||
1255 bar 0 0d00h00m00s -
|
||||
|
||||
In this example, the master has been reloaded 5 times but one of the old
|
||||
worker is still running and survived 3 reloads. You could access the CLI of
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ Revision history
|
|||
string encoding. With contributions from Andriy Palamarchuk
|
||||
(Amazon.com).
|
||||
2020/03/05 - added the unique ID TLV type (Tim Düsterhus)
|
||||
2025/09/09 - added SSL-related TLVs for key exchange group and signature
|
||||
scheme (Steven Collison)
|
||||
2026/01/15 - added SSL client certificate TLV (Simon Ser)
|
||||
|
||||
|
||||
1. Background
|
||||
|
||||
|
|
@ -537,21 +535,18 @@ the information they choose to publish.
|
|||
|
||||
The following types have already been registered for the <type> field :
|
||||
|
||||
#define PP2_TYPE_ALPN 0x01
|
||||
#define PP2_TYPE_AUTHORITY 0x02
|
||||
#define PP2_TYPE_CRC32C 0x03
|
||||
#define PP2_TYPE_NOOP 0x04
|
||||
#define PP2_TYPE_UNIQUE_ID 0x05
|
||||
#define PP2_TYPE_SSL 0x20
|
||||
#define PP2_SUBTYPE_SSL_VERSION 0x21
|
||||
#define PP2_SUBTYPE_SSL_CN 0x22
|
||||
#define PP2_SUBTYPE_SSL_CIPHER 0x23
|
||||
#define PP2_SUBTYPE_SSL_SIG_ALG 0x24
|
||||
#define PP2_SUBTYPE_SSL_KEY_ALG 0x25
|
||||
#define PP2_SUBTYPE_SSL_GROUP 0x26
|
||||
#define PP2_SUBTYPE_SSL_SIG_SCHEME 0x27
|
||||
#define PP2_SUBTYPE_SSL_CLIENT_CERT 0x28
|
||||
#define PP2_TYPE_NETNS 0x30
|
||||
#define PP2_TYPE_ALPN 0x01
|
||||
#define PP2_TYPE_AUTHORITY 0x02
|
||||
#define PP2_TYPE_CRC32C 0x03
|
||||
#define PP2_TYPE_NOOP 0x04
|
||||
#define PP2_TYPE_UNIQUE_ID 0x05
|
||||
#define PP2_TYPE_SSL 0x20
|
||||
#define PP2_SUBTYPE_SSL_VERSION 0x21
|
||||
#define PP2_SUBTYPE_SSL_CN 0x22
|
||||
#define PP2_SUBTYPE_SSL_CIPHER 0x23
|
||||
#define PP2_SUBTYPE_SSL_SIG_ALG 0x24
|
||||
#define PP2_SUBTYPE_SSL_KEY_ALG 0x25
|
||||
#define PP2_TYPE_NETNS 0x30
|
||||
|
||||
|
||||
2.2.1 PP2_TYPE_ALPN
|
||||
|
|
@ -627,10 +622,7 @@ For the type PP2_TYPE_SSL, the value is itself a defined like this :
|
|||
uint8_t client;
|
||||
uint32_t verify;
|
||||
struct pp2_tlv sub_tlv[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
Note the "packed" attribute which indicates that each field starts immediately
|
||||
after the previous one (i.e. without type-specific alignment nor padding).
|
||||
};
|
||||
|
||||
The <verify> field will be zero if the client presented a certificate
|
||||
and it was successfully verified, and non-zero otherwise.
|
||||
|
|
@ -662,25 +654,13 @@ of the used cipher, for example "ECDHE-RSA-AES128-GCM-SHA256".
|
|||
The second level TLV PP2_SUBTYPE_SSL_SIG_ALG provides the US-ASCII string name
|
||||
of the algorithm used to sign the certificate presented by the frontend when
|
||||
the incoming connection was made over an SSL/TLS transport layer, for example
|
||||
"RSA-SHA256".
|
||||
"SHA256".
|
||||
|
||||
The second level TLV PP2_SUBTYPE_SSL_KEY_ALG provides the US-ASCII string name
|
||||
of the algorithm used to generate the key of the certificate presented by the
|
||||
frontend when the incoming connection was made over an SSL/TLS transport layer,
|
||||
for example "RSA2048".
|
||||
|
||||
The second level TLV PP2_SUBTYPE_SSL_GROUP provides the US-ASCII string name of
|
||||
the key exchange algorithm used for the frontend TLS connection, for example
|
||||
"secp256r1".
|
||||
|
||||
The second level TLV PP2_SUBTYPE_SSL_SIG_SCHEME provides the US-ASCII string
|
||||
name of the algorithm the frontend used to sign the ServerKeyExchange or
|
||||
CertificateVerify message, for example "rsa_pss_rsae_sha256".
|
||||
|
||||
The optional second level TLV PP2_SUBTYPE_SSL_CLIENT_CERT provides the raw
|
||||
X.509 client certificate encoded in ASN.1 DER. The frontend may choose to omit
|
||||
this TLV depending on configuration.
|
||||
|
||||
In all cases, the string representation (in UTF8) of the Common Name field
|
||||
(OID: 2.5.4.3) of the client certificate's Distinguished Name, is appended
|
||||
using the TLV format and the type PP2_SUBTYPE_SSL_CN. E.g. "example.com".
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ vtest installation
|
|||
------------------------
|
||||
|
||||
To use vtest you will have to download and compile the recent vtest
|
||||
sources found at https://github.com/vtest/VTest2.
|
||||
sources found at https://github.com/vtest/VTest.
|
||||
|
||||
To compile vtest:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
# Example: log HTTP traffic and TLS session keys to separate destinations
|
||||
#
|
||||
# "option httpslog" sends HTTP access logs to the /dev/log syslog server.
|
||||
# TLS session keys are written to 2 ring buffers.
|
||||
#
|
||||
# Requirements:
|
||||
# - HAProxy built with OpenSSL support
|
||||
# - "tune.ssl.keylog on" in the global section
|
||||
#
|
||||
# Retrieve TLS session keys from the ring buffer via the CLI:
|
||||
# For frontend connections:
|
||||
#
|
||||
# (echo "show events keylog-fc -w"; read) | socat /tmp/worker.socket -
|
||||
#
|
||||
# For backend connections:
|
||||
#
|
||||
# (echo "show events keylog-bc -w"; read) | socat /tmp/worker.socket -
|
||||
#
|
||||
# The result is in SSLKEYLOGFILE format and can be saved to a file and loaded
|
||||
# into Wireshark to decrypt captured TLS traffic.
|
||||
|
||||
global
|
||||
stats socket /tmp/worker.socket mode 0660
|
||||
tune.ssl.keylog on
|
||||
|
||||
# Ring buffer for TLS session keys.
|
||||
# "format raw" stores only the log message text, without any syslog envelope,
|
||||
# producing output in the SSLKEYLOGFILE format directly.
|
||||
ring keylog-fc
|
||||
description "TLS session key frontend log"
|
||||
format raw
|
||||
maxlen 2000
|
||||
size 1M
|
||||
|
||||
ring keylog-bc
|
||||
description "TLS session key backend log"
|
||||
format raw
|
||||
maxlen 2000
|
||||
size 1M
|
||||
|
||||
|
||||
defaults
|
||||
mode http
|
||||
timeout client 30s
|
||||
timeout server 30s
|
||||
timeout connect 5s
|
||||
|
||||
log-profile keylog-fc
|
||||
on any format "${HAPROXY_KEYLOG_FC_LOG_FMT}"
|
||||
|
||||
log-profile keylog-bc
|
||||
on any format "${HAPROXY_KEYLOG_BC_LOG_FMT}"
|
||||
|
||||
frontend https-in
|
||||
bind :443 ssl crt "common.pem"
|
||||
|
||||
option httpslog
|
||||
|
||||
# HTTPs access logs sent to the syslog server
|
||||
log /dev/log format raw local0
|
||||
|
||||
# TLS session keys written to the ring buffer
|
||||
log ring@keylog-fc profile keylog-fc local1
|
||||
log ring@keylog-bc profile keylog-bc local1
|
||||
|
||||
default_backend be1
|
||||
|
||||
backend be1
|
||||
server s1 10.0.0.123:443 ssl verify none
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
-- Provides a pure lua alternative to tcpcheck mailers.
|
||||
--
|
||||
-- To be loaded using "lua-load" from haproxy configuration to handle
|
||||
-- email-alerts directly from lua
|
||||
-- email-alerts directly from lua and disable legacy tcpcheck implementation.
|
||||
|
||||
local SYSLOG_LEVEL = {
|
||||
["EMERG"] = 0,
|
||||
|
|
@ -364,9 +364,9 @@ local function srv_event_add(event, data)
|
|||
mailers_track_server_events(data.reference)
|
||||
end
|
||||
|
||||
-- tell haproxy that we do use the legacy native "mailers" config section
|
||||
-- which allows us to retrieve mailers configuration using Proxy:get_mailers()
|
||||
core.use_native_mailers_config()
|
||||
|
||||
-- disable legacy email-alerts since email-alerts will be sent from lua directly
|
||||
core.disable_legacy_mailers()
|
||||
|
||||
-- event subscriptions are purposely performed in an init function to prevent
|
||||
-- email alerts from being generated too early (when process is starting up)
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ local function rotate_piece(piece, piece_id, px, py, board)
|
|||
end
|
||||
|
||||
function render(applet, board, piece, piece_id, px, py, score)
|
||||
local output = cursor_home
|
||||
local output = clear_screen .. cursor_home
|
||||
output = output .. game_name .. " - Lines: " .. score .. "\r\n"
|
||||
output = output .. "+" .. string.rep("-", board_width * 2) .. "+\r\n"
|
||||
for y = 1, board_height do
|
||||
|
|
@ -160,7 +160,6 @@ function handler(applet)
|
|||
end
|
||||
|
||||
applet:send(cursor_hide)
|
||||
applet:send(clear_screen)
|
||||
|
||||
-- fall the piece by one line every delay
|
||||
local function fall_piece()
|
||||
|
|
@ -215,7 +214,7 @@ function handler(applet)
|
|||
|
||||
local input = applet:receive(1, delay)
|
||||
if input then
|
||||
if input == "" or input == "q" then
|
||||
if input == "q" then
|
||||
game_over = true
|
||||
elseif input == "\27" then
|
||||
local a = applet:receive(1, delay)
|
||||
|
|
|
|||
|
|
@ -2,29 +2,16 @@
|
|||
#ifndef _ACME_T_H_
|
||||
#define _ACME_T_H_
|
||||
|
||||
#include <haproxy/acme_resolvers-t.h>
|
||||
#include <haproxy/istbuf.h>
|
||||
#include <haproxy/openssl-compat.h>
|
||||
|
||||
#if defined(HAVE_ACME)
|
||||
|
||||
#define ACME_RETRY 5
|
||||
|
||||
/* Readiness requirements for challenge */
|
||||
#define ACME_RDY_NONE 0x00
|
||||
#define ACME_RDY_CLI 0x01
|
||||
#define ACME_RDY_DNS 0x02
|
||||
#define ACME_RDY_DELAY 0x04
|
||||
|
||||
/* acme section configuration */
|
||||
struct acme_cfg {
|
||||
char *filename; /* config filename */
|
||||
int linenum; /* config linenum */
|
||||
char *name; /* section name */
|
||||
int reuse_key; /* do we need to renew the private key */
|
||||
int cond_ready; /* ready condition */
|
||||
unsigned int dns_delay; /* delay in seconds before re-triggering DNS resolution (default: 300) */
|
||||
unsigned int dns_timeout; /* time after which the DNS check shouldn't be retried (default: 600) */
|
||||
char *directory; /* directory URL */
|
||||
char *map; /* storage for tokens + thumbprint */
|
||||
struct {
|
||||
|
|
@ -40,23 +27,16 @@ struct acme_cfg {
|
|||
int curves; /* NID of curves */
|
||||
} key;
|
||||
char *challenge; /* HTTP-01, DNS-01, etc */
|
||||
char *vars; /* variables put in the dpapi sink */
|
||||
char *provider; /* DNS provider put in the dpapi sink */
|
||||
struct acme_cfg *next;
|
||||
};
|
||||
|
||||
enum acme_st {
|
||||
ACME_RESOURCES = 0,
|
||||
ACME_RESSOURCES = 0,
|
||||
ACME_NEWNONCE,
|
||||
ACME_CHKACCOUNT,
|
||||
ACME_NEWACCOUNT,
|
||||
ACME_NEWORDER,
|
||||
ACME_AUTH,
|
||||
ACME_CLI_WAIT, /* wait for the ACME_RDY_CLI */
|
||||
ACME_INITIAL_DELAY,
|
||||
ACME_RSLV_RETRY_DELAY,
|
||||
ACME_RSLV_TRIGGER,
|
||||
ACME_RSLV_READY,
|
||||
ACME_CHALLENGE,
|
||||
ACME_CHKCHALLENGE,
|
||||
ACME_FINALIZE,
|
||||
|
|
@ -71,13 +51,9 @@ enum http_st {
|
|||
};
|
||||
|
||||
struct acme_auth {
|
||||
struct ist dns; /* dns entry */
|
||||
struct ist auth; /* auth URI */
|
||||
struct ist chall; /* challenge URI */
|
||||
struct ist token; /* token */
|
||||
int validated; /* already validated */
|
||||
struct acme_rslv *rslv; /* acme dns-01 resolver */
|
||||
int ready; /* is the challenge ready ? */
|
||||
void *next;
|
||||
};
|
||||
|
||||
|
|
@ -94,7 +70,7 @@ struct acme_ctx {
|
|||
struct ist newNonce;
|
||||
struct ist newAccount;
|
||||
struct ist newOrder;
|
||||
} resources;
|
||||
} ressources;
|
||||
struct ist nonce;
|
||||
struct ist kid;
|
||||
struct ist order;
|
||||
|
|
@ -103,25 +79,6 @@ struct acme_ctx {
|
|||
X509_REQ *req;
|
||||
struct ist finalize;
|
||||
struct ist certificate;
|
||||
unsigned int dnstasks; /* number of DNS tasks running for this ctx */
|
||||
unsigned int dnsstarttime; /* time at which we started the DNS checks */
|
||||
struct task *task;
|
||||
struct ebmb_node node;
|
||||
char name[VAR_ARRAY];
|
||||
struct mt_list el;
|
||||
};
|
||||
|
||||
#define ACME_EV_SCHED (1ULL << 0) /* scheduling wakeup */
|
||||
#define ACME_EV_NEW (1ULL << 1) /* new task */
|
||||
#define ACME_EV_TASK (1ULL << 2) /* Task handler */
|
||||
#define ACME_EV_REQ (1ULL << 3) /* HTTP Request */
|
||||
#define ACME_EV_RES (1ULL << 4) /* HTTP Response */
|
||||
|
||||
#define ACME_VERB_CLEAN 1
|
||||
#define ACME_VERB_MINIMAL 2
|
||||
#define ACME_VERB_SIMPLE 3
|
||||
#define ACME_VERB_ADVANCED 4
|
||||
#define ACME_VERB_COMPLETE 5
|
||||
|
||||
#endif /* ! HAVE_ACME */
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@
|
|||
|
||||
#include <haproxy/ssl_ckch-t.h>
|
||||
|
||||
int ckch_conf_acme_init(void *value, char *buf, struct ckch_store *s, int cli, const char *filename, int linenum, char **err);
|
||||
EVP_PKEY *acme_gen_tmp_pkey();
|
||||
X509 *acme_gen_tmp_x509();
|
||||
|
||||
int ckch_conf_acme_init(void *value, char *buf, struct ckch_data *d, int cli, const char *filename, int linenum, char **err);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#ifndef _HAPROXY_ACME_RESOLVERS_T_H
|
||||
#define _HAPROXY_ACME_RESOLVERS_T_H
|
||||
|
||||
#include <haproxy/obj_type-t.h>
|
||||
#include <haproxy/resolvers-t.h>
|
||||
|
||||
struct dns_counters;
|
||||
|
||||
/* TXT records for dns-01 */
|
||||
|
||||
struct acme_rslv {
|
||||
enum obj_type obj_type; /* OBJ_TYPE_ACME_RSLV */
|
||||
unsigned int *dnstasks; /* number of running DNS resolution for the same acme_task */
|
||||
char *hostname_dn;
|
||||
int hostname_dn_len;
|
||||
struct resolvers *resolvers;
|
||||
struct resolv_requester *requester;
|
||||
int result; /* RSLV_STATUS_* — NONE until done */
|
||||
int error_code; /* RSLV_RESP_* from the error callback */
|
||||
struct task *acme_task; /* ACME task to wake on completion, or NULL */
|
||||
struct ist txt; /* first TXT record found */
|
||||
int (*success_cb)(struct resolv_requester *, struct dns_counters *);
|
||||
int (*error_cb)(struct resolv_requester *, int);
|
||||
};
|
||||
|
||||
#endif /* _HAPROXY_ACME_RESOLVERS_T_H */
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#ifndef _HAPROXY_ACME_RESOLVERS_H
|
||||
#define _HAPROXY_ACME_RESOLVERS_H
|
||||
|
||||
#include <haproxy/openssl-compat.h>
|
||||
|
||||
#if defined(HAVE_ACME)
|
||||
|
||||
#include <haproxy/acme_resolvers-t.h>
|
||||
#include <haproxy/acme-t.h>
|
||||
#include <haproxy/resolvers-t.h>
|
||||
|
||||
struct acme_rslv *acme_rslv_start(struct acme_auth *auth, unsigned int *dnstasks, char **errmsg);
|
||||
void acme_rslv_free(struct acme_rslv *rslv);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _HAPROXY_ACME_RESOLVERS_H */
|
||||
|
|
@ -66,8 +66,7 @@ enum act_parse_ret {
|
|||
enum act_opt {
|
||||
ACT_OPT_NONE = 0x00000000, /* no flag */
|
||||
ACT_OPT_FINAL = 0x00000001, /* last call, cannot yield */
|
||||
ACT_OPT_FINAL_EARLY = 0x00000002, /* set in addition to ACT_OPT_FINAL if last call occurs earlier than normal due to unexpected IO/error */
|
||||
ACT_OPT_FIRST = 0x00000004, /* first call for this action */
|
||||
ACT_OPT_FIRST = 0x00000002, /* first call for this action */
|
||||
};
|
||||
|
||||
/* Flags used to describe the action. */
|
||||
|
|
@ -102,10 +101,7 @@ enum act_name {
|
|||
|
||||
/* Timeout name valid for a set-timeout rule */
|
||||
enum act_timeout_name {
|
||||
ACT_TIMEOUT_CONNECT,
|
||||
ACT_TIMEOUT_SERVER,
|
||||
ACT_TIMEOUT_QUEUE,
|
||||
ACT_TIMEOUT_TARPIT,
|
||||
ACT_TIMEOUT_TUNNEL,
|
||||
ACT_TIMEOUT_CLIENT,
|
||||
};
|
||||
|
|
@ -151,7 +147,6 @@ struct act_rule {
|
|||
struct ist str; /* string param (reason, header name, ...) */
|
||||
struct lf_expr fmt; /* log-format compatible expression */
|
||||
struct my_regex *re; /* used by replace-header/value/uri/path */
|
||||
struct sample_expr *expr; /* sample expression used by HTTP action */
|
||||
} http; /* args used by some HTTP rules */
|
||||
struct http_reply *http_reply; /* HTTP response to be used by return/deny/tarpit rules */
|
||||
struct redirect_rule *redir; /* redirect rule or "http-request redirect" */
|
||||
|
|
@ -199,11 +194,6 @@ struct act_rule {
|
|||
struct server *srv; /* target server to attach the connection */
|
||||
struct sample_expr *name; /* used to differentiate idle connections */
|
||||
} attach_srv; /* 'attach-srv' rule */
|
||||
struct {
|
||||
enum log_orig_id orig;
|
||||
char *profile_name;
|
||||
struct log_profile *profile;
|
||||
} do_log; /* 'do-log' action */
|
||||
struct {
|
||||
int value;
|
||||
struct sample_expr *expr;
|
||||
|
|
@ -212,7 +202,6 @@ struct act_rule {
|
|||
void *p[4];
|
||||
} act; /* generic pointers to be used by custom actions */
|
||||
} arg; /* arguments used by some actions */
|
||||
struct thread_exec_ctx exec_ctx; /* execution context */
|
||||
struct {
|
||||
char *file; /* file name where the rule appears (or NULL) */
|
||||
int line; /* line number where the rule appears */
|
||||
|
|
@ -224,9 +213,7 @@ struct action_kw {
|
|||
enum act_parse_ret (*parse)(const char **args, int *cur_arg, struct proxy *px,
|
||||
struct act_rule *rule, char **err);
|
||||
int flags;
|
||||
/* 4 bytes here */
|
||||
void *private;
|
||||
struct thread_exec_ctx exec_ctx; /* execution context */
|
||||
};
|
||||
|
||||
struct action_kw_list {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ int act_resolution_cb(struct resolv_requester *requester, struct dns_counters *c
|
|||
int act_resolution_error_cb(struct resolv_requester *requester, int error_code);
|
||||
const char *action_suggest(const char *word, const struct list *keywords, const char **extra);
|
||||
void free_act_rule(struct act_rule *rule);
|
||||
void act_add_list(struct list *head, struct action_kw_list *kw_list);
|
||||
|
||||
static inline struct action_kw *action_lookup(struct list *keywords, const char *kw)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include <haproxy/api-t.h>
|
||||
#include <haproxy/freq_ctr-t.h>
|
||||
#include <haproxy/tinfo-t.h>
|
||||
|
||||
/* bit fields for the "profiling" global variable */
|
||||
#define HA_PROF_TASKS_OFF 0x00000000 /* per-task CPU profiling forced disabled */
|
||||
|
|
@ -34,8 +33,6 @@
|
|||
#define HA_PROF_TASKS_MASK 0x00000003 /* per-task CPU profiling mask */
|
||||
|
||||
#define HA_PROF_MEMORY 0x00000004 /* memory profiling */
|
||||
#define HA_PROF_TASKS_MEM 0x00000008 /* per-task CPU profiling with memory */
|
||||
#define HA_PROF_TASKS_LOCK 0x00000010 /* per-task CPU profiling with locks */
|
||||
|
||||
|
||||
#ifdef USE_MEMORY_PROFILING
|
||||
|
|
@ -79,13 +76,12 @@ struct memprof_stats {
|
|||
const void *caller;
|
||||
enum memprof_method method;
|
||||
/* 4-7 bytes hole here */
|
||||
unsigned long long locked_calls;
|
||||
unsigned long long alloc_calls;
|
||||
unsigned long long free_calls;
|
||||
unsigned long long alloc_tot;
|
||||
unsigned long long free_tot;
|
||||
void *info; // for pools, ptr to the pool
|
||||
struct thread_exec_ctx exec_ctx;
|
||||
void *pad; // pad to 64
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -129,8 +125,8 @@ struct activity {
|
|||
unsigned int ctr2; // general purposee debug counter
|
||||
#endif
|
||||
char __pad[0]; // unused except to check remaining room
|
||||
char __end[0] THREAD_ALIGNED();
|
||||
} THREAD_ALIGNED();
|
||||
char __end[0] __attribute__((aligned(64))); // align size to 64.
|
||||
};
|
||||
|
||||
/* 256 entries for callers * callees should be highly sufficient (~45 seen usually) */
|
||||
#define SCHED_ACT_HASH_BITS 8
|
||||
|
|
@ -147,10 +143,7 @@ struct sched_activity {
|
|||
uint64_t calls;
|
||||
uint64_t cpu_time;
|
||||
uint64_t lat_time;
|
||||
uint64_t lkw_time; /* lock waiting time */
|
||||
uint64_t lkd_time; /* locked time */
|
||||
uint64_t mem_time; /* memory ops wait time */
|
||||
} THREAD_ALIGNED();
|
||||
};
|
||||
|
||||
#endif /* _HAPROXY_ACTIVITY_T_H */
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#define APPCTX_FL_ERROR 0x00000080
|
||||
#define APPCTX_FL_SHUTDOWN 0x00000100 /* applet was shut down (->release() called if any). No more data exchange with SCs */
|
||||
#define APPCTX_FL_WANT_DIE 0x00000200 /* applet was running and requested to die */
|
||||
/* unused: 0x00000400 */
|
||||
#define APPCTX_FL_INOUT_BUFS 0x00000400 /* applet uses its own buffers */
|
||||
#define APPCTX_FL_FASTFWD 0x00000800 /* zero-copy forwarding is in-use, don't fill the outbuf */
|
||||
#define APPCTX_FL_IN_MAYALLOC 0x00001000 /* applet may try again to allocate its inbuf */
|
||||
#define APPCTX_FL_OUT_MAYALLOC 0x00002000 /* applet may try again to allocate its outbuf */
|
||||
|
|
@ -73,22 +73,17 @@ static forceinline char *appctx_show_flags(char *buf, size_t len, const char *de
|
|||
_(APPCTX_FL_OUTBLK_ALLOC, _(APPCTX_FL_OUTBLK_FULL,
|
||||
_(APPCTX_FL_EOI, _(APPCTX_FL_EOS,
|
||||
_(APPCTX_FL_ERR_PENDING, _(APPCTX_FL_ERROR,
|
||||
_(APPCTX_FL_SHUTDOWN, _(APPCTX_FL_WANT_DIE,
|
||||
_(APPCTX_FL_FASTFWD, _(APPCTX_FL_IN_MAYALLOC, _(APPCTX_FL_OUT_MAYALLOC)))))))))))));
|
||||
_(APPCTX_FL_SHUTDOWN, _(APPCTX_FL_WANT_DIE, _(APPCTX_FL_INOUT_BUFS,
|
||||
_(APPCTX_FL_FASTFWD, _(APPCTX_FL_IN_MAYALLOC, _(APPCTX_FL_OUT_MAYALLOC))))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
#undef _
|
||||
}
|
||||
|
||||
#define APPLET_FL_NEW_API 0x00000001 /* Set if the applet is based on the new API (using applet's buffers) */
|
||||
#define APPLET_FL_WARNED 0x00000002 /* Set when warning was already emitted about a legacy applet */
|
||||
#define APPLET_FL_HTX 0x00000004 /* Set if the applet is using HTX buffers */
|
||||
|
||||
/* Applet descriptor */
|
||||
struct applet {
|
||||
enum obj_type obj_type; /* object type = OBJ_TYPE_APPLET */
|
||||
unsigned int flags; /* APPLET_FL_* flags */
|
||||
/* 3 unused bytes here */
|
||||
char *name; /* applet's name to report in logs */
|
||||
int (*init)(struct appctx *); /* callback to init resources, may be NULL.
|
||||
|
|
@ -130,7 +125,6 @@ struct appctx {
|
|||
int (*io_handler)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK */
|
||||
void (*io_release)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK,
|
||||
if the command is terminated or the session released */
|
||||
struct cli_kw *kw; /* the keyword being processed */
|
||||
} cli_ctx; /* context dedicated to the CLI applet */
|
||||
|
||||
struct buffer_wait buffer_wait; /* position in the list of objects waiting for a buffer */
|
||||
|
|
|
|||
|
|
@ -62,19 +62,6 @@ ssize_t applet_append_line(void *ctx, struct ist v1, struct ist v2, size_t ofs,
|
|||
static forceinline void applet_fl_set(struct appctx *appctx, uint on);
|
||||
static forceinline void applet_fl_clr(struct appctx *appctx, uint off);
|
||||
|
||||
/* macros to switch the calling context to the applet during a call. There's
|
||||
* one with a return value for most calls, and one without for the few like
|
||||
* fct(), shut(), or release() with no return.
|
||||
*/
|
||||
#define CALL_APPLET_WITH_RET(applet, func) EXEC_CTX_WITH_RET(EXEC_CTX_MAKE(TH_EX_CTX_APPLET, (applet)), (applet)->func)
|
||||
#define CALL_APPLET_NO_RET(applet, func) EXEC_CTX_NO_RET(EXEC_CTX_MAKE(TH_EX_CTX_APPLET, (applet)), (applet)->func)
|
||||
|
||||
|
||||
static forceinline uint appctx_app_test(const struct appctx *appctx, uint test)
|
||||
{
|
||||
return (appctx->applet->flags & test);
|
||||
}
|
||||
|
||||
static inline struct appctx *appctx_new_here(struct applet *applet, struct sedesc *sedesc)
|
||||
{
|
||||
return appctx_new_on(applet, sedesc, tid);
|
||||
|
|
@ -129,11 +116,11 @@ static inline int appctx_init(struct appctx *appctx)
|
|||
* the appctx will be fully initialized. The session and the stream will
|
||||
* eventually be created. The affinity must be set now !
|
||||
*/
|
||||
BUG_ON(appctx->t->tid != -1 && appctx->t->tid != tid);
|
||||
BUG_ON(appctx->t->tid != tid);
|
||||
task_set_thread(appctx->t, tid);
|
||||
|
||||
if (appctx->applet->init)
|
||||
return CALL_APPLET_WITH_RET(appctx->applet, init(appctx));
|
||||
return appctx->applet->init(appctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -295,156 +282,13 @@ static inline void applet_expect_data(struct appctx *appctx)
|
|||
se_fl_clr(appctx->sedesc, SE_FL_EXP_NO_DATA);
|
||||
}
|
||||
|
||||
/* Returns the buffer containing data pushed to the applet by the stream. For
|
||||
* applets using its own buffers it is the appctx input buffer. For legacy
|
||||
* applet, it is the output channel buffer.
|
||||
*/
|
||||
static inline struct buffer *applet_get_inbuf(struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (applet_fl_test(appctx, APPCTX_FL_INBLK_ALLOC) || !appctx_get_buf(appctx, &appctx->inbuf))
|
||||
return NULL;
|
||||
return &appctx->inbuf;
|
||||
}
|
||||
else
|
||||
return sc_ob(appctx_sc(appctx));
|
||||
}
|
||||
|
||||
/* Returns the buffer containing data pushed by the applets to the stream. For
|
||||
* applets using its own buffer it is the appctx output buffer. For legacy
|
||||
* applet, it is the input channel buffer.
|
||||
*/
|
||||
static inline struct buffer *applet_get_outbuf(struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (applet_fl_test(appctx, APPCTX_FL_OUTBLK_ALLOC|APPCTX_FL_OUTBLK_FULL) ||
|
||||
!appctx_get_buf(appctx, &appctx->outbuf))
|
||||
return NULL;
|
||||
return &appctx->outbuf;
|
||||
}
|
||||
else
|
||||
return sc_ib(appctx_sc(appctx));
|
||||
}
|
||||
|
||||
/* Returns the amount of HTX data in the input buffer (see applet_get_inbuf) */
|
||||
static inline size_t applet_htx_input_data(const struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
return htx_used_space(htxbuf(&appctx->inbuf));
|
||||
else
|
||||
return co_data(sc_oc(appctx_sc(appctx)));
|
||||
}
|
||||
|
||||
/* Returns the amount of data in the input buffer (see applet_get_inbuf) */
|
||||
static inline size_t applet_input_data(const struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_HTX))
|
||||
return applet_htx_input_data(appctx);
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
return b_data(&appctx->inbuf);
|
||||
else
|
||||
return co_data(sc_oc(appctx_sc(appctx)));
|
||||
}
|
||||
|
||||
/* Returns the amount of HTX data in the output buffer (see applet_get_outbuf) */
|
||||
static inline size_t applet_htx_output_data(const struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
return htx_used_space(htxbuf(&appctx->outbuf));
|
||||
else
|
||||
return ci_data(sc_ic(appctx_sc(appctx)));
|
||||
}
|
||||
|
||||
/* Returns the amount of data in the output buffer (see applet_get_outbuf) */
|
||||
static inline size_t applet_output_data(const struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_HTX))
|
||||
return applet_htx_output_data(appctx);
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
return b_data(&appctx->outbuf);
|
||||
else
|
||||
return ci_data(sc_ic(appctx_sc(appctx)));
|
||||
}
|
||||
|
||||
/* Skips <len> bytes from the input buffer (see applet_get_inbuf).
|
||||
*
|
||||
* This is useful when data have been read directly from the buffer. It is
|
||||
* illegal to call this function with <len> causing a wrapping at the end of the
|
||||
* buffer. It's the caller's responsibility to ensure that <len> is never larger
|
||||
* than available output data.
|
||||
*
|
||||
* This function is not HTX aware.
|
||||
*/
|
||||
static inline void applet_skip_input(struct appctx *appctx, size_t len)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
b_del(&appctx->inbuf, len);
|
||||
applet_fl_clr(appctx, APPCTX_FL_INBLK_FULL);
|
||||
}
|
||||
else
|
||||
co_skip(sc_oc(appctx_sc(appctx)), len);
|
||||
}
|
||||
|
||||
/* Removes all bytes from the input buffer (see applet_get_inbuf).
|
||||
*/
|
||||
static inline void applet_reset_input(struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
b_reset(&appctx->inbuf);
|
||||
applet_fl_clr(appctx, APPCTX_FL_INBLK_FULL);
|
||||
}
|
||||
else
|
||||
co_skip(sc_oc(appctx_sc(appctx)), co_data(sc_oc(appctx_sc(appctx))));
|
||||
}
|
||||
|
||||
/* Returns the amount of space available at the HTX output buffer (see applet_get_outbuf).
|
||||
*/
|
||||
static inline size_t applet_htx_output_room(const struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
return htx_free_data_space(htxbuf(&appctx->outbuf));
|
||||
else
|
||||
return channel_recv_max(sc_ic(appctx_sc(appctx)));
|
||||
}
|
||||
|
||||
/* Returns the amount of space available at the output buffer (see applet_get_outbuf).
|
||||
*/
|
||||
static inline size_t applet_output_room(const struct appctx *appctx)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_HTX))
|
||||
return applet_htx_output_room(appctx);
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
return b_room(&appctx->outbuf);
|
||||
else
|
||||
return channel_recv_max(sc_ic(appctx_sc(appctx)));
|
||||
}
|
||||
|
||||
/*Indicates that the applet have more data to deliver and it needs more room in
|
||||
* the output buffer to do so (see applet_get_outbuf).
|
||||
*
|
||||
* For applets using its own buffers, <room_needed> is not used and only
|
||||
* <appctx> flags are updated. For legacy applets, the amount of free space
|
||||
* required must be specified. In this last case, it is the caller
|
||||
* responsibility to be sure <room_needed> is valid.
|
||||
*/
|
||||
static inline void applet_need_room(struct appctx *appctx, size_t room_needed)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
applet_have_more_data(appctx);
|
||||
else
|
||||
sc_need_room(appctx_sc(appctx), room_needed);
|
||||
}
|
||||
|
||||
/* Should only be used via wrappers applet_putchk() / applet_putchk_stress(). */
|
||||
static inline int _applet_putchk(struct appctx *appctx, struct buffer *chunk,
|
||||
int stress)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (appctx->flags & APPCTX_FL_INOUT_BUFS) {
|
||||
if (unlikely(stress) ?
|
||||
b_data(&appctx->outbuf) :
|
||||
b_data(chunk) > b_room(&appctx->outbuf)) {
|
||||
|
|
@ -474,10 +318,9 @@ static inline int _applet_putchk(struct appctx *appctx, struct buffer *chunk,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* writes chunk <chunk> into the applet output buffer (see applet_get_outbuf).
|
||||
*
|
||||
* Returns the number of written bytes on success or -1 on error (lake of space,
|
||||
* shutdown, invalid call...)
|
||||
/* writes chunk <chunk> into the input channel of the stream attached to this
|
||||
* appctx's endpoint, and marks the SC_FL_NEED_ROOM on a channel full error.
|
||||
* See ci_putchk() for the list of return codes.
|
||||
*/
|
||||
static inline int applet_putchk(struct appctx *appctx, struct buffer *chunk)
|
||||
{
|
||||
|
|
@ -490,16 +333,15 @@ static inline int applet_putchk_stress(struct appctx *appctx, struct buffer *chu
|
|||
return _applet_putchk(appctx, chunk, 1);
|
||||
}
|
||||
|
||||
/* writes <len> chars from <blk> into the applet output buffer (see applet_get_outbuf).
|
||||
*
|
||||
* Returns the number of written bytes on success or -1 on error (lake of space,
|
||||
* shutdown, invalid call...)
|
||||
/* writes <len> chars from <blk> into the input channel of the stream attached
|
||||
* to this appctx's endpoint, and marks the SC_FL_NEED_ROOM on a channel full
|
||||
* error. See ci_putblk() for the list of return codes.
|
||||
*/
|
||||
static inline int applet_putblk(struct appctx *appctx, const char *blk, int len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (appctx->flags & APPCTX_FL_INOUT_BUFS) {
|
||||
if (len > b_room(&appctx->outbuf)) {
|
||||
applet_fl_set(appctx, APPCTX_FL_OUTBLK_FULL);
|
||||
ret = -1;
|
||||
|
|
@ -525,17 +367,16 @@ static inline int applet_putblk(struct appctx *appctx, const char *blk, int len)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* writes chars from <str> up to the trailing zero (excluded) into the applet
|
||||
* output buffer (see applet_get_outbuf).
|
||||
*
|
||||
* Returns the number of written bytes on success or -1 on error (lake of space,
|
||||
* shutdown, invalid call...)
|
||||
/* writes chars from <str> up to the trailing zero (excluded) into the input
|
||||
* channel of the stream attached to this appctx's endpoint, and marks the
|
||||
* SC_FL_NEED_ROOM on a channel full error. See ci_putstr() for the list of
|
||||
* return codes.
|
||||
*/
|
||||
static inline int applet_putstr(struct appctx *appctx, const char *str)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (appctx->flags & APPCTX_FL_INOUT_BUFS) {
|
||||
int len = strlen(str);
|
||||
|
||||
if (len > b_room(&appctx->outbuf)) {
|
||||
|
|
@ -562,16 +403,15 @@ static inline int applet_putstr(struct appctx *appctx, const char *str)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* writes character <chr> into the applet's output buffer (see applet_get_outbuf).
|
||||
*
|
||||
* Returns the number of written bytes on success or -1 on error (lake of space,
|
||||
* shutdown, invalid call...)
|
||||
/* writes character <chr> into the input channel of the stream attached to this
|
||||
* appctx's endpoint, and marks the SC_FL_NEED_ROOM on a channel full error.
|
||||
* See ci_putchr() for the list of return codes.
|
||||
*/
|
||||
static inline int applet_putchr(struct appctx *appctx, char chr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (appctx->flags & APPCTX_FL_INOUT_BUFS) {
|
||||
if (b_full(&appctx->outbuf)) {
|
||||
applet_fl_set(appctx, APPCTX_FL_OUTBLK_FULL);
|
||||
ret = -1;
|
||||
|
|
@ -598,283 +438,6 @@ static inline int applet_putchr(struct appctx *appctx, char chr)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline int applet_may_get(const struct appctx *appctx, size_t len)
|
||||
{
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (len > b_data(&appctx->inbuf)) {
|
||||
if (se_fl_test(appctx->sedesc, SE_FL_SHW))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const struct stconn *sc = appctx_sc(appctx);
|
||||
|
||||
if ((sc->flags & SC_FL_SHUT_DONE) || len > co_data(sc_oc(sc))) {
|
||||
if (sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/* Gets one char from the applet input buffer (see appet_get_inbuf),
|
||||
*
|
||||
* Return values :
|
||||
* 1 : number of bytes read, equal to requested size.
|
||||
* =0 : not enough data available. <c> is left undefined.
|
||||
* <0 : no more bytes readable because output is shut.
|
||||
*
|
||||
* The status of the corresponding buffer is not changed. The caller must call
|
||||
* applet_skip_input() to update it.
|
||||
*/
|
||||
static inline int applet_getchar(const struct appctx *appctx, char *c)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = applet_may_get(appctx, 1);
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
*c = ((appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
? *(b_head(&appctx->inbuf))
|
||||
: *(co_head(sc_oc(appctx_sc(appctx)))));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Copies one full block of data from the applet input buffer (see
|
||||
* appet_get_inbuf).
|
||||
*
|
||||
* <len> bytes are capied, starting at the offset <offset>.
|
||||
*
|
||||
* Return values :
|
||||
* >0 : number of bytes read, equal to requested size.
|
||||
* =0 : not enough data available. <blk> is left undefined.
|
||||
* <0 : no more bytes readable because output is shut.
|
||||
*
|
||||
* The status of the corresponding buffer is not changed. The caller must call
|
||||
* applet_skip_input() to update it.
|
||||
*/
|
||||
static inline int applet_getblk(const struct appctx *appctx, char *blk, int len, int offset)
|
||||
{
|
||||
const struct buffer *buf;
|
||||
int ret;
|
||||
|
||||
ret = applet_may_get(appctx, len+offset);
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
|
||||
buf = ((appctx_app_test(appctx, APPLET_FL_NEW_API))
|
||||
? &appctx->inbuf
|
||||
: sc_ob(appctx_sc(appctx)));
|
||||
return b_getblk(buf, blk, len, offset);
|
||||
}
|
||||
|
||||
/* Gets one text block representing a word from the applet input buffer (see
|
||||
* appet_get_inbuf).
|
||||
*
|
||||
* The separator is waited for as long as some data can still be received and the
|
||||
* destination is not full. Otherwise, the string may be returned as is, without
|
||||
* the separator.
|
||||
*
|
||||
* Return values :
|
||||
* >0 : number of bytes read. Includes the separator if present before len or end.
|
||||
* =0 : no separator before end found. <str> is left undefined.
|
||||
* <0 : no more bytes readable because output is shut.
|
||||
*
|
||||
* The status of the corresponding buffer is not changed. The caller must call
|
||||
* applet_skip_input() to update it.
|
||||
*/
|
||||
static inline int applet_getword(const struct appctx *appctx, char *str, int len, char sep)
|
||||
{
|
||||
const struct buffer *buf;
|
||||
char *p;
|
||||
size_t input, max = len;
|
||||
int ret = 0;
|
||||
|
||||
ret = applet_may_get(appctx, 1);
|
||||
if (ret <= 0)
|
||||
goto out;
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
buf = &appctx->inbuf;
|
||||
input = b_data(buf);
|
||||
}
|
||||
else {
|
||||
struct stconn *sc = appctx_sc(appctx);
|
||||
|
||||
buf = sc_ob(sc);
|
||||
input = co_data(sc_oc(sc));
|
||||
}
|
||||
|
||||
if (max > input) {
|
||||
max = input;
|
||||
str[max-1] = 0;
|
||||
}
|
||||
|
||||
p = b_head(buf);
|
||||
ret = 0;
|
||||
while (max) {
|
||||
*str++ = *p;
|
||||
ret++;
|
||||
max--;
|
||||
if (*p == sep)
|
||||
goto out;
|
||||
p = b_next(buf, p);
|
||||
}
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (ret < len && (ret < input || b_room(buf)) &&
|
||||
!se_fl_test(appctx->sedesc, SE_FL_SHW))
|
||||
ret = 0;
|
||||
}
|
||||
else {
|
||||
struct stconn *sc = appctx_sc(appctx);
|
||||
|
||||
if (ret < len && (ret < input || channel_may_recv(sc_oc(sc))) &&
|
||||
!(sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
|
||||
ret = 0;
|
||||
}
|
||||
out:
|
||||
if (max)
|
||||
*str = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Gets one text block representing a line from the applet input buffer (see
|
||||
* appet_get_inbuf).
|
||||
*
|
||||
* The '\n' is waited for as long as some data can still be received and the
|
||||
* destination is not full. Otherwise, the string may be returned as is, without
|
||||
* the '\n'.
|
||||
*
|
||||
* Return values :
|
||||
* >0 : number of bytes read. Includes the \n if present before len or end.
|
||||
* =0 : no '\n' before end found. <str> is left undefined.
|
||||
* <0 : no more bytes readable because output is shut.
|
||||
*
|
||||
* The status of the corresponding buffer is not changed. The caller must call
|
||||
* applet_skip_input() to update it.
|
||||
*/
|
||||
static inline int applet_getline(const struct appctx *appctx, char *str, int len)
|
||||
{
|
||||
return applet_getword(appctx, str, len, '\n');
|
||||
}
|
||||
|
||||
/* Gets one or two blocks of data at once from the applet input buffer (see appet_get_inbuf),
|
||||
*
|
||||
* Data are not copied.
|
||||
*
|
||||
* Return values :
|
||||
* >0 : number of blocks filled (1 or 2). blk1 is always filled before blk2.
|
||||
* =0 : not enough data available. <blk*> are left undefined.
|
||||
* <0 : no more bytes readable because output is shut.
|
||||
*
|
||||
* The status of the corresponding buffer is not changed. The caller must call
|
||||
* applet_skip_input() to update it.
|
||||
*/
|
||||
static inline int applet_getblk_nc(const struct appctx *appctx, const char **blk1, size_t *len1, const char **blk2, size_t *len2)
|
||||
{
|
||||
const struct buffer *buf;
|
||||
size_t max;
|
||||
int ret;
|
||||
|
||||
ret = applet_may_get(appctx, 1);
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
buf = &appctx->inbuf;
|
||||
max = b_data(buf);
|
||||
}
|
||||
else {
|
||||
struct stconn *sc = appctx_sc(appctx);
|
||||
|
||||
buf = sc_ob(sc);
|
||||
max = co_data(sc_oc(sc));
|
||||
}
|
||||
|
||||
return b_getblk_nc(buf, blk1, len1, blk2, len2, 0, max);
|
||||
}
|
||||
|
||||
/* Gets one or two blocks of text representing a word from the applet input
|
||||
* buffer (see appet_get_inbuf).
|
||||
*
|
||||
* Data are not copied. The separator is waited for as long as some data can
|
||||
* still be received and the destination is not full. Otherwise, the string may
|
||||
* be returned as is, without the separator.
|
||||
*
|
||||
* Return values :
|
||||
* >0 : number of bytes read. Includes the separator if present before len or end.
|
||||
* =0 : no separator before end found. <str> is left undefined.
|
||||
* <0 : no more bytes readable because output is shut.
|
||||
*
|
||||
* The status of the corresponding buffer is not changed. The caller must call
|
||||
* applet_skip_input() to update it.
|
||||
*/
|
||||
static inline int applet_getword_nc(const struct appctx *appctx, const char **blk1, size_t *len1, const char **blk2, size_t *len2, char sep)
|
||||
{
|
||||
int ret;
|
||||
size_t l;
|
||||
|
||||
ret = applet_getblk_nc(appctx, blk1, len1, blk2, len2);
|
||||
if (unlikely(ret <= 0))
|
||||
return ret;
|
||||
|
||||
for (l = 0; l < *len1 && (*blk1)[l] != sep; l++);
|
||||
if (l < *len1 && (*blk1)[l] == sep) {
|
||||
*len1 = l + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ret >= 2) {
|
||||
for (l = 0; l < *len2 && (*blk2)[l] != sep; l++);
|
||||
if (l < *len2 && (*blk2)[l] == sep) {
|
||||
*len2 = l + 1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we have found no LF and the buffer is full or the SC is shut, then
|
||||
* the resulting string is made of the concatenation of the pending
|
||||
* blocks (1 or 2).
|
||||
*/
|
||||
if (appctx_app_test(appctx, APPLET_FL_NEW_API)) {
|
||||
if (b_full(&appctx->inbuf) || se_fl_test(appctx->sedesc, SE_FL_SHW))
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
struct stconn *sc = appctx_sc(appctx);
|
||||
|
||||
if (!channel_may_recv(sc_oc(sc)) || sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* No LF yet and not shut yet */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Gets one or two blocks of text representing a line from the applet input
|
||||
* buffer (see appet_get_inbuf).
|
||||
*
|
||||
* Data are not copied. The '\n' is waited for as long as some data can still be
|
||||
* received and the destination is not full. Otherwise, the string may be
|
||||
* returned as is, without the '\n'.
|
||||
*
|
||||
* Return values :
|
||||
* >0 : number of bytes read. Includes the \n if present before len or end.
|
||||
* =0 : no '\n' before end found. <str> is left undefined.
|
||||
* <0 : no more bytes readable because output is shut.
|
||||
*
|
||||
* The status of the corresponding buffer is not changed. The caller must call
|
||||
* applet_skip_input() to update it.
|
||||
*/
|
||||
static inline int applet_getline_nc(const struct appctx *appctx, const char **blk1, size_t *len1, const char **blk2, size_t *len2)
|
||||
{
|
||||
return applet_getword_nc(appctx, blk1, len1, blk2, len2, '\n');
|
||||
}
|
||||
|
||||
#endif /* _HAPROXY_APPLET_H */
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -192,7 +192,6 @@ struct lbprm {
|
|||
void (*server_requeue)(struct server *); /* function used to place the server where it must be */
|
||||
void (*proxy_deinit)(struct proxy *); /* to be called when we're destroying the proxy */
|
||||
void (*server_deinit)(struct server *); /* to be called when we're destroying the server */
|
||||
int (*server_init)(struct server *); /* initialize a freshly added server (runtime); <0=fail. */
|
||||
};
|
||||
|
||||
#endif /* _HAPROXY_BACKEND_T_H */
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ int alloc_bind_address(struct sockaddr_storage **ss,
|
|||
struct server *srv, struct proxy *be,
|
||||
struct stream *s);
|
||||
|
||||
int be_reuse_mode(const struct proxy *be, const struct server *srv);
|
||||
|
||||
int64_t be_calculate_conn_hash(struct server *srv, struct stream *strm,
|
||||
struct session *sess,
|
||||
struct sockaddr_storage *src,
|
||||
|
|
@ -69,7 +67,6 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
|||
int tcp_persist_rdp_cookie(struct stream *s, struct channel *req, int an_bit);
|
||||
|
||||
int be_downtime(struct proxy *px);
|
||||
int be_supports_dynamic_srv(struct proxy *px, char **msg);
|
||||
void recount_servers(struct proxy *px);
|
||||
void update_backend_weight(struct proxy *px);
|
||||
|
||||
|
|
@ -86,24 +83,10 @@ static inline int be_usable_srv(struct proxy *be)
|
|||
return be->srv_bck;
|
||||
}
|
||||
|
||||
/* Returns true if <be> backend can be used as target to a switching rules. */
|
||||
static inline int be_is_eligible(const struct proxy *be)
|
||||
{
|
||||
/* A disabled or unpublished backend cannot be selected for traffic.
|
||||
* Note that STOPPED state is ignored as there is a risk of breaking
|
||||
* requests during soft-stop.
|
||||
*/
|
||||
return !(be->flags & (PR_FL_DISABLED|PR_FL_BE_UNPUBLISHED));
|
||||
}
|
||||
|
||||
/* set the time of last session on the backend */
|
||||
static inline void be_set_sess_last(struct proxy *be)
|
||||
{
|
||||
uint now_sec = ns_to_sec(now_ns);
|
||||
|
||||
if (be->be_counters.shared.tg)
|
||||
if (HA_ATOMIC_LOAD(&be->be_counters.shared.tg[tgid - 1]->last_sess) != now_sec)
|
||||
HA_ATOMIC_STORE(&be->be_counters.shared.tg[tgid - 1]->last_sess, now_sec);
|
||||
be->be_counters.last_sess = ns_to_sec(now_ns);
|
||||
}
|
||||
|
||||
/* This function returns non-zero if the designated server will be
|
||||
|
|
@ -183,12 +166,6 @@ void set_backend_down(struct proxy *be);
|
|||
|
||||
unsigned int gen_hash(const struct proxy* px, const char* key, unsigned long len);
|
||||
|
||||
/* Returns true if connection reuse is supported by <be> backend. */
|
||||
static inline int be_supports_conn_reuse(const struct proxy *be)
|
||||
{
|
||||
return be->mode == PR_MODE_HTTP || be->mode == PR_MODE_SPOP;
|
||||
}
|
||||
|
||||
#endif /* _HAPROXY_BACKEND_H */
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -40,23 +40,6 @@
|
|||
#define DPRINTF(x...)
|
||||
#endif
|
||||
|
||||
/* Let's make DEBUG_STRESS equal to zero if not set or not valid, or to
|
||||
* 1 if set. This way it is always set and should be easy to use in "if ()"
|
||||
* statements without requiring ifdefs, while remaining compatible with
|
||||
* "#if DEBUG_STRESS > 0". We also force DEBUG_STRICT and DEBUG_STRICT_ACTION
|
||||
* when stressed.
|
||||
*/
|
||||
#if !defined(DEBUG_STRESS)
|
||||
# define DEBUG_STRESS 0
|
||||
#elif DEBUG_STRESS != 0
|
||||
# undef DEBUG_STRESS
|
||||
# define DEBUG_STRESS 1 // make sure comparison >0 always works
|
||||
# undef DEBUG_STRICT
|
||||
# define DEBUG_STRICT 2 // enable BUG_ON
|
||||
# undef DEBUG_STRICT_ACTION
|
||||
# define DEBUG_STRICT_ACTION 3 // enable crash on match
|
||||
#endif
|
||||
|
||||
#define DUMP_TRACE() do { extern void ha_backtrace_to_stderr(void); ha_backtrace_to_stderr(); } while (0)
|
||||
|
||||
/* First, let's try to handle some arch-specific crashing methods. We prefer
|
||||
|
|
@ -85,7 +68,7 @@
|
|||
#else // not x86
|
||||
|
||||
/* generic implementation, causes a segfault */
|
||||
static inline __attribute((always_inline,noreturn,unused)) void ha_crash_now(void)
|
||||
static inline __attribute((always_inline)) void ha_crash_now(void)
|
||||
{
|
||||
#if __GNUC_PREREQ__(5, 0)
|
||||
#pragma GCC diagnostic push
|
||||
|
|
@ -424,20 +407,6 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S
|
|||
# define COUNT_IF_HOT(cond, ...) DISGUISE(cond)
|
||||
#endif
|
||||
|
||||
/* turn BUG_ON_STRESS() into a real statement when DEBUG_STRESS is set,
|
||||
* otherwise simply ignore it, at the risk of failing to notice if the
|
||||
* condition would build at all. We don't really care if BUG_ON_STRESS
|
||||
* doesn't always build, because it's meant to be used only in certain
|
||||
* scenarios, possibly requiring certain combinations of options. We
|
||||
* just want to be certain that the condition is not implemented at all
|
||||
* when not used, so as to encourage developers to put a lot of them at
|
||||
* zero cost.
|
||||
*/
|
||||
#if DEBUG_STRESS > 0
|
||||
# define BUG_ON_STRESS(cond, ...) BUG_ON(cond, __VA_ARGS__)
|
||||
#else
|
||||
# define BUG_ON_STRESS(cond, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
/* When not optimizing, clang won't remove that code, so only compile it in when optimizing */
|
||||
#if defined(__GNUC__) && defined(__OPTIMIZE__)
|
||||
|
|
@ -537,7 +506,7 @@ struct mem_stats {
|
|||
size_t size;
|
||||
struct ha_caller caller;
|
||||
const void *extra; // extra info specific to this call (e.g. pool ptr)
|
||||
} ALIGNED(sizeof(void*));
|
||||
} __attribute__((aligned(sizeof(void*))));
|
||||
|
||||
#undef calloc
|
||||
#define calloc(x,y) ({ \
|
||||
|
|
@ -651,172 +620,9 @@ struct mem_stats {
|
|||
_HA_ATOMIC_ADD(&_.size, __y); \
|
||||
strdup(__x); \
|
||||
})
|
||||
|
||||
#undef ha_aligned_alloc
|
||||
#define ha_aligned_alloc(a,s) ({ \
|
||||
size_t __a = (a); \
|
||||
size_t __s = (s); \
|
||||
static struct mem_stats _ __attribute__((used,__section__("mem_stats"),__aligned__(sizeof(void*)))) = { \
|
||||
.caller = { \
|
||||
.file = __FILE__, .line = __LINE__, \
|
||||
.what = MEM_STATS_TYPE_MALLOC, \
|
||||
.func = __func__, \
|
||||
}, \
|
||||
}; \
|
||||
HA_WEAK(__start_mem_stats); \
|
||||
HA_WEAK(__stop_mem_stats); \
|
||||
_HA_ATOMIC_INC(&_.calls); \
|
||||
_HA_ATOMIC_ADD(&_.size, __s); \
|
||||
_ha_aligned_alloc(__a, __s); \
|
||||
})
|
||||
|
||||
#undef ha_aligned_zalloc
|
||||
#define ha_aligned_zalloc(a,s) ({ \
|
||||
size_t __a = (a); \
|
||||
size_t __s = (s); \
|
||||
static struct mem_stats _ __attribute__((used,__section__("mem_stats"),__aligned__(sizeof(void*)))) = { \
|
||||
.caller = { \
|
||||
.file = __FILE__, .line = __LINE__, \
|
||||
.what = MEM_STATS_TYPE_CALLOC, \
|
||||
.func = __func__, \
|
||||
}, \
|
||||
}; \
|
||||
HA_WEAK(__start_mem_stats); \
|
||||
HA_WEAK(__stop_mem_stats); \
|
||||
_HA_ATOMIC_INC(&_.calls); \
|
||||
_HA_ATOMIC_ADD(&_.size, __s); \
|
||||
_ha_aligned_zalloc(__a, __s); \
|
||||
})
|
||||
|
||||
#undef ha_aligned_alloc_safe
|
||||
#define ha_aligned_alloc_safe(a,s) ({ \
|
||||
size_t __a = (a); \
|
||||
size_t __s = (s); \
|
||||
static struct mem_stats _ __attribute__((used,__section__("mem_stats"),__aligned__(sizeof(void*)))) = { \
|
||||
.caller = { \
|
||||
.file = __FILE__, .line = __LINE__, \
|
||||
.what = MEM_STATS_TYPE_MALLOC, \
|
||||
.func = __func__, \
|
||||
}, \
|
||||
}; \
|
||||
HA_WEAK(__start_mem_stats); \
|
||||
HA_WEAK(__stop_mem_stats); \
|
||||
_HA_ATOMIC_INC(&_.calls); \
|
||||
_HA_ATOMIC_ADD(&_.size, __s); \
|
||||
_ha_aligned_alloc_safe(__a, __s); \
|
||||
})
|
||||
|
||||
#undef ha_aligned_zalloc_safe
|
||||
#define ha_aligned_zalloc_safe(a,s) ({ \
|
||||
size_t __a = (a); \
|
||||
size_t __s = (s); \
|
||||
static struct mem_stats _ __attribute__((used,__section__("mem_stats"),__aligned__(sizeof(void*)))) = { \
|
||||
.caller = { \
|
||||
.file = __FILE__, .line = __LINE__, \
|
||||
.what = MEM_STATS_TYPE_CALLOC, \
|
||||
.func = __func__, \
|
||||
}, \
|
||||
}; \
|
||||
HA_WEAK(__start_mem_stats); \
|
||||
HA_WEAK(__stop_mem_stats); \
|
||||
_HA_ATOMIC_INC(&_.calls); \
|
||||
_HA_ATOMIC_ADD(&_.size, __s); \
|
||||
_ha_aligned_zalloc_safe(__a, __s); \
|
||||
})
|
||||
|
||||
// Since the type is known, the .extra field will contain its name
|
||||
#undef ha_aligned_alloc_typed
|
||||
#define ha_aligned_alloc_typed(cnt,type) ({ \
|
||||
size_t __a = __alignof__(type); \
|
||||
size_t __s = ((size_t)cnt) * sizeof(type); \
|
||||
static struct mem_stats _ __attribute__((used,__section__("mem_stats"),__aligned__(sizeof(void*)))) = { \
|
||||
.caller = { \
|
||||
.file = __FILE__, .line = __LINE__, \
|
||||
.what = MEM_STATS_TYPE_MALLOC, \
|
||||
.func = __func__, \
|
||||
}, \
|
||||
.extra = #type, \
|
||||
}; \
|
||||
HA_WEAK(__start_mem_stats); \
|
||||
HA_WEAK(__stop_mem_stats); \
|
||||
_HA_ATOMIC_INC(&_.calls); \
|
||||
_HA_ATOMIC_ADD(&_.size, __s); \
|
||||
(type*)_ha_aligned_alloc(__a, __s); \
|
||||
})
|
||||
|
||||
// Since the type is known, the .extra field will contain its name
|
||||
#undef ha_aligned_zalloc_typed
|
||||
#define ha_aligned_zalloc_typed(cnt,type) ({ \
|
||||
size_t __a = __alignof__(type); \
|
||||
size_t __s = ((size_t)cnt) * sizeof(type); \
|
||||
static struct mem_stats _ __attribute__((used,__section__("mem_stats"),__aligned__(sizeof(void*)))) = { \
|
||||
.caller = { \
|
||||
.file = __FILE__, .line = __LINE__, \
|
||||
.what = MEM_STATS_TYPE_CALLOC, \
|
||||
.func = __func__, \
|
||||
}, \
|
||||
.extra = #type, \
|
||||
}; \
|
||||
HA_WEAK(__start_mem_stats); \
|
||||
HA_WEAK(__stop_mem_stats); \
|
||||
_HA_ATOMIC_INC(&_.calls); \
|
||||
_HA_ATOMIC_ADD(&_.size, __s); \
|
||||
(type*)_ha_aligned_zalloc_safe(__a, __s); \
|
||||
})
|
||||
|
||||
#undef ha_aligned_free
|
||||
#define ha_aligned_free(x) ({ \
|
||||
typeof(x) __x = (x); \
|
||||
static struct mem_stats _ __attribute__((used,__section__("mem_stats"),__aligned__(sizeof(void*)))) = { \
|
||||
.caller = { \
|
||||
.file = __FILE__, .line = __LINE__, \
|
||||
.what = MEM_STATS_TYPE_FREE, \
|
||||
.func = __func__, \
|
||||
}, \
|
||||
}; \
|
||||
HA_WEAK(__start_mem_stats); \
|
||||
HA_WEAK(__stop_mem_stats); \
|
||||
if (__builtin_constant_p((x))) { \
|
||||
HA_LINK_ERROR(call_to_ha_aligned_free_attempts_to_free_a_constant); \
|
||||
} \
|
||||
if (__x) \
|
||||
_HA_ATOMIC_INC(&_.calls); \
|
||||
_ha_aligned_free(__x); \
|
||||
})
|
||||
|
||||
#undef ha_aligned_free_size
|
||||
#define ha_aligned_free_size(p,s) ({ \
|
||||
void *__p = (p); size_t __s = (s); \
|
||||
static struct mem_stats _ __attribute__((used,__section__("mem_stats"),__aligned__(sizeof(void*)))) = { \
|
||||
.caller = { \
|
||||
.file = __FILE__, .line = __LINE__, \
|
||||
.what = MEM_STATS_TYPE_FREE, \
|
||||
.func = __func__, \
|
||||
}, \
|
||||
}; \
|
||||
HA_WEAK(__start_mem_stats); \
|
||||
HA_WEAK(__stop_mem_stats); \
|
||||
if (__builtin_constant_p((p))) { \
|
||||
HA_LINK_ERROR(call_to_ha_aligned_free_attempts_to_free_a_constant); \
|
||||
} \
|
||||
if (__p) { \
|
||||
_HA_ATOMIC_INC(&_.calls); \
|
||||
_HA_ATOMIC_ADD(&_.size, __s); \
|
||||
} \
|
||||
_ha_aligned_free(__p); \
|
||||
})
|
||||
|
||||
#else // DEBUG_MEM_STATS
|
||||
|
||||
#define will_free(x, y) do { } while (0)
|
||||
#define ha_aligned_alloc(a,s) _ha_aligned_alloc(a, s)
|
||||
#define ha_aligned_zalloc(a,s) _ha_aligned_zalloc(a, s)
|
||||
#define ha_aligned_alloc_safe(a,s) _ha_aligned_alloc_safe(a, s)
|
||||
#define ha_aligned_zalloc_safe(a,s) _ha_aligned_zalloc_safe(a, s)
|
||||
#define ha_aligned_alloc_typed(cnt,type) ((type*)_ha_aligned_alloc(__alignof__(type), ((size_t)cnt) * sizeof(type)))
|
||||
#define ha_aligned_zalloc_typed(cnt,type) ((type*)_ha_aligned_zalloc(__alignof__(type), ((size_t)cnt) * sizeof(type)))
|
||||
#define ha_aligned_free(p) _ha_aligned_free(p)
|
||||
#define ha_aligned_free_size(p,s) _ha_aligned_free(p)
|
||||
|
||||
#endif /* DEBUG_MEM_STATS*/
|
||||
|
||||
|
|
|
|||
46
include/haproxy/cbuf-t.h
Normal file
46
include/haproxy/cbuf-t.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* include/haprox/cbuf-t.h
|
||||
* This file contains definition for circular buffers.
|
||||
*
|
||||
* Copyright 2021 HAProxy Technologies, Frederic Lecaille <flecaille@haproxy.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation, version 2.1
|
||||
* exclusively.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _HAPROXY_CBUF_T_H
|
||||
#define _HAPROXY_CBUF_T_H
|
||||
#ifdef USE_QUIC
|
||||
#ifndef USE_OPENSSL
|
||||
#error "Must define USE_OPENSSL"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <haproxy/list-t.h>
|
||||
|
||||
extern struct pool_head *pool_head_cbuf;
|
||||
|
||||
struct cbuf {
|
||||
/* buffer */
|
||||
unsigned char *buf;
|
||||
/* buffer size */
|
||||
size_t sz;
|
||||
/* Writer index */
|
||||
size_t wr;
|
||||
/* Reader index */
|
||||
size_t rd;
|
||||
};
|
||||
|
||||
#endif /* _HAPROXY_CBUF_T_H */
|
||||
136
include/haproxy/cbuf.h
Normal file
136
include/haproxy/cbuf.h
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* include/haprox/cbuf.h
|
||||
* This file contains definitions and prototypes for circular buffers.
|
||||
* Inspired from Linux circular buffers (include/linux/circ_buf.h).
|
||||
*
|
||||
* Copyright 2021 HAProxy Technologies, Frederic Lecaille <flecaille@haproxy.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation, version 2.1
|
||||
* exclusively.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _HAPROXY_CBUF_H
|
||||
#define _HAPROXY_CBUF_H
|
||||
#ifdef USE_QUIC
|
||||
#ifndef USE_OPENSSL
|
||||
#error "Must define USE_OPENSSL"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <haproxy/atomic.h>
|
||||
#include <haproxy/list.h>
|
||||
#include <haproxy/cbuf-t.h>
|
||||
|
||||
struct cbuf *cbuf_new(unsigned char *buf, size_t sz);
|
||||
void cbuf_free(struct cbuf *cbuf);
|
||||
|
||||
/* Amount of data between <rd> and <wr> */
|
||||
#define CBUF_DATA(wr, rd, size) (((wr) - (rd)) & ((size) - 1))
|
||||
|
||||
/* Return the writer position in <cbuf>.
|
||||
* To be used only by the writer!
|
||||
*/
|
||||
static inline unsigned char *cb_wr(struct cbuf *cbuf)
|
||||
{
|
||||
return cbuf->buf + cbuf->wr;
|
||||
}
|
||||
|
||||
/* Reset the reader index.
|
||||
* To be used by a reader!
|
||||
*/
|
||||
static inline void cb_rd_reset(struct cbuf *cbuf)
|
||||
{
|
||||
cbuf->rd = 0;
|
||||
}
|
||||
|
||||
/* Reset the writer index.
|
||||
* To be used by a writer!
|
||||
*/
|
||||
static inline void cb_wr_reset(struct cbuf *cbuf)
|
||||
{
|
||||
cbuf->wr = 0;
|
||||
}
|
||||
|
||||
/* Increase <cbuf> circular buffer data by <count>.
|
||||
* To be used by a writer!
|
||||
*/
|
||||
static inline void cb_add(struct cbuf *cbuf, size_t count)
|
||||
{
|
||||
cbuf->wr = (cbuf->wr + count) & (cbuf->sz - 1);
|
||||
}
|
||||
|
||||
/* Return the reader position in <cbuf>.
|
||||
* To be used only by the reader!
|
||||
*/
|
||||
static inline unsigned char *cb_rd(struct cbuf *cbuf)
|
||||
{
|
||||
return cbuf->buf + cbuf->rd;
|
||||
}
|
||||
|
||||
/* Skip <count> byte in <cbuf> circular buffer.
|
||||
* To be used by a reader!
|
||||
*/
|
||||
static inline void cb_del(struct cbuf *cbuf, size_t count)
|
||||
{
|
||||
cbuf->rd = (cbuf->rd + count) & (cbuf->sz - 1);
|
||||
}
|
||||
|
||||
/* Return the amount of data left in <cbuf>.
|
||||
* To be used only by the writer!
|
||||
*/
|
||||
static inline size_t cb_data(struct cbuf *cbuf)
|
||||
{
|
||||
size_t rd;
|
||||
|
||||
rd = HA_ATOMIC_LOAD(&cbuf->rd);
|
||||
return CBUF_DATA(cbuf->wr, rd, cbuf->sz);
|
||||
}
|
||||
|
||||
/* Return the amount of room left in <cbuf> minus 1 to distinguish
|
||||
* the case where the buffer is full from the case where is is empty
|
||||
* To be used only by the write!
|
||||
*/
|
||||
static inline size_t cb_room(struct cbuf *cbuf)
|
||||
{
|
||||
size_t rd;
|
||||
|
||||
rd = HA_ATOMIC_LOAD(&cbuf->rd);
|
||||
return CBUF_DATA(rd, cbuf->wr + 1, cbuf->sz);
|
||||
}
|
||||
|
||||
/* Return the amount of contiguous data left in <cbuf>.
|
||||
* To be used only by the reader!
|
||||
*/
|
||||
static inline size_t cb_contig_data(struct cbuf *cbuf)
|
||||
{
|
||||
size_t end, n;
|
||||
|
||||
end = cbuf->sz - cbuf->rd;
|
||||
n = (HA_ATOMIC_LOAD(&cbuf->wr) + end) & (cbuf->sz - 1);
|
||||
return n < end ? n : end;
|
||||
}
|
||||
|
||||
/* Return the amount of contiguous space left in <cbuf>.
|
||||
* To be used only by the writer!
|
||||
*/
|
||||
static inline size_t cb_contig_space(struct cbuf *cbuf)
|
||||
{
|
||||
size_t end, n;
|
||||
|
||||
end = cbuf->sz - 1 - cbuf->wr;
|
||||
n = (HA_ATOMIC_LOAD(&cbuf->rd) + end) & (cbuf->sz - 1);
|
||||
return n <= end ? n : end + 1;
|
||||
}
|
||||
|
||||
#endif /* _HAPROXY_CBUF_H */
|
||||
|
|
@ -54,8 +54,6 @@ enum cond_predicate {
|
|||
CFG_PRED_OSSL_VERSION_ATLEAST, // "openssl_version_atleast"
|
||||
CFG_PRED_OSSL_VERSION_BEFORE, // "openssl_version_before"
|
||||
CFG_PRED_SSLLIB_NAME_STARTSWITH, // "ssllib_name_startswith"
|
||||
CFG_PRED_AWSLC_API_ATLEAST, // "awslc_api_atleast"
|
||||
CFG_PRED_AWSLC_API_BEFORE, // "awslc_api_before"
|
||||
CFG_PRED_ENABLED, // "enabled"
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ extern char *cursection;
|
|||
extern int non_global_section_parsed;
|
||||
|
||||
extern struct proxy *curproxy;
|
||||
extern struct proxy *last_defproxy;
|
||||
extern char initial_cwd[PATH_MAX];
|
||||
|
||||
int cfg_parse_global(const char *file, int linenum, char **args, int inv);
|
||||
|
|
@ -141,7 +140,7 @@ int warnif_misplaced_tcp_req_sess(struct proxy *proxy, const char *file, int lin
|
|||
int warnif_misplaced_tcp_req_cont(struct proxy *proxy, const char *file, int line, const char *arg, const char *arg2);
|
||||
int warnif_misplaced_tcp_res_cont(struct proxy *proxy, const char *file, int line, const char *arg, const char *arg2);
|
||||
int warnif_misplaced_quic_init(struct proxy *proxy, const char *file, int line, const char *arg, const char *arg2);
|
||||
int warnif_cond_conflicts(const struct acl_cond *cond, unsigned int where, char **err);
|
||||
int warnif_cond_conflicts(const struct acl_cond *cond, unsigned int where, const char *file, int line);
|
||||
int warnif_tcp_http_cond(const struct proxy *px, const struct acl_cond *cond);
|
||||
int too_many_args_idx(int maxarg, int index, char **args, char **msg, int *err_code);
|
||||
int too_many_args(int maxarg, char **args, char **msg, int *err_code);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include <haproxy/api-t.h>
|
||||
#include <haproxy/buf-t.h>
|
||||
#include <haproxy/filters-t.h>
|
||||
#include <haproxy/show_flags-t.h>
|
||||
|
||||
/* The CF_* macros designate Channel Flags, which may be ORed in the bit field
|
||||
|
|
@ -205,8 +204,8 @@ struct channel {
|
|||
unsigned short last_read; /* 16 lower bits of last read date (max pause=65s) */
|
||||
unsigned char xfer_large; /* number of consecutive large xfers */
|
||||
unsigned char xfer_small; /* number of consecutive small xfers */
|
||||
unsigned long long total; /* total data read */
|
||||
int analyse_exp; /* expiration date for current analysers (if set) */
|
||||
struct chn_flt flt; /* current state of filters active on this channel */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -323,6 +323,7 @@ static inline void channel_init(struct channel *chn)
|
|||
chn->to_forward = 0;
|
||||
chn->last_read = now_ms;
|
||||
chn->xfer_small = chn->xfer_large = 0;
|
||||
chn->total = 0;
|
||||
chn->analysers = 0;
|
||||
chn->flags = 0;
|
||||
chn->output = 0;
|
||||
|
|
@ -376,7 +377,7 @@ static inline void channel_add_input(struct channel *chn, unsigned int len)
|
|||
c_adv(chn, fwd);
|
||||
}
|
||||
/* notify that some data was read */
|
||||
chn_prod(chn)->bytes_in += len;
|
||||
chn->total += len;
|
||||
chn->flags |= CF_READ_EVENT;
|
||||
}
|
||||
|
||||
|
|
@ -788,12 +789,8 @@ static inline int channel_recv_max(const struct channel *chn)
|
|||
*/
|
||||
static inline size_t channel_data_limit(const struct channel *chn)
|
||||
{
|
||||
size_t max = (global.tune.bufsize - global.tune.maxrewrite);
|
||||
|
||||
size_t max;
|
||||
|
||||
if (!c_size(chn))
|
||||
return 0;
|
||||
max = (c_size(chn) - global.tune.maxrewrite);
|
||||
if (IS_HTX_STRM(chn_strm(chn)))
|
||||
max -= HTX_BUF_OVERHEAD;
|
||||
return max;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <haproxy/connection-t.h>
|
||||
#include <haproxy/dynbuf-t.h>
|
||||
#include <haproxy/obj_type-t.h>
|
||||
#include <haproxy/tools-t.h>
|
||||
#include <haproxy/vars-t.h>
|
||||
|
||||
/* Please note: this file tends to commonly be part of circular dependencies,
|
||||
|
|
@ -60,7 +59,6 @@ enum chk_result {
|
|||
#define CHK_ST_FASTINTER 0x0400 /* force fastinter check */
|
||||
#define CHK_ST_READY 0x0800 /* check ready to migrate or run, see below */
|
||||
#define CHK_ST_SLEEPING 0x1000 /* check was sleeping, i.e. not currently bound to a thread, see below */
|
||||
#define CHK_ST_USE_SMALL_BUFF 0x2000 /* Use small buffers if possible for the request */
|
||||
|
||||
/* 4 possible states for CHK_ST_SLEEPING and CHK_ST_READY:
|
||||
* SLP RDY State Description
|
||||
|
|
@ -156,7 +154,7 @@ enum {
|
|||
};
|
||||
|
||||
struct tcpcheck_rule;
|
||||
struct tcpcheck;
|
||||
struct tcpcheck_rules;
|
||||
|
||||
struct check {
|
||||
enum obj_type obj_type; /* object type == OBJ_TYPE_CHECK */
|
||||
|
|
@ -175,7 +173,7 @@ struct check {
|
|||
signed char use_ssl; /* use SSL for health checks (1: on, 0: server mode, -1: off) */
|
||||
int send_proxy; /* send a PROXY protocol header with checks */
|
||||
int reuse_pool; /* try to reuse idle connections */
|
||||
struct tcpcheck *tcpcheck; /* tcp-check to use to perform a health-check */
|
||||
struct tcpcheck_rules *tcpcheck_rules; /* tcp-check send / expect rules */
|
||||
struct tcpcheck_rule *current_step; /* current step when using tcpcheck */
|
||||
int inter, fastinter, downinter; /* checks: time in milliseconds */
|
||||
enum chk_result result; /* health-check result : CHK_RES_* */
|
||||
|
|
@ -190,8 +188,6 @@ struct check {
|
|||
char **envp; /* the environment to use if running a process-based check */
|
||||
struct pid_list *curpid; /* entry in pid_list used for current process-based test, or -1 if not in test */
|
||||
struct sockaddr_storage addr; /* the address to check */
|
||||
struct net_addr_type addr_type; /* Address type (dgram/stream for both protocol and XPRT) */
|
||||
int alt_proto; /* Needed to know exactly which protocol we are after */
|
||||
char *pool_conn_name; /* conn name used on reuse */
|
||||
char *sni; /* Server name */
|
||||
char *alpn_str; /* ALPN to use for checks */
|
||||
|
|
|
|||
|
|
@ -78,11 +78,12 @@ struct task *process_chk(struct task *t, void *context, unsigned int state);
|
|||
struct task *srv_chk_io_cb(struct task *t, void *ctx, unsigned int state);
|
||||
|
||||
int check_buf_available(void *target);
|
||||
struct buffer *check_get_buf(struct check *check, struct buffer *bptr, unsigned int small_buffer);
|
||||
struct buffer *check_get_buf(struct check *check, struct buffer *bptr);
|
||||
void check_release_buf(struct check *check, struct buffer *bptr);
|
||||
const char *init_check(struct check *check, int type);
|
||||
void free_check(struct check *check);
|
||||
void check_purge(struct check *check);
|
||||
int wake_srv_chk(struct stconn *sc);
|
||||
|
||||
int init_srv_check(struct server *srv);
|
||||
int init_srv_agent_check(struct server *srv);
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
|
||||
extern struct pool_head *pool_head_trash;
|
||||
extern struct pool_head *pool_head_large_trash;
|
||||
extern struct pool_head *pool_head_small_trash;
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
|
|
@ -48,10 +46,6 @@ int chunk_asciiencode(struct buffer *dst, struct buffer *src, char qc);
|
|||
int chunk_strcmp(const struct buffer *chk, const char *str);
|
||||
int chunk_strcasecmp(const struct buffer *chk, const char *str);
|
||||
struct buffer *get_trash_chunk(void);
|
||||
struct buffer *get_large_trash_chunk(void);
|
||||
struct buffer *get_small_trash_chunk(void);
|
||||
struct buffer *get_trash_chunk_sz(size_t size);
|
||||
struct buffer *get_larger_trash_chunk(struct buffer *chunk);
|
||||
int init_trash_buffers(int first);
|
||||
|
||||
static inline void chunk_reset(struct buffer *chk)
|
||||
|
|
@ -112,80 +106,12 @@ static forceinline struct buffer *alloc_trash_chunk(void)
|
|||
return chunk;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a large trash chunk from the reentrant pool. The buffer starts at
|
||||
* the end of the chunk. This chunk must be freed using free_trash_chunk(). This
|
||||
* call may fail and the caller is responsible for checking that the returned
|
||||
* pointer is not NULL.
|
||||
*/
|
||||
static forceinline struct buffer *alloc_large_trash_chunk(void)
|
||||
{
|
||||
struct buffer *chunk;
|
||||
|
||||
if (!pool_head_large_trash)
|
||||
return NULL;
|
||||
|
||||
chunk = pool_alloc(pool_head_large_trash);
|
||||
if (chunk) {
|
||||
char *buf = (char *)chunk + sizeof(struct buffer);
|
||||
*buf = 0;
|
||||
chunk_init(chunk, buf,
|
||||
pool_head_large_trash->size - sizeof(struct buffer));
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a small trash chunk from the reentrant pool. The buffer starts at
|
||||
* the end of the chunk. This chunk must be freed using free_trash_chunk(). This
|
||||
* call may fail and the caller is responsible for checking that the returned
|
||||
* pointer is not NULL.
|
||||
*/
|
||||
static forceinline struct buffer *alloc_small_trash_chunk(void)
|
||||
{
|
||||
struct buffer *chunk;
|
||||
|
||||
if (!pool_head_small_trash)
|
||||
return NULL;
|
||||
|
||||
chunk = pool_alloc(pool_head_small_trash);
|
||||
if (chunk) {
|
||||
char *buf = (char *)chunk + sizeof(struct buffer);
|
||||
*buf = 0;
|
||||
chunk_init(chunk, buf,
|
||||
pool_head_small_trash->size - sizeof(struct buffer));
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a trash chunk accordingly to the requested size. This chunk must be
|
||||
* freed using free_trash_chunk(). This call may fail and the caller is
|
||||
* responsible for checking that the returned pointer is not NULL.
|
||||
*/
|
||||
static forceinline struct buffer *alloc_trash_chunk_sz(size_t size)
|
||||
{
|
||||
if (pool_head_small_trash && size <= pool_head_small_trash->size)
|
||||
return alloc_small_trash_chunk();
|
||||
else if (size <= pool_head_trash->size)
|
||||
return alloc_trash_chunk();
|
||||
else if (pool_head_large_trash && size <= pool_head_large_trash->size)
|
||||
return alloc_large_trash_chunk();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* free a trash chunk allocated by alloc_trash_chunk(). NOP on NULL.
|
||||
*/
|
||||
static forceinline void free_trash_chunk(struct buffer *chunk)
|
||||
{
|
||||
if (pool_head_small_trash && chunk && chunk->size == pool_head_small_trash->size - sizeof(struct buffer))
|
||||
pool_free(pool_head_small_trash, chunk);
|
||||
else if (pool_head_large_trash && chunk && chunk->size == pool_head_large_trash->size - sizeof(struct buffer))
|
||||
pool_free(pool_head_large_trash, chunk);
|
||||
else
|
||||
pool_free(pool_head_trash, chunk);
|
||||
pool_free(pool_head_trash, chunk);
|
||||
}
|
||||
|
||||
/* copies chunk <src> into <chk>. Returns 0 in case of failure. */
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#define _HAPROXY_CLI_T_H
|
||||
|
||||
#include <haproxy/applet-t.h>
|
||||
#include <haproxy/tinfo-t.h>
|
||||
|
||||
/* Access level for a stats socket (appctx->cli_ctx.level) */
|
||||
#define ACCESS_LVL_NONE 0x0000
|
||||
|
|
@ -48,7 +47,6 @@
|
|||
#define APPCTX_CLI_ST1_INTER (1 << 3) /* interactive mode (i.e. don't close after 1st cmd) */
|
||||
#define APPCTX_CLI_ST1_PROMPT (1 << 4) /* display prompt */
|
||||
#define APPCTX_CLI_ST1_TIMED (1 << 5) /* display timer in prompt */
|
||||
#define APPCTX_CLI_ST1_YIELD (1 << 6) /* forced yield between commands */
|
||||
|
||||
#define CLI_PREFIX_KW_NB 5
|
||||
#define CLI_MAX_MATCHES 5
|
||||
|
|
@ -101,7 +99,6 @@ enum cli_wait_err {
|
|||
enum cli_wait_cond {
|
||||
CLI_WAIT_COND_NONE, // no condition to wait on
|
||||
CLI_WAIT_COND_SRV_UNUSED,// wait for server to become unused
|
||||
CLI_WAIT_COND_BE_UNUSED, // wait for backend to become unused
|
||||
};
|
||||
|
||||
struct cli_wait_ctx {
|
||||
|
|
@ -121,8 +118,6 @@ struct cli_kw {
|
|||
void (*io_release)(struct appctx *appctx);
|
||||
void *private;
|
||||
int level; /* this is the level needed to show the keyword usage and to use it */
|
||||
/* 4-byte hole here */
|
||||
struct thread_exec_ctx exec_ctx; /* execution context */
|
||||
};
|
||||
|
||||
struct cli_kw_list {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
extern struct timeval start_date; /* the process's start date in wall-clock time */
|
||||
extern struct timeval ready_date; /* date when the process was considered ready */
|
||||
extern ullong start_time_ns; /* the process's start date in internal monotonic time (ns) */
|
||||
extern volatile ullong *global_now_ns;/* common monotonic date between all threads, in ns (wraps every 585 yr) */
|
||||
extern volatile ullong global_now_ns; /* common monotonic date between all threads, in ns (wraps every 585 yr) */
|
||||
|
||||
extern THREAD_LOCAL ullong now_ns; /* internal monotonic date derived from real clock, in ns (wraps every 585 yr) */
|
||||
extern THREAD_LOCAL struct timeval date; /* the real current date (wall-clock time) */
|
||||
|
|
@ -49,8 +49,6 @@ uint clock_report_idle(void);
|
|||
void clock_leaving_poll(int timeout, int interrupted);
|
||||
void clock_entering_poll(void);
|
||||
void clock_adjust_now_offset(void);
|
||||
void clock_set_now_offset(llong ofs);
|
||||
llong clock_get_now_offset(void);
|
||||
|
||||
static inline void clock_update_date(int max_wait, int interrupted)
|
||||
{
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue