Skip to content

Fix Zephyr discovery IPv4 conversion - #418

Merged
EugenioCollado merged 1 commit into
eProsima:masterfrom
Old-Ding:codex/zephyr-discovery-address-type
Jul 13, 2026
Merged

Fix Zephyr discovery IPv4 conversion#418
EugenioCollado merged 1 commit into
eProsima:masterfrom
Old-Ding:codex/zephyr-discovery-address-type

Conversation

@Old-Ding

Copy link
Copy Markdown
Contributor

Summary

  • copy discovery IPv4 bytes directly into struct in_addr storage in both POSIX discovery backends
  • avoid requiring the optional in_addr_t typedef, which Zephyr's minimal libc does not provide
  • add a unit test for IPv4 address byte conversion

This addresses the in_addr_t build failure reported in #397 without changing the public discovery API.

Root cause

CMake classifies Zephyr as UCLIENT_PLATFORM_POSIX, so its discovery build compiles these POSIX backends. Zephyr 2.7.1 defines struct in_addr.s_addr as uint32_t, but its minimal libc does not define in_addr_t.

Testing

  • MinGW GCC 16.1.0 full library and unit-test build
  • ctest --output-on-failure: 15/15 tests passed
  • Zephyr 2.7.1 header-shape compile check: previous expression fails on missing in_addr_t; the new copy compiles and preserves all four address bytes
  • git diff --check

Copy discovery IPv4 address bytes into in_addr storage so Zephyr's
minimal libc does not need to provide the optional in_addr_t typedef.

Add a unit test for the address conversion.

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>

@EugenioCollado EugenioCollado left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EugenioCollado
EugenioCollado merged commit ba34dea into eProsima:master Jul 13, 2026
8 checks passed
@mergify

mergify Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants