Skip to content

Add a header file that defines a "byte-swap a 32-bit integer" macro. - #1457

Open
guyharris wants to merge 1 commit into
the-tcpdump-group:masterfrom
guyharris:define-byte-swap-macro-once
Open

Add a header file that defines a "byte-swap a 32-bit integer" macro.#1457
guyharris wants to merge 1 commit into
the-tcpdump-group:masterfrom
guyharris:define-byte-swap-macro-once

Conversation

@guyharris

Copy link
Copy Markdown
Member

Remove the macro from dissectors that use it, and have them include the header file.

Go with the renamed macro from libpcap, and declare the variables on which it's used to be uint32_t.

@infrastation

Copy link
Copy Markdown
Member

Please make the new file say

 * Copyright (c) 2026
 *      The Tcpdump Group and contributors.  All rights reserved.

and use a BSD-2-Clause or BSD-3-Clause. There's a lot of pending BSD clarification work pending, so let's at least not complicate it.

Also I can add a commit with byte swap builtins to libpcap, if you want to copy that in the same go.

@guyharris
guyharris force-pushed the define-byte-swap-macro-once branch from 83268ae to 14cd485 Compare August 18, 2026 11:59
@guyharris

Copy link
Copy Markdown
Member Author

Please make the new file say

Done, with a BSD 2-Clause "Simplified" License.

Should we use SPDX short identifiers, instead?

Also I can add a commit with byte swap builtins to libpcap, if you want to copy that in the same go.

If you have that change ready, go ahead. Update the commit message, and the title and first comment of the pull request, as appropriate.

@infrastation

Copy link
Copy Markdown
Member

Short identifiers are being introduced, typically after it is clear the complete boilerplate is correct rather than copied and pasted from another file. This turned out to be a bigger job than I thought and due to a number of higher-priority interruptions even the clean-up in the-tcpdump-group/libpcap#1441 has not been completed yet. For now it would be sensible enough not to make it worse.

@infrastation

Copy link
Copy Markdown
Member

Also s/header fine/header file/.

Remove the macro from dissectors that use it, and have them include the
header file.

Go with the renamed macro from libpcap, and declare the variables on
which it's used to be uint32_t.
@guyharris
guyharris force-pushed the define-byte-swap-macro-once branch from 14cd485 to 89aa800 Compare August 19, 2026 20:04
@guyharris guyharris changed the title Add a header fine that defines a "byte-swap a 32-bit integer" macro. Add a header file that defines a "byte-swap a 32-bit integer" macro. Aug 19, 2026
@guyharris

Copy link
Copy Markdown
Member Author

Also s/header fine/header file/.

Done.

@infrastation

Copy link
Copy Markdown
Member

Also netdissect-stdinc.h defines i386-specific __ntohl() and __ntohs(), which may have already been absorbed into compiler builtins.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants