Skip to content

Commit 92ab16a

Browse files
authored
Merge branch 'isc-projects:master' into master
2 parents f377dc2 + 0411c88 commit 92ab16a

File tree

2,365 files changed

+249224
-114131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,365 files changed

+249224
-114131
lines changed

.clang-format

+3-4
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ IncludeCategories:
5050
- Regex: '^<config.h>$'
5151
Priority: 0
5252
# Kea's own files
53-
- Regex: '^<(asiodns|asiolink|cc|cfgrpt|config|config_backend|cryptolink|database|dhcp|dhcpsrv|dhcp_ddns|dns|eval|exceptions|hooks|http|log|mysql|pgsql|process|stats|testutils|util|yang|admin|agent|d2|dhcp4|dhcp6|keactrl|lfc|netconf|perfdhcp|shell)/'
53+
- Regex: '^<(asiodns|asiolink|cc|config|config_backend|cryptolink|database|dhcp|dhcpsrv|dhcp_ddns|dns|eval|exceptions|hooks|http|log|mysql|pgsql|process|stats|testutils|util|yang|admin|agent|d2|dhcp4|dhcp6|keactrl|lfc|netconf|perfdhcp|shell|limits)/'
5454
Priority: 1
5555
# C++ standard library headers
56-
- Regex: '^<[[:alnum:]]>$'
56+
- Regex: '^<[_[:alnum:]]+>$'
5757
Priority: 2
5858
# boost headers
5959
- Regex: '^<boost/'
6060
Priority: 3
6161
# C headers
62-
- Regex: '^<[[:alnum:]].h>$'
62+
- Regex: '^<[/_[:alnum:]]+\.h>$'
6363
Priority: 4
6464
# everything else
6565
- Regex: '.*'
@@ -69,7 +69,6 @@ IndentFunctionDeclarationAfterType: false
6969
IndentWidth: 4
7070
IndentWrappedFunctionNames: false
7171
KeepEmptyLinesAtTheStartOfBlocks: false
72-
KeepEmptyLinesAtTheStartOfBlocks: true
7372
Language: Cpp
7473
MaxEmptyLinesToKeep: 1
7574
NamespaceIndentation: None

.github/workflows/codeql.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master", "ci" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "master", "ci" ]
9+
schedule:
10+
- cron: '41 12 * * 0'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: [ 'cpp', 'python' ]
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
30+
# Initializes the CodeQL tools for scanning.
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@v2
33+
with:
34+
languages: ${{ matrix.language }}
35+
# If you wish to specify custom queries, you can do so here or in a config file.
36+
# By default, queries listed here will override any specified in a config file.
37+
# Prefix the list here with "+" to use these queries and those in the config file.
38+
39+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
40+
# queries: security-extended,security-and-quality
41+
42+
43+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
44+
# If this step fails, then you should remove it and run the build manually (see below)
45+
- name: Install dependencies
46+
run: |
47+
./hammer.py prepare-system -p local -w docs,netconf,perfdhcp,shell,tls,unittest
48+
49+
- name: Inspect system CPU
50+
run: cat /proc/cpuinfo
51+
52+
# We want to enable shell, so python files are generated. And CodeQL can
53+
# check them.
54+
55+
# Flags skipped: --with-gssapi --with-freeradius
56+
- name: Build Kea
57+
run: |
58+
autoreconf -i
59+
./configure --enable-shell --enable-debug --enable-generate-docs --enable-generate-messages --enable-generate-parser --enable-logger-checks --enable-perfdhcp --enable-shell --with-libyang --with-libyang-cpp --with-openssl --with-sysrepo --with-sysrepo-cpp
60+
make -j2
61+
62+
# ℹ️ Command-line programs to run using the OS shell.
63+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
64+
65+
# If the Autobuild fails above, remove it and uncomment the following three lines.
66+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
67+
68+
# - run: |
69+
# echo "Run, Build Application using script"
70+
# ./location_of_script_within_repo/buildscript.sh
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v2
74+
with:
75+
category: "/language:${{matrix.language}}"

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ config.h.in~
3434
/ltmain.sh
3535
/missing
3636
/py-compile
37-
/stamp-h1
37+
/stamp-h*
3838
/test-driver
3939
/ylwrap
4040
/kea_version.h

.gitlab-ci.yml

+59-113
Original file line numberDiff line numberDiff line change
@@ -4,164 +4,110 @@ variables:
44

55
CI_REGISTRY_IMAGE: registry.gitlab.isc.org/isc-projects/kea
66

7-
# Disabled shellcheck warnings:
8-
# SC1117: Backslash is literal in "\/". Prefer explicit escaping: "\\/".
9-
# SC2039: In POSIX sh, 'local' is undefined.
10-
# SC3043: In POSIX sh, 'local' is undefined.
11-
SHELLCHECK_OPTS: "--exclude=SC1117 --exclude=SC2039 --exclude=SC3043"
12-
137
# Setting this variable will affect all Security templates
148
# (SAST, Dependency Scanning, ...)
159
SECURE_ANALYZERS_PREFIX: "registry.gitlab.com/gitlab-org/security-products/analyzers"
1610

1711
# Leave only bandit, flawfinder, semgrep.
1812
SAST_EXCLUDED_ANALYZERS: "eslint, spotbugs"
1913

14+
image: "${CI_REGISTRY_IMAGE}:latest"
15+
2016
stages:
2117
- test
2218

23-
shellcheck:
19+
are-database-scripts-in-sync:
20+
stage: test
21+
script:
22+
- ./src/share/database/scripts/utils/are-scripts-in-sync.py
23+
24+
check-for-json-errors-in-doc:
2425
stage: test
25-
image: "${CI_REGISTRY_IMAGE}:latest"
26-
tags:
27-
- linux
28-
- amd64
2926
script:
30-
- SCRIPTS=
31-
- SCRIPTS+="src/bin/admin/admin-utils.sh "
32-
- SCRIPTS+="src/bin/admin/kea-admin.in "
33-
- SCRIPTS+="src/bin/admin/tests/admin_tests.sh.in "
34-
- SCRIPTS+="src/bin/admin/tests/memfile_tests.sh.in "
35-
- SCRIPTS+="src/bin/admin/tests/mysql_tests.sh.in "
36-
- SCRIPTS+="src/bin/admin/tests/pgsql_tests.sh.in "
37-
- SCRIPTS+="src/bin/agent/tests/ca_process_tests.sh.in "
38-
- SCRIPTS+="src/bin/d2/tests/d2_process_tests.sh.in "
39-
- SCRIPTS+="src/bin/dhcp4/tests/dhcp4_process_tests.sh.in "
40-
- SCRIPTS+="src/bin/dhcp6/tests/dhcp6_process_tests.sh.in "
41-
- SCRIPTS+="src/bin/keactrl/keactrl.conf.in "
42-
- SCRIPTS+="src/bin/keactrl/keactrl.in "
43-
- SCRIPTS+="src/bin/keactrl/tests/keactrl_tests.sh.in "
44-
- SCRIPTS+="src/bin/netconf/tests/shtests/netconf_tests.sh.in "
45-
- SCRIPTS+="src/bin/shell/tests/basic_auth_tests.sh.in "
46-
- SCRIPTS+="src/bin/shell/tests/shell_process_tests.sh.in "
47-
- SCRIPTS+="src/lib/asiolink/tests/process_spawn_app.sh.in "
48-
- SCRIPTS+="src/lib/log/tests/buffer_logger_test.sh.in "
49-
- SCRIPTS+="src/lib/log/tests/console_test.sh.in "
50-
- SCRIPTS+="src/lib/log/tests/destination_test.sh.in "
51-
- SCRIPTS+="src/lib/log/tests/init_logger_test.sh.in "
52-
- SCRIPTS+="src/lib/log/tests/local_file_test.sh.in "
53-
- SCRIPTS+="src/lib/log/tests/logger_lock_test.sh.in "
54-
- SCRIPTS+="src/lib/log/tests/severity_test.sh.in "
55-
- SCRIPTS+="src/lib/testutils/dhcp_test_lib.sh.in "
56-
- SCRIPTS+="src/lib/testutils/xml_reporting_test_lib.sh.in "
57-
- SCRIPTS+="src/hooks/dhcp/run_script/tests/run_script_test.sh.in "
58-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_001.0_to_002.0.sh.in "
59-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_002.0_to_003.0.sh.in "
60-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_003.0_to_004.0.sh.in "
61-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_004.0_to_004.1.sh.in "
62-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_004.1_to_005.0.sh.in "
63-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_005.0_to_005.1.sh.in "
64-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_005.1_to_005.2.sh.in "
65-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_005.2_to_006.0.sh.in "
66-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_006.0_to_007.0.sh.in "
67-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_007.0_to_008.0.sh.in "
68-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_008.0_to_008.1.sh.in "
69-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_008.1_to_008.2.sh.in "
70-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_008.2_to_009.0.sh.in "
71-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.0_to_009.1.sh.in "
72-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.1_to_009.2.sh.in "
73-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.2_to_009.3.sh.in "
74-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.3_to_009.4.sh.in "
75-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.4_to_009.5.sh.in "
76-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.5_to_009.6.sh.in "
77-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.6_to_010.0.sh.in "
78-
- SCRIPTS+="src/share/database/scripts/mysql/upgrade_010_to_011.sh.in "
79-
- SCRIPTS+="src/share/database/scripts/mysql/wipe_data.sh.in "
80-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_001.0_to_002.0.sh.in "
81-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_002.0_to_003.0.sh.in "
82-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_003.0_to_003.1.sh.in "
83-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_003.1_to_003.2.sh.in "
84-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_003.2_to_003.3.sh.in "
85-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_003.3_to_004.0.sh.in "
86-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_004.0_to_005.0.sh.in "
87-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_005.0_to_005.1.sh.in "
88-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_005.1_to_006.0.sh.in "
89-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_006.0_to_006.1.sh.in "
90-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_006.1_to_006.2.sh.in "
91-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_006.2_to_007.0.sh.in "
92-
- SCRIPTS+="src/share/database/scripts/pgsql/upgrade_007_to_008.sh.in "
93-
- SCRIPTS+="src/share/database/scripts/pgsql/wipe_data.sh.in "
94-
- SCRIPTS+="src/share/yang/modules/utils/check-hashes.sh "
95-
- SCRIPTS+="src/share/yang/modules/utils/check-revisions.sh "
96-
- SCRIPTS+="src/share/yang/modules/utils/gen-revisions.sh "
97-
- SCRIPTS+="src/share/yang/modules/utils/reinstall.sh.in "
98-
- SCRIPTS+="tools/add-config-h.sh "
99-
- SCRIPTS+="tools/bump-lib-versions.sh "
100-
- SCRIPTS+="tools/check-for-duplicate-includes.sh "
101-
- SCRIPTS+="tools/mk_cfgrpt.sh "
102-
- SCRIPTS+="tools/path_replacer.sh.in "
103-
- SCRIPTS+="tools/print-generated-files.sh "
104-
- SCRIPTS+="tools/shellcheck-all.sh "
105-
- SCRIPTS+="tools/tests_in_valgrind.sh "
106-
- shellcheck ${SCRIPTS} ${SHELLCHECK_OPTS}
27+
- ./tools/check-for-json-errors-in-doc.sh
10728

10829
danger:
10930
stage: test
110-
image: registry.gitlab.isc.org/isc-projects/stork/ci-danger
111-
tags:
112-
- linux
113-
- amd64
11431
before_script:
11532
- export CI_MERGE_REQUEST_ID=$(git ls-remote -q origin merge-requests\*\head | grep $CI_COMMIT_SHA | sed 's/.*refs\/merge-requests\/\([0-9]*\)\/head/\1/g')
11633
- export CI_PROJECT_PATH=$CI_PROJECT_ID #some version of gitlab has problems with searching by project path
11734
- export DANGER_GITLAB_HOST=gitlab.isc.org
11835
- export DANGER_GITLAB_API_BASE_URL=https://gitlab.isc.org/api/v4
11936
script:
120-
- sysctl -w net.ipv6.conf.all.disable_ipv6=1
121-
- sysctl -w net.ipv6.conf.default.disable_ipv6=1
122-
- gem install danger-commit_lint
12337
- danger --fail-on-errors=true --new-comment
12438

125-
dhcpdb_create-upgrade-consistency:
126-
allow_failure: false
39+
duplicate-includes:
40+
stage: test
41+
script:
42+
- ./tools/check-for-duplicate-includes.sh
43+
44+
duplicate-log-messages:
12745
stage: test
128-
image: "${CI_REGISTRY_IMAGE}:latest"
12946
script:
130-
- ./src/share/database/scripts/utils/are-scripts-in-sync.py
47+
- ./tools/check-messages.py
13148

132-
duplicate-includes:
49+
uninstalled-headers:
13350
stage: test
134-
image: "${CI_REGISTRY_IMAGE}:latest"
135-
tags:
136-
- linux
137-
- amd64
13851
script:
139-
- ./tools/check-for-duplicate-includes.sh
52+
- ./tools/find-uninstalled-headers.py
53+
54+
missing-api-commands:
55+
stage: test
56+
script:
57+
- ./tools/check-for-missing-api-commands.sh
14058

14159
missing-config-h-include:
14260
stage: test
143-
image: "${CI_REGISTRY_IMAGE}:latest"
144-
tags:
145-
- linux
146-
- amd64
14761
script:
14862
- FILES=$(./tools/add-config-h.sh -n)
14963
- printf '%s\n' "${FILES}"
15064
- test -z "${FILES}"
15165

15266
missing-git-attribute:
15367
stage: test
154-
image: "${CI_REGISTRY_IMAGE}:latest"
155-
tags:
156-
- linux
157-
- amd64
15868
script:
15969
- git_diff=$(git diff)
16070
- if test -n "${git_diff}"; then printf '%s\n\ngit diff should be empty here under all circumstances. CI broken?\n' "${git_diff}"; exit 1; fi
16171
- ./tools/print-generated-files.sh -a
16272
- git_diff=$(git diff)
16373
- if test -n "${git_diff}"; then printf '%s\n\n.gitattributes are missing a generated file. Please run "./tools/print-generated-files.sh -a" and commit the resulting change to fix them.\n' "${git_diff}"; exit 1; fi
16474

75+
shellcheck:
76+
stage: test
77+
script:
78+
- ./tools/shellcheck-all.sh
79+
80+
.base_get_list_of_modified_files: &get_modified_files
81+
- MODIFIED_FILES=$(git diff --name-only $(git merge-base origin/master HEAD))
82+
- echo "${MODIFIED_FILES}"
83+
84+
.base_get_list_of_python_scripts: &get_python_scripts
85+
- PYTHON_SCRIPTS=$(find ${INPUT-.} -type f -not -path './.git/*' -and \( -name '*.py' -or -name '*.py.in' \) | sort)
86+
- echo "${PYTHON_SCRIPTS}"
87+
- if test -z "${PYTHON_SCRIPTS}"; then echo "No python scripts to check. Exiting early."; exit 0; fi
88+
89+
bandit:
90+
script:
91+
- bandit -r ./src -x ./.git
92+
93+
pycodestyle:
94+
stage: test
95+
script:
96+
# - *get_modified_files
97+
# - INPUT="${MODIFIED_FILES}"
98+
- *get_python_scripts
99+
- pycodestyle --config=.gitlab/ci/pycodestyle.cfg ${PYTHON_SCRIPTS}
100+
101+
pylint:
102+
stage: test
103+
script:
104+
# - *get_modified_files
105+
# - INPUT="${MODIFIED_FILES}"
106+
- *get_python_scripts
107+
- pylint --jobs "$(nproc || gnproc || echo 1)" --rcfile ./.gitlab/ci/pylint.rc ${PYTHON_SCRIPTS}
108+
# If we reached this point, it means pylint passed. Run again with all warnings enabled, but ignore the return code to show a list of improvements that the developer could do, even when CI is passing.
109+
- pylint --jobs "$(nproc || gnproc || echo 1)" --rcfile ./.gitlab/ci/pylint.rc --enable all ${PYTHON_SCRIPTS} || true
110+
165111
############################### SAST ################################
166112
# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/sast/
167113
#

.gitlab/ci/pycodestyle.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pycodestyle]
2+
max-line-length = 120

.gitlab/ci/pylint.rc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[MASTER]
2+
disable=,
3+
consider-using-f-string, # TODO: This one is decent. There are too many to fix. Enable later.
4+
fixme,
5+
invalid-name,
6+
missing-class-docstring,
7+
missing-function-docstring,
8+
missing-module-docstring,
9+
too-few-public-methods,
10+
too-many-arguments,
11+
too-many-boolean-expressions,
12+
too-many-branches,
13+
too-many-instance-attributes,
14+
too-many-lines,
15+
too-many-locals,
16+
too-many-statements,
17+
max-line-length=120

0 commit comments

Comments
 (0)