Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: create a transparent union sockunion #14736

Merged

Conversation

eqvinox
Copy link
Contributor

@eqvinox eqvinox commented Nov 5, 2023

This is GCC extension magic, it allows defining functions that accept different types of arguments. We already have prefixptr (accepts struct prefix *, struct prefix_ipv4 * etc.), this adds one that accepts the various struct sockaddr_… *

About to use this for sockunion, which is not a prefix.  `uniontype`
makes more sense, the macros are for defining transparent unions after
all.

(clang-format off thrown in as it otherwise wrecks formatting.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
As with "prefixptr"/"prefixconstptr", this allows function prototypes to
say "just give me any sockaddr" typing-wise, without having the compiler
complain that a "struct sockaddr_in" is not a "struct sockaddr".

(Split off from other changes that start using this.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
@frrbot frrbot bot added the libfrr label Nov 5, 2023
@donaldsharp donaldsharp merged commit b66dc09 into FRRouting:master Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants