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

Disabling IPv6 support #242

Open
gavanderhoorn opened this issue May 17, 2021 · 6 comments
Open

Disabling IPv6 support #242

gavanderhoorn opened this issue May 17, 2021 · 6 comments

Comments

@gavanderhoorn
Copy link
Contributor

gavanderhoorn commented May 17, 2021

The platform I'm trying to build the client for does not offer support for IPv6.

While it doesn't appear there are many places where AF_INET6 et al. is referenced, I wanted to ask whether there is a way to disable looking for/using IPv6 at configure time (CMake option perhaps)?


Edit: I'm running into this as I'm trying to build the posix set of UDP/TCP transports. I could create a custom transport and make it "IPv6-less", but I'm hoping there would be a more efficient way of achieving this.

@pablogs9
Copy link
Member

Where is failing your build? Which are the defines or functions in Micro XRCE-DDS Client transports that are not defined in your system? Just AF_INET6?

@gavanderhoorn
Copy link
Contributor Author

gavanderhoorn commented May 17, 2021

Yes, essentially all files referring to AF_INET6, which I believe are these:

./src/c/profile/transport/ip/ip_posix.c
./src/c/profile/transport/ip/ip_windows.c
./src/c/profile/transport/ip/tcp/tcp_transport_posix.c
./src/c/profile/transport/ip/tcp/tcp_transport_windows.c
./src/c/profile/transport/ip/udp/udp_transport_posix.c
./src/c/profile/transport/ip/udp/udp_transport_posix_nopoll.c
./src/c/profile/transport/ip/udp/udp_transport_windows.c

I could also #define AF_INET6 .. to something, but having a configuration option (and accompanying #ifdefs perhaps in the code) would communicate intent much better I believe (ie: setting UCLIENT_PROFILE_UDPv6=OFF clearly communicates IPv6 support for UDP is disabled).

@pablogs9
Copy link
Member

Basically, those files are not going to be built if you are in a non-windows platform:

./src/c/profile/transport/ip/ip_windows.c
./src/c/profile/transport/ip/tcp/tcp_transport_windows.c
./src/c/profile/transport/ip/udp/udp_transport_windows.c

If you are building the library with a CMake cross-compilation toolchain, is possible to add to your toolchain file:

add_compile_definitions(AF_INET6=AF_INET)

If you are building the library in the platform using a CMake call you can do:

cmake .. -DCMAKE_C_FLAGS=-DAF_INET6=AF_INET

If you want to contribute a PR with an implementation of your proposal, it will be really welcomed. Thanks!

@gavanderhoorn
Copy link
Contributor Author

gavanderhoorn commented May 17, 2021

I might contribute a PR, but I'd need some more information/guidance.

Would #ifdef-ing the AF_INET6 related code be acceptable?

re: your suggestions: yes, I have something like that right now, but that would be what I'd consider work-arounds.

@pablogs9
Copy link
Member

Yes, the approach should be adding something like option(UCLIENT_PROFILE_IPV6 "Enable IPv6 in transports." ON) and then ifdef in every section related to IPv6 in the transports.

@roncapat
Copy link
Contributor

I met the same issue. It would surely be interesting to have this switch for configuration.

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

No branches or pull requests

3 participants