Skip to content

swoc: fix big-endian IPv4 network-order helpers - #93

Closed
pkubaj wants to merge 2 commits into
SolidWallOfCode:masterfrom
pkubaj:patch-1
Closed

pkubaj wants to merge 2 commits into
SolidWallOfCode:masterfrom
pkubaj:patch-1

Conversation

@pkubaj

@pkubaj pkubaj commented Nov 13, 2026

Copy link
Copy Markdown

The big-endian branch of swoc_ip_util.h never compiled: the parameter of is_link_local_network_order() is spelled inaddr_t. Nobody noticed because until #11186 BYTE_ORDER and LITTLE_ENDIAN were both undefined there, so the little-endian branch got picked on every platform. Now a big-endian build (FreeBSD/powerpc64, 10.1.5) stops with

swoc_ip_util.h:96:41: error: unknown type name 'inaddr_t'

While there, is_private_network_order() in the same branch called the link-local check instead of is_private_host_order().

pkubaj and others added 2 commits November 13, 2026 20:19
The big-endian branch of swoc_ip_util.h never compiled: the parameter
of is_link_local_network_order() is spelled inaddr_t. Nobody noticed
because until #11186 BYTE_ORDER and LITTLE_ENDIAN were both undefined
there, so the little-endian branch got picked on every platform. Now a
big-endian build (FreeBSD/powerpc64, 10.1.5) stops with

  swoc_ip_util.h:96:41: error: unknown type name 'inaddr_t'

While there, is_private_network_order() in the same branch called the
link-local check instead of is_private_host_order().
The test_ip.cc checks for these helpers fed host-order values to the
network-order functions and only held on little-endian. Convert with
htonl() so they pass on either byte order.
@bneradt

bneradt commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Sorry, my Claude mislead you. This is the github repo of our now departed friend Alan Carroll. No need to post this patch here or elsewhere. There is another repo for those who use the repo for things other than traffic server, but I merge stuff from apache/trafficserver to that other repo periodically.

@bneradt bneradt closed this Nov 14, 2026
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