Skip to content

Fix IPv4 byte order handling - #567

Open
FranciscoMaxwell wants to merge 1 commit into
ClickHouse:masterfrom
FranciscoMaxwell:fix-ipv4-byte-order
Open

FranciscoMaxwell wants to merge 1 commit into
ClickHouse:masterfrom
FranciscoMaxwell:fix-ipv4-byte-order

Conversation

@FranciscoMaxwell

Copy link
Copy Markdown

Fixes #521.

Summary

This fixes inconsistent byte-order handling in ColumnIPv4:

  • Append(std::string) now stores the network-order value returned by inet_pton without applying a second byte swap.
  • Append(in_addr) now stores in_addr::s_addr as-is, matching the platform/network-order representation used by socket APIs.
  • At() and operator[] now return the stored network-order representation directly.
  • Append(uint32_t) and the vector constructor continue to accept host-order integer values.
  • Adds coverage proving string, host-order integer, and in_addr appends serialize to the same bytes.

Testing

  • cmake -S . -B build -DBUILD_TESTS=ON
  • cmake --build build --target clickhouse-cpp-ut --config Debug --parallel 4
  • .\build\ut\Debug\clickhouse-cpp-ut.exe --gtest_filter="ColumnsCase.ColumnIPv4*"
  • git diff --check

@CLAassistant

CLAassistant commented Sep 24, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

Incorrect byte order conversion in ColumnIPv4::Append() overloads

2 participants