Skip to content

Commit dea5f1c

Browse files
authored
Merge pull request #764 from david-cermak/feat/mdns_malloc_caps
[mdns]: Allow allocate memory with configured caps
2 parents f1a72ec + 384d1c2 commit dea5f1c

File tree

16 files changed

+692
-416
lines changed

16 files changed

+692
-416
lines changed

.github/workflows/mdns__host-tests.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,36 @@ jobs:
3535
# Next we run the pytest (using the console app)
3636
pytest
3737
38-
build_afl_host_test_mdns:
38+
host_compat_checks:
3939
if: contains(github.event.pull_request.labels.*.name, 'mdns') || github.event_name == 'push'
40-
name: Build AFL host test
40+
name: Set of compatibility checks
4141
strategy:
4242
matrix:
4343
idf_ver: ["latest"]
44-
idf_target: ["esp32"]
4544

4645
runs-on: ubuntu-22.04
4746
container: espressif/idf:${{ matrix.idf_ver }}
4847
steps:
4948
- name: Checkout esp-protocols
5049
uses: actions/checkout@v4
51-
with:
52-
path: esp-protocols
5350
- name: Install Necessary Libs
5451
run: |
5552
apt-get update -y
5653
apt-get install -y libbsd-dev
57-
- name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
58-
env:
59-
IDF_TARGET: ${{ matrix.idf_target }}
54+
- name: Test AFL compat build
6055
shell: bash
6156
run: |
6257
. ${IDF_PATH}/export.sh
63-
cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/tests/test_afl_fuzz_host/
58+
cd components/mdns/tests/test_afl_fuzz_host/
6459
make INSTR=off
60+
- name: Test no malloc functions
61+
shell: bash
62+
run: |
63+
cd components/mdns
64+
for file in $(ls *.c); do
65+
cp $file /tmp
66+
echo -n "Checking that $file does not call any std allocations directly..."
67+
python mem_prefix_script.py $file
68+
diff -q $file /tmp/$file || exit 1
69+
echo "OK"
70+
done

components/mdns/.cz.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ commitizen:
33
bump_message: 'bump(mdns): $current_version -> $new_version'
44
pre_bump_hooks: python ../../ci/changelog.py mdns
55
tag_format: mdns-v$version
6-
version: 1.6.0
6+
version: 1.7.0
77
version_files:
88
- idf_component.yml

components/mdns/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [1.7.0](https://github.com/espressif/esp-protocols/commits/mdns-v1.7.0)
4+
5+
### Features
6+
7+
- Support user defined allocators ([88162d1f](https://github.com/espressif/esp-protocols/commit/88162d1f))
8+
- Allow allocate memory with configured caps ([7d29b476](https://github.com/espressif/esp-protocols/commit/7d29b476))
9+
10+
### Bug Fixes
11+
12+
- Adjust some formatting per indent-cont=120 ([5b2077e3](https://github.com/espressif/esp-protocols/commit/5b2077e3))
13+
314
## [1.6.0](https://github.com/espressif/esp-protocols/commits/mdns-v1.6.0)
415

516
### Features

components/mdns/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ else()
1010
set(MDNS_CONSOLE "")
1111
endif()
1212

13+
set(MDNS_MEMORY "mdns_mem_caps.c")
14+
1315
idf_build_get_property(target IDF_TARGET)
1416
if(${target} STREQUAL "linux")
1517
set(dependencies esp_netif_linux esp_event)
1618
set(private_dependencies esp_timer console esp_system)
17-
set(srcs "mdns.c" ${MDNS_NETWORKING} ${MDNS_CONSOLE})
19+
set(srcs "mdns.c" ${MDNS_MEMORY} ${MDNS_NETWORKING} ${MDNS_CONSOLE})
1820
else()
1921
set(dependencies lwip console esp_netif)
2022
set(private_dependencies esp_timer esp_wifi)
21-
set(srcs "mdns.c" ${MDNS_NETWORKING} ${MDNS_CONSOLE})
23+
set(srcs "mdns.c" ${MDNS_MEMORY} ${MDNS_NETWORKING} ${MDNS_CONSOLE})
2224
endif()
2325

2426
idf_component_register(

components/mdns/Kconfig

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,47 @@ menu "mDNS"
6161
default 0x0 if MDNS_TASK_AFFINITY_CPU0
6262
default 0x1 if MDNS_TASK_AFFINITY_CPU1
6363

64-
choice MDNS_TASK_MEMORY_ALLOC_FROM
65-
prompt "Select mDNS task create on which type of memory"
66-
default MDNS_TASK_CREATE_FROM_INTERNAL
67-
config MDNS_TASK_CREATE_FROM_SPIRAM
68-
bool "mDNS task creates on the SPIRAM"
69-
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
70-
config MDNS_TASK_CREATE_FROM_INTERNAL
71-
bool "mDNS task creates on the internal RAM"
72-
endchoice
64+
menu "MDNS Memory Configuration"
65+
66+
choice MDNS_TASK_MEMORY_ALLOC_FROM
67+
prompt "Select mDNS task create on which type of memory"
68+
default MDNS_TASK_CREATE_FROM_INTERNAL
69+
config MDNS_TASK_CREATE_FROM_SPIRAM
70+
bool "mDNS task creates on the SPIRAM (READ HELP)"
71+
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
72+
help
73+
mDNS task creates on the SPIRAM.
74+
This option requires FreeRTOS component to allow creating
75+
tasks on the external memory.
76+
Please read the documentation about FREERTOS_TASK_CREATE_ALLOW_EXT_MEM
77+
78+
config MDNS_TASK_CREATE_FROM_INTERNAL
79+
bool "mDNS task creates on the internal RAM"
80+
81+
endchoice
82+
83+
choice MDNS_MEMORY_ALLOC_FROM
84+
prompt "Select mDNS memory allocation type"
85+
default MDNS_MEMORY_ALLOC_INTERNAL
86+
87+
config MDNS_MEMORY_ALLOC_SPIRAM
88+
bool "Allocate mDNS memory from SPIRAM"
89+
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
90+
91+
config MDNS_MEMORY_ALLOC_INTERNAL
92+
bool "Allocate mDNS memory from internal RAM"
93+
94+
endchoice
95+
96+
config MDNS_MEMORY_CUSTOM_IMPL
97+
bool "Implement custom memory functions"
98+
default n
99+
help
100+
Enable to implement custom memory functions for mDNS library.
101+
This option is useful when the application wants to use custom
102+
memory allocation functions for mDNS library.
103+
104+
endmenu # MDNS Memory Configuration
73105

74106
config MDNS_SERVICE_ADD_TIMEOUT_MS
75107
int "mDNS adding service timeout (ms)"

components/mdns/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.6.0"
1+
version: "1.7.0"
22
description: "Multicast UDP service used to provide local network service and host discovery."
33
url: "https://github.com/espressif/esp-protocols/tree/master/components/mdns"
44
issues: "https://github.com/espressif/esp-protocols/issues"

0 commit comments

Comments
 (0)